Coding your MPP program in COBOL

The program shown below is a skeleton MPP in COBOL that shows the main elements of an MPP.

The numbers to the right of each part of the program refer to the notes that follow the program. If you plan to preload your IBM® COBOL for z/OS® & VM program, you must use the compiler option RENT. Alternatively, if you plan to preload your VS COBOL II program, you must use the compiler options RES and RENT. Enterprise COBOL programs version 4.2 or later must be compiled with the RENT compiler option to generate reentrant code. For more information about the RENT option, see Compiling and linking COBOL programs for running under IMS.

If you want to use the IBM COBOL for z/OS & VM compiler to compile a program that is to execute in AMODE(31) on z/OS, you must use the compiler option RENT. Alternatively, if you want to use the VS COBOL II compiler to compile a program that is to execute in AMODE(31) on z/OS, you must use the compiler options RES and RENT. All storage areas that are referenced in the parameter lists of your calls to IMS can optionally reside in the extended virtual storage area.

IBM COBOL for z/OS & VM and VS COBOL II programs can coexist in the same application.

Important:

Skeleton MPP written in COBOL

                                                                      NOTES:
  ENVIRONMENT DIVISION.                                                                      
      .                                              
      .                                              
      .                                              
  DATA DIVISION.                                     
  WORKING-STORAGE SECTION.                                   1
      77 GU-CALL PICTURE XXXX VALUE 'GU  '.          
      77 ISRT-CALL PICTURE XXXX VALUE 'ISRT'.        
      77 CT PICTURE S9(5) COMPUTATIONAL VALUE +4.    
      01 SSA-NAME.                                   
      . 
      01 MSG-SEG-IO-AREA.                                    2   
      .                                              
      01 DB-SEG-IO-AREA.                             
      .                                              
      01 ALT-MSG-SEG-OUT.                            
      .                                              
  LINKAGE SECTION.
      01 IO-PCB.                                             3   
      .                                              
      01 ALT-PCB.                                    
      .                                              
      01 DB-PCB.                                     
      .  
  PROCEDURE DIVISION USING IO-PCB, ALT-PCB, DB-PCB           4
      .  
      CALL 'CBLTDLI' USING GU-CALL, IO-PCB,                  5
          MSG-SEG-IO-AREA.                           
      .  
      CALL 'CBLTDLI' USING GU-CALL, DB-PCB,                  6
          DB-SEG-IO-AREA, SSA-NAME.                  
      .
      CALL 'CBLTDLI' USING ISRT-CALL, ALT-PCB,               7
          ALT-MSG-SEG-OUT.                           
      . 
      GOBACK.                                                8
COBOL LANGUAGE INTERFACE                                     9
Note:
  1. To define each of the call functions that your program uses, use a 77 or 01 level working-storage statement. Assign the value to the call function in a picture clause defined as four alphanumeric characters.
  2. Use a 01 level working-storage statement for each I/O area that you will use for message segments.
  3. In the linkage section of the program, use a 01 level entry for each PCB that your program uses. You can list the PCBs in the order that you list them in the entry statement, but this is not a requirement.
  4. On the procedure statement, list the PCBs that your program uses in the order they are defined in the program's PSB: first the TP PCB, then any alternate PCBs, and finally the database PCBs that your program uses.
  5. The program issues a GU call to the I/O PCB to retrieve the first segment of an input message.
  6. The program issues a GU call to the DB PCB to retrieve the segment that would be described in the SSA-NAME area.
  7. The program sends an output message segment to an alternate destination by using an alternate PCB.
  8. When no more messages are available for your MPP to process, you return control to IMS by issuing the GOBACK statement.

    If you compile all of your COBOL programs in the task with VS COBOL II, you can use the GOBACK statement with its normal COBOL-defined semantics.

    Attention: The STOP RUN and EXIT PROGRAM statements are not supported. Using these statements might cause unpredictable results or abends.
  9. If the COBOL compiler option NODYNAM is specified, you must link edit the language interface module, DFSLI000, with your compiled COBOL application program. If the COBOL compiler option DYNAM is specified, do not link edit DFSLI000 with your compiled COBOL program.