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

Message Processing - Input


You have learned that the communication between an IMS online application and a client involves the transmitting of messages back and forth. These messages are always queued to wait for processing. Remember from Section 1, there are three types of messages that can be transmitted between a terminal and IMS. A brief review of the three types is as follows:

If the first character of the input message is a slash (/), this is an IMS operator command.

If the first eight bytes of the message start with an LTERM code, this is a message switch.

If the first eight bytes of the input message are a transaction code, IMS will schedule the application program associated with the transaction code for execution.


Retrieving Messages Using DL/I:

Making retrieval calls to the message queue is similar to making a retrieval call to a database. Use a GET function to the I/O PCB, instead of a data base PCB, to retrieve a message destined for your program. Remember, the first PCB pointer specified in your ENTRY statement (for COBOL) or PROC statement (for PL/I) is considered by IMS to be the I/O PCB.


Get Unique Call:

To retrieve the first segment of a message from the message queue, you must issue a Get Unique (GU) call. The skeleton code shown on the next several pages reflects the DL/I code necessary to retrieve messages from the message queue.

Note: IMS requires that an MPP issue at least one GU call to the I/O PCB to retrieve a message. If the MPP does not issue as least one call to the I/O PCB, IMS will not permit the MPP to end successfully. (The program will abend with a user 462). It is efficient to have the first DL/I call in an MPP issue the GU because when IMS schedules the application program into the dependent region, IMS also transfers the first segment of the first message into the region. If the MPP issues any other DL/I call, IMS has to bring the message back into the region, and the priming efficiency is lost.

The below code indicates the logic for retrieving messages via a QC (status code) loop.

PL/I:

OLPGM:  PROC ( L_IO_PCB-PTR.
              L_DB_PCB_PTR )
              OPTIONS  ( MAIN ) REORDER:
    •
    •
    CALL PLITDLI (C_PARM3,
                  C_GU_FUNC,
                  L_IO_PCB_PTR,
                  W_INPUT_MESSAGE);
    •
    •
    /*MAINLINE*/
    DO WHILE (L_IO_STATUS_CODE = '   ');
        CALL S100_INIT_VAR;
        /** RESET WORK AREAS, IO AREAS **/
                   CALL S300_PROCESS_MESSAGE:
                     •
                     •
                   CALL PLITDLI ( C_PARM3,
                                  C_GU_FUNC,
                                  L_IO_PCB_PTR,
                                  W_INPUT_MESSAGE );

    END; /* DO WHILE  L_IO_STATUS_CODE = '   '  */

    IF L_IO_STATUS_CODE = 'QC' THEN;
          ELSE  CALL S800_ERROR;

Loop GU Message Processing - PL/I


COBOL:

S200-NEXT-SEG.

     CALL 'CBLTDLI' USING C-PARM3,
                          C-GN-FUNC,
                          L-IO-PCB,
                          W-INPUT-MSG-NEXT.

     IF L-IO-STATUS-CODE = C-BLANK–GOOD
        PERFORM S250-PROCESS-SEGMENT
     ELSE
        IF L-IO-STATUS-CODE = C-QD-NO-MORE
           NEXT SENTENCE
        ELSE
           PERFORM S900-ERROR-RTN
        END-IF
     END-IF

Get Next Message Processing - COBOL


Let's examine the flow of logic to process the second and subsequent segments of a message.

  • After determining that at least one segment of a message has been retrieved (successful GU call), and there is a multi segmented message to process, issue a GN call to the I/O PCB.

  • Test the status code of the GN call.

If the status code is blank, you can process the data retrieved from the segment, or check to see if other segments exist for the message by issuing subsequent GN calls until a QD status is returned.

If the status code is QD, there are no more segments for this message, and you can now perform logic to process the entire message.



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