TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB IMS-DC Tools Articles Forum Quiz Interview Q&A

IMSDC Simple Screen Flows With Examples


imsdc-simple-flow-screen
imsdc-simple-menu-application
  PRINT ON,NOGEN
MENUDF   FMT
  DEV   TYPE=(3270,2),
        FEAT=IGNORE,                                            X
        SYSMSG=ERRMSG,                                          X
        DSCA=X’00A0’,                                           X
        PFK=(PFKFIELD,                                          X
        ‘/FOR CRO  ‘,                                           X
        ‘/FOR DI2O ‘,                                           X
        ‘/FOR DIDSO‘)
  DIV   TYPE=INOUT
  DPAGE CURSOR=((1,2)),FILL=PT
  DFLD  ‘RECEIVABLES MENU’,POS=(1,2),ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘DATE:’,POS=(1,65),ATTR=(PROT,ALPHA,HI,NOMOD)
CURDATE  DFLD  POS=(1,72),LTH=9,ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘PF1’,POS=(5,10),ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘ENTER CASH RECEIPTS’,POS=(5,15),                       X
        ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘PF2’,POS=(6,10),ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘DISPLAY INVOICE SUMMARY’,POS=(5,15),                   X
        ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘PF3’,POS=(7,10),ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘DISPLAY INVOICE DETAILS’,POS=(7,15),                   X
        ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘PRESS THE INDICATED PF KEY FOR THE’,POS=(10,10),       X
        ATTR=(PROT,ALPHA,HI,NOMOD)
  DFLD  ‘FUNCTION YOU WANT TO PERFORM’,POS=(11,10),             X
        ATTR=(PROT,ALPHA,HI,NOMOD)
ERRMSG   DFLD  POS=(23,2),LTH=79,ATTR=(PROT,ALPHA,HI,NOMOD)
  FMTEND
*
MENUI    MSG   TYPE=INPUT,SOR=(MENUDF,IGNORE),NXT=MENUO
  SEG
  MFLD  PFKFIELD,LTH=10
  MSGEND
*
MENUO    MSG   TYPE=OUTPUT,SOR=(MENUDF,IGNORE),NXT=MENUI
  SEG
  MFLD  (CURDATE,DATE2)
  MFLD  LTH=1
  MSGEND
*
  END

Note That the MOD has a MFLD of 1 byte. It isn’t used and is needed only because MFS does not allow a output message of length 0.


Another Sample with a Skeleton Program:

Operator Keys in
/FORMAT  DI20.

IMS selects the MOD DI20 and the right DOF (based on your terminal type) to output the first screen. The operator now has to enter the invoice number and hit enter.

imsdc-simple-invoice-summary-screen

The blue back lighted text is output initially.

  • The operator enters the invoice number, back lighted in yellow.

  • The program outputs the inquiry results in the text back lighted in green

  • The text back lighted in purple is used as an error message area, either by IMS or by the program.

  • The text back lighted in blue are coded as literals in DFLD fields.

The MFS for this is shown below.

  PRINT ON,NOGEN
DI2DF    FMT
  DEV   TYPE=(3270,2),                                          X
        FEAT=IGNORE,                                            X
        SYSMSG=ERRMSG,                                          X
        DSCA=X’00A0’
        DIV   TYPE=INOUT
        DPAGE CURSOR=((3,12)),FILL=PT
        DFLD  ‘DISPLAY INVOICE SUMMARY’,POS=(1,2),                    X
              ATTR=(HI,PROT)
        DFLD  ‘DATE:’,POS=(1,65),ATTR=(HI,PROT)
CURDATE  DFLD  POS=(1,72),LTH=8,ATTR=(HI,PROT)
        DFLD  ‘INVOICE:’,POS=(3,2),ATTR=(HI,PROT)
INVNO    DFLD  POS=(3,12),LTH=6,ATTR=(NUM)
        DFLD  ‘DATE:’,POS=(3,21),ATTR=(HI,PROT)
INVDATE  DFLD  POS=(3,28),LTH=8,ATTr=(PROT)
        DFLD  ‘SUBTOTAL:’,POS=(3,55),ATTR=(PROT)
SUBTOTAL DFLD  POS=(3,55),LTH=9,ATTR=(PROT)
        DFLD  ‘DISCOUNT:’,POS=(4,41),ATTR=(HI,PROT)
