When MFS formats messages to be sent to a device, it groups message segments into a logical page. You define the logical page using the LPAGE statement within the message statement MSG. IMS will not consider a message complete until all logical pages have been sent. Logical paging is used when multiple pages or displays are needed to satisfy a single request.
The PA1 key is used to move forward from one page to the next. Because you will usually deal with single segment messages, you will usually deal with only one logical page. If only one logical page is required, you do not need to specify the LPAGE statement in your format definition. Our sample format did not use the LPAGE statement because it was a single segment message. If you have a message with 400 logical pages that must be completed before the message can be sent, efficiency is lost and machine response becomes slow. Logical paging also increases the complexity of coding MFS and the program.
You can use several techniques to present more than one screen of output to a client for a message. Use one of the two techniques described below.
A common technique is to have the application program retrieve only enough data to fill one display. The application program stores the current or last retrieved key on a NODISP field of the MFS. Every time the client requests more data, the application uses the key stored in the hidden field to retrieve the new data, and reinitializes the hidden field with the new key value.
Another technique is to have a queue database created that will contain the additional pages of the message, if the client needs to see them. The initial request would cause the application program to gather the data for the first few pages to satisfy the request, but would only present the first page to the client. All other pages would be written to the queue database. As the client indicates on the display the desire to see the next, preceding, or any page of the output, your program would retrieve the appropriate page and display it to the client.
This way, the program does not have to gather all the pages at one time and can be more efficient. The main drawback using this method is that there is an overhead involved in collecting the information to store on the queue database, and the program will have to be defined as an update program to store information on the queue database.
Although different, these techniques have a common characteristic-they allow a more efficient way to present data to a client, as well as a less complex format definition.
Before you try to understand the sample MFS code that uses logical paging, the following needs to be understood.
Paging can be implemented using either physical or logical paging.
In physical paging, the DFLD statements are coded with the POS parameter as POS=(LL,CC,N) where N is the physical page number.
Physical paging is typically used to accommodate different screen sizes. For example a 3270-2 has 24 rows, whereas a 3270-1 has only 12. You then code two DEV statements one for each model. Under the DEV statement for the 3270-2 you have DFLD statements with either no page number or 1, which is the default. Under the DEV statement for 3270-1 you code DFLD statements with both page number 1 as well as 2. MFS will use the right DOF based on the terminal type.
By pressing the PA1 key the operator requests for the next page. PA2 purges all remaining pages in the current message and moves on to the next message. You cannot go backwards in physical paging. Alternately you can code a PF key to do the same thing with PFK=(PFKIN,08=NEXTPP,10=NEXTMSGP). In this case PA1 will do the same thing as PF08 and PA2 does the same thing as PF10. Note that NEXTPP and NEXTMSGP are keywords.
You can also code multiple input pages by coding the DPAGE statement with MULT=YES. As an example CURSOR=((3,12),(3,17)),MULT=YES. You end the input by associating a PF key with the keyword ENDMPPI. Use the enter key to enter data on each page and advance to the next. Use the PA1 key to skip the current page.
A more common approach is the use of logical pages. With Logical Paging, you can do a combination of the following:-
Have one or more DPAGE statements each representing a screen format.
Have one or more LPAGE statement in either MID or MOD or both. It is more usual to have it in the MOD. An LPAGE in the MOD maps to a DPAGE like this:-
SUMLPAGE LPAGE SOR=SUMDPAGE. . . |
When you program inserts a segment, MFS understands which LPAGE to use like this:-
[label] LPAGE SOR=dpagename, COND=(mfldname,{= | < | > | <= | >= },’comparison-value’ SUMLPAGE LPAGE SOR=SUMDPAGE,COND=(LPAGEID,=,’S’) SEG LPAGEID MFLD LTH=1 |
If no match is found the LAST LPAGE is used. Note that the application has to insert a segment with the first data byte set to ‘S’ to select the SUMLPAGE LPAGE above.
On input you can map DPAGE (S) to a MID LPAGE by the SOR keyword as follows:-
LPAGE SOR=(SUMDPAGE, PAYDPAGE, ADJDPAGE) |
You can insert more than one segment from your application against a LPAGE by coding the keyword PAGE=YES on the MSG statement. If you code this MFS inspects the first 5 bytes of any input from the terminal for the following paging commands:-
= Move forward one logical page =NNN move to page NNN =L Move to last logical page =+NNN Move forward NNN logical pages =-NNN Move backward NNN logical pages |
Note that it is easy for MFS to recognize the paging command as they all begin with = which is not a valid character either for a transaction, an LTERM name or a IMS command.
The operator can still use PA1 to see the next logical message. PA2 bypasses the rest of the message.
Since an indefinite number of segments can be inserted when PAGE=YES is coded on the MSG statement, MFS understands that the page building is complete when the application issues a GU against the IO PCB.
You make provision for the 5 bytes needed for the paging command as below:-
SEG MFLD PAGECMD,LTH=5,FILL=NULL MFLD ‘trancode ‘,LTH=8 PAGECMD DFLD POS=(22,17),LTH=5,ATTR=(NOPROT,NOMOD,ALPHA) |
Observe that if the field has not been entered by the operator, it is not transmitted by the terminal. At the MID, since FILL is NULL, the whole field is omitted, leaving the first 8 bytes of the transaction code.
PRINT ON,NOGEN DILDF FMT DEV TYPE=(3270,2), X FEAT=IGNORE, X SYSMSG=ERRMSG, X DSCA=X’00A0’, X PFK=(PFKIN, X 03=’/FOR MENUO’, X 07=’=-1 ‘, X 08=’= ‘) DIV TYPE=INOUT SUMDPAGE DPAGE CURSOR=((3,12),FILL=PT DFLD ‘DISPLAY INVOICE DETAILS – SUMMARY’, X POS=(1,2), X ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘DATE:’,POS=(1,65),ATTR=(PROT,ALPHA,HI,NOMOD) CURDATE DFLD POS=(1,72),LTH=8,ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘INVOICE:’,POS=(3,2),ATTR=(PROT,ALPHA,HI,NOMOD) INVNO DFLD POS=(3,12),ATTR=(NOPROT,NUM,NORM,MOD) DFLD ‘DATE:’,POS=(3,21), ATTR=(PROT,ALPHA,HI,NOMOD) INVDATE DFLD POS=(3,28),LTH=8,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘SUBTOTAL:’,POS=(3,41),ATTR=(PROT,ALPHA,HI,NOMOD) SUBTOTAL DFLD POS=(3,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘DISCOUNT:’,POS=(4,41),ATTR=(PROT,ALPHA,HI,NOMOD) DISCOUNT DFLD POS=(4,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘SALES TAX:’,POS=(5,41),ATTR=(PROT,ALPHA,HI,NOMOD) SALEXTAX DFLD POS=(5,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘FREIGHT:’,POS=(6,55),ATTR=(PROT,ALPHA,HI,NOMOD) FREIGHT DFLD POS=(6,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘---------‘,POS=(7,55),ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘BILLING:’,POS=(8,41),ATTR=(PROT,ALPHA,HI,NOMOD) BILLING DFLD POS=(8,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘PMTS/ADJS’,POS=(9,41),ATTR=(PROT,ALPHA,HI,NOMOD) PMTSADJS DFLD POS=(9,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘---------‘,POS=(10,55),ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘DUE:’,POS=(11,41),ATTR=(PROT,ALPHA,HI,NOMOD) DUE DFLD POS=(11,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘PAGE COMMAND’,POS=(21,2),ATTR=(PROT,ALPHA,HI,NOMOD) PAGECMD DFLD POS=(21,17),LTH=5,ATTR=(NOPROT,ALPHA,NORM,NOMOD) DFLD ‘PF3=RETURN TO MENU; PF8=NEXT’,POS=(22,2), X ATTR=(PROT,ALPHA,HI,NOMOD) ERRMSG DFLD POS=(23,2),LTH=79,ATTR=(PROT,ALPHA,NORM,NOMOD) * * * PAYDPAGE DPAGE CURSOR=((21,17)),FILL=PT DFLD ‘DISPLAY INVOICE DETAILS – PAYMENTS’, X POS=(1,2),ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘DATE:’,POS=(1,65),ATTR=(PROT,ALPHA,HI,NOMOD) CURDATE DFLD POS=(1,72),LTH=8,ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘INVOICE:’,POS=(3,2),ATTR=(PROT,ALPHA,HI,NOMOD) INVNO DFLD POS=(3,12),LTH=6,ATTR=(NOPROT,NUM,NORM,MOD) DFLD ‘DATE:’,POS=(3,21),ATTR=(PROT,ALPHA,HI,NOMOD) INVDATE DFLD POS=(3,28),LTH=8,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘CURRENT BALANCE DUE’,POS=(3,41), X ATTR=(PROT,ALPHA,HI,NOMOD) DUE DFLD POS=(3,62),ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘DATE BANK NUMBER’, X POS=(5,2),ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘CHECK NUMBER AMOUNT’, X POS=(5,38),ATTR=(PROT,ALPHA,HI,NOMOD) DO 12 PDATE DFLD POS=(6,2),LTH=8,ATTR=(PROT,ALPHA,NORM,NOMOD) PBNKNO DFLD POS=(6,12),LTH=25,ATTR=(PROT,ALPHA,NORM,NOMOD) PCHKNO DFLD POS=(6,38),LTH=16,ATTR=(PROT,ALPHA,NORM,NOMOD) PAMT DFLD POS=(6,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) ENDDO DFLD ‘---------‘,POS=(19,55),ATTR=(PROT,ALPHA,HI,NOMOD) TOTALPMT DFLD POS=(20,55),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘PAGE COMMAND: ‘,POS=(21,2),ATTR=(PROT,ALPHA,HI.NOMOD) PAGECMD DFLD POS=(21,17),LTH=5,ATTR=(NOPROT,ALPHA,NORM,NOMOD) DFLD ‘PF3=RETURN TO MENU; PF8=NEXT’,POS=(22,2), X ATTR=(PROT,ALPHA,HI,NOMOD) ERRMSG DFLD POS=(23,2),LTH=79,ATTR=(PROT,ALPHA,NORM,NOMOD) * * * ADJDPAGE DPAGE CURSOR=((21,17)),FILL=PT DFLD ‘DISPLAY INVOICE DETAILS – ADJUSTMENTS’, X POS=(1,2),ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘DATE:’,POS=(1,65),ATTR=(PROT,ALPHA,HI,NOMOD) CURDATE DFLD POS=(1,72),LTH=8,ATTR=(PROT,ALPHA,HI,NOMOD) DFLD ‘INVOICE:’,POS=(3,2),ATTR=(PROT,ALPHA,HI,NOMOD) INVNO DFLD POS=(3,12),LTH=6,ATTR=(NOPROT,NUM,NORM,MOD) DFLD ‘DATE:’,POS=(3,21),ATTR=(PROT,ALPHA,HI,NOMOD) INVDATE DFLD POS=(3,28),LTH=8,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘CURRENT BALANCE DUE’,POS=(3,41), X ATTR=(PROT,ALPHA,HI,NOMOD) DUE DFLD POS=(3,62),ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘DATE TYPE NUMBER AMOUNT’, X POS=(5,2),ATTR=(PROT,ALPHA,HI,NOMOD) DO 12 ADATE DFLD POS=(6,2),LTH=8,ATTR=(PROT,ALPHA,NORM,NOMOD) ATYPE DFLD POS=(6,14),LTH=1,ATTR=(PROT,ALPHA,NORM,NOMOD) ANO DFLD POS=(6,18),LTH=6,ATTR=(PROT,ALPHA,NORM,NOMOD) AAMT DFLD POS=(6,18),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) ENDDO DFLD ‘---------‘,POS=(19,26),ATTR=(PROT,ALPHA,HI,NOMOD) TOTALADJ DFLD POS=(20,26),LTH=9,ATTR=(PROT,ALPHA,NORM,NOMOD) DFLD ‘PAGE COMMAND: ‘,POS=(21,2),ATTR=(PROT,ALPHA,HI.NOMOD) PAGECMD DFLD POS=(21,17),LTH=5,ATTR=(NOPROT,ALPHA,NORM,NOMOD) DFLD ‘PF3=RETURN TO MENU; PF8=NEXT’,POS=(22,2), X ATTR=(PROT,ALPHA,HI,NOMOD) ERRMSG DFLD POS=(23,2),LTH=79,ATTR=(PROT,ALPHA,NORM,NOMOD) FMTEND EJECT DILI MSG TYPE=INPUT,SOR=(DILDF,IGNORE),NXT=DILO LPAGE SOR=(SUMDPAGE,PAYDPAGE,ADJDPAGE) SEG MFLD PAGECMD,LTH=5,FILL=NULL MFLD PFKIN,LTH=10,FILL=NULL MFLD ‘DIL ‘,LTH=8 MFLD INVNO,LTH=6 MSGEND * * * DILO MSG TYPE=OUTPUT,SOR=(DILDF,IGNORE),NXT=DILI,PAGE=YES PAYLPAGE LPAGE SOR=PAYDPAGE,COND=(LPAGEID,=,’P’) SEG MFLD (CURDATE,DATE2) LPAGEID MFLD LTH=1 MFLD INVNO,LTH=6 MFLD INVDATE,LTH=8 MFLD DUE,LTH=9 DO 12 MFLD PDATE,LTH=8 MFLD PBNKNO,LTH=25 MFLD PCHKNO,LTH=16 MFLD PAMT,LTH=9 ENDDO * * * ADJLPAGE LPAGE SOR=ADJDPAGE,COND=(LPAGEID,=,’A’) SEG MFLD (CURDATE,DATE2) LPAGEID MFLD LTH=1 MFLD INVNO,LTH=6 MFLD INVDATE,LTH=8 MFLD DUE,LTH=9 DO 12 MFLD ADATE,LTH=8 MFLD ATYPE,LTH=1 MFLD ANO,LTH=6 MFLD AAMT,LTH=9 ENDDO MFLD TOTALADJ,LTH=9 MFLD ERRMSG,LTH=79 * SUMLPAGE LPAGE SOR=SUMDPAGE,COND=(LPAGEID,=,’S’) SEG MFLD (CURDATE,DATE2) LPAGEID MFLD LTH=1 MFLD INVNO,LTH=6 MFLD INVDATE,LTH=8 MFLD SUBTOTAL,LTH=9 MFLD DISCOUNT,LTH=9 MFLD SALESTAX,LTH=9 MFLD FREIGHT,LTH=9 MFLD BILLING,LTH=9 MFLD PMTSADJS,LTH=9 MFLD DUE,LTH=9 MFLD ERRMSG,LTH=79 MSGEND END |
In this section you were introduced to the basic features of MFS. MFS consists of many features, and at times coding a format can be complex and laborious. To aid in the creation of MFS formats, many user-friendly interfaces have been developed, either in-house or by vendors, that significantly reduce the time and complexity of creating a format. Check with your installation as to whether such an interface is available to you. If there is one, it is recommended that you use it.
There may be times when an interface does not have the capability to take advantage of a particular feature of MFS, and it becomes necessary for you to alter the output of the MFS interface.
Each source member should assemble with a return code of 0. If you find that you have a return code greater than 0, refer to the following list for possible causes:
Find on the word WARN. If the message states that the DFLD may cause a buffer lock on a remote 3270 device, this means a DFLD in pos (1,2) does not have ATTR=NUM.
Find on the character SC=(Severity Code). The assembler will place a position marker ('1') under the offending piece of code and provide a list of the expected values.
Find on the word OVERLAP. These errors are paired up and are normally caused when the attribute byte requirement of the 3270 device is forgotten.
Find on the word SYMBOL. You will be placed at the DPAGE/LPAGE symbol reference table. If four asterisks follow a MSG or FMT in the table, it means there is normally a discrepancy between a DFLD label used by an MFLD. In most cases, this is a typo.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!