DISCOUNT DFLD  POS=(4,55),LTH=9,ATTR=(PROT)
        DFLD  ‘SALES TAX:’,POS=(5,41),ATTR=(HI,PROT)
SALESTAX DFLD  POS=(5,55),LTH=9,ATTR=(PROT)
        DFLD  ‘FREIGHT:’,POS=(6,41),ATTR=(HI,PROT)
FREIGHT  DFLD  POS=(6,55),LTH=9,ATTR=(PROT)
        DFLD  ‘---------‘,POS=(7,55),ATTR=(HI,PROT)
        DFLD  ‘BILLING:’,POS=(8,41),ATTR=(HI,PROT)
BILLING  DFLD  POS=(8,55),LTH=9,ATTR=(PROT)
        DFLD  ‘PMTS/ADJS:’,POS=(9,41),ATTR=(HI,PROT)
PMTSADJS DFLD  POS=(9,55),LTH=9,ATTR=(PROT)
        DFLD  ‘---------‘,POS=(10,55),ATTR=(HI,PROT)
        DFLD  ‘DUE:’,POS=(11,41),ATTR=(HI,PROT)
DUE      DFLD  POS=(11,55),LTH=9,ATTR=(PROT)
ERRMSG   DFLD  POS=(23,2),LTH=79,ATTR=(PROT)
        FMTEND
**********************************************************************
DI2I     MSG   TYPE=INPUT,SOR=(DI2DF,IGNORE),NXT=DI2O
        SEG
        MFLD  ‘DI2     ‘,LTH=8
        MFLD  INVNO,LTH=6,JUST=R,FILL=C’0’
        MSGEND
*
DI2O     MSG   TYPE=OUTPUT,SOR=(DI2DF,IGNORE),NXT=DI2I
        SEG
        MFLD  (CURDATE,DATE2)
        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

  • On the operator entering an invoice number and hitting the enter key, an input message in the following format is generated and queued in the message queue.

    The structure of the input message is as follows:-

    LL field which is 4 bytes for PL/I and 2 bytes for COBOL

    ZZ field of two bytes

    Data field of variable length. The structure of this field is determined by the MID, but the first eight characters always have the transaction name.

  • The LL field indicates the length of the segment. For PL/I the LL field is 4 bytes (FIXED BINARY(31)) and has the length of the whole segment including LL and ZZ fields minus 2. For COBOL the LL field is 2 bytes (PIC S9(4) COMP) and has the length of the segment.

  • The ZZ field is two bytes. On input the ZZ field is used by IMS and must be left alone. On output the ZZ field may be considered to be 2 single byte fields, Z1 and Z2. The Z1 field is reserved by IMS. The Z2 field may be used to send special commands to the device like ringing a bell, etc. If these features are not used, it must be set to binary zeroes.

  • To determine the structure of the data portion look at the MID definition source.

  • The first 8 characters of the data part of this message is DI2 which IMS, after referring to its resource definitions identifies as a transaction name. The program corresponding to this transaction is scheduled.

  • When the program starts executing it issues a GU against the I/O PCB (the first pointer passed to the MAIN procedure in PL/I or the first PCB mask in the linkage section). It should receive a blank status code, indicating the input message has been successfully fetched. It is possible that more such messages from other users could be queued behind this message. If no message is available for processing it will receive a QC. Usually MPP programs are coded to fetch more messages after each message is processed and the response sent back to the originating terminal.

  • If a message has more than one segment, issue a GU for the first segment. Then issue GN’S for subsequent segment until you get a QD status code. The program designer has to know at coding / design time whether a message can have more than one segment. The MID is where you indicate to IMS that you have more than one segment, by coding more than one SEG macro.

  • In this case the program uses the IM_INVOICE_NO (it’s a PL/I program) field in the program input data area where the input message segment is read and performs a data base access. The data fetched is moved into field in the output message structure.

  • The output message structure is sent to the terminal via an ISRT call that uses the I/O PCB. As it passes through the MOD, IMS moves the data into appropriate fields in the DOF and the resultant screen is sent back to the terminal.


PROGRAM SKELETON:

DI2: PROC(IO_PCB_PTR,DB_PCB_PTR) OPTIONS(MAIN);

DCL(IO_PCB_PTR,DB_PCB_PTR) POINTER;

DCL PLITDLI ENTRY;

DCL 01 IO_PCB_MASK BASED(IO_PCB_PTR),
       05 IO_LTERM-NAME   	CHAR(8).
       05 IO_IMS_RSVD     	CHAR(2).
       05 IO_STATUS_CODE  	CHAR(2).
       05 IO_CURR_DATE    	FIXED DEC(7,0).
/*
Is a right justified field of form YYDDD
*/
       05 IO_CURR_TIME    	FIXED DEC(7,1).
/*
is a right justified field of the form HHMMSST
*/
       05 IO_MSG_NUMBER   	FIXED BIN(31).
/*
The Message sequence number is a running sequence number per
terminal since IMS start up */
       05 IO_MOD_NAME     	CHAR(8).
/*
If MFS was used to format the input message, contains the
MOD name, else spaces
*/
       05 IO_USER-ID      	CHAR(8);

DCL 01 DB_PCB BASED(DB_PCB_PTR),
       05 DBD_NAME                    CHAR (08),
       05 SEGMENT_HIERARCHY_LEVEL_IO  CHAR (02),
       05 DLI_STATUS_CODE             CHAR (02),
       05 DLI_PROCESSING_OPTIONS      CHAR (04),
       05 RESERVED_FOR_DLI            CHAR (04),
       05 SEGMENT_NAME_FEEDBACK_AREA  CHAR (08),
       05 LENGTH_OF_KEY_FEEDBACK_AREA FIXED BINARY(31),
       05 NUMBER_OF_SENSITIVE_SEGMENTS FIXED BINARY(31),
       05 KEY_FEEDBACK_AREA           CHAR (NN);

DCL 01  INPUT_MESSAGE_IO_AREA,
        02    IM_LL    FIXED BINARY(31),
        02    IM_ZZ    FIXED BINARY(15),
        02    IM_TRANSACTION_CODE  CHAR(8),
        02    IM_INVOICE_NO        CHAR(6);

DCL 01  OUTPUT_MESSAGE_IO_AREA,
        02    OM_LL    FIXED BINARY(31) INIT(160),
        02    OM_ZZ    FIXED BINARY(15) INIT(0),
        02    OM_INVOICE_NO     CHAR(6),
        02    OM_INVOICE_DATE   CHAR(8),
	      02    OM_PRODUCT_TOTAL  PIC'ZZZZZ.99-',
        02    OM_CASH_DISC      PIC'ZZZZZ.99-',
        02    OM_SALES_TAX      PIC'ZZZZZ.99-',
        02    OM_FREIGHT        PIC'ZZZZZ.99-',
        02    OM_BILLING        PIC'ZZZZZ.99-',
        02    OM_PMTS_ADJS      PIC'ZZZZZ.99-',
        02    OM_BALANCE        PIC'ZZZZZ.99-',
        02    OM_ERROR_LINE     CHAR(79);

DCL C_3 FIXED BINARY(31) INIT(3);

DCL C_GU_FUNC  CHAR(4) INIT(‘GU’);

DCL C_ISRT_FUNC  CHAR(4) INIT(‘ISRT’);

CALL PLITDLI ( C_PARM3,
          C_GU_FUNC,
               IO_PCB_PTR,
               INPUT_MESSAGE_IO_AREA );

DO WHILE(IO_STATUS_CODE = ‘ ‘);
/*
PROCESS THE IM_INVOICE_NO HERE AND
SET UP OUTPUT MESSAGE AREA
*/
  CALL PLITDLI ( C_3,
            C_ISRT_FUNC,
                 IO_PCB_PTR,
                 OUTPUT_MESSAGE_IO_AREA );
/*
See if another input message is available for processing
*/
  CALL PLITDLI ( C_3,
            C_GU_FUNC,
                 IO_PCB_PTR,
                 INPUT_MESSAGE_IO_AREA );

END;   /* END OF DO */

Complex Screen Flows:

imsdc-complex-flow-screen

By default, the MOD from the same format set as the MID is used when the application sends a reply. You can change the MOD by a fifth parameter in the ISRT call as below:-

CALL PLITDLI ( PARM_COUNT,
		      C_ISRT_FUNC,
          IO_PCB_PTR,
          OUTPUT_MESSAGE_IO_AREA,
          NEW_MFS_MOD_NAME);


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!

Are you looking for Job Change? Job Portal