Coding your MPP program in PL/I

The following program is a skeleton MPP written in PL/I.

The numbers to the right of the program refer to the notes for the program. All storage areas that are referenced in the parameter list of your PL/I application program call to IMS can optionally reside in the extended virtual storage area.

If you plan to execute PL/I programs in 31-bit addressing mode, see Enterprise PL/I for z/OS® Programming Guide.

Skeleton MPP written in PL/I

                                                                   NOTES
  /*                                                      */ 
  /*                     ENTRY POINT                      */  
  /*                                                      */
      UPDMAST:  PROCEDURE (IO_PTR, ALT_PTR, DB_PTR)                       1 
      OPTIONS (MAIN);
  DCL   FUNC_GU     CHAR(4)   INIT('GU  ');                               2
  DCL   FUNC_ISRT   CHAR(4)   INIT('ISRT');                   
  .                                                           
  DCL   SSA_NAME...;
  . 
  DCL   MSG_SEG_IO_AREA    CHAR(n);                                       3
  DCL   DB_SEG_IO_AREA     CHAR(n);                           
  DCL   ALT_MSG_SEG_OUT    CHAR(n);                           
  .  
  DCL   1 IO_PCB BASED (IO_PTR),...;                                      4
  DCL   1 ALT_PCB BASED (ALT_PTR),...;                        
  DCL   1 DB_PCB BASED (DB_PTR),...;                          
  . 
  DCL   THREE FIXED BINARY(31) INIT(3);                                   5
  DCL   FOUR FIXED BINARY(31)  INIT(4);                       
  DCL   PLITDLI ENTRY EXTERNAL;                               
  .
  CALL PLITDLI (THREE, FUNC_GU, IO_PTR, MSG_SEG_IO_AREA);                 6
  .
  CALL PLITDLI (FOUR, FUNC_GU, DB_PTR, DB_SEG_IO_AREA,                    7
       SSA_NAME);                                             
  . 
  CALL PLITDLI (THREE, FUNC_ISRT, ALT_PTR, ALT_MSG_SEG_OUT);              8
  .  
  END UPDMAST;                                                            9
  PL/I LANGUAGE INTERFACE                                                 10
Note:
  1. This is the standard entry point to a PL/I Optimizing Compiler MPP. This statement includes a pointer for each PCB that the MPP uses. You must refer to the PCBs in the same order as they are listed in the PSB: first the TP PCB, then any alternate PCBs that your program uses, and finally the database PCBs that your program uses.
  2. The program defines each call function that it uses in its data area. In PL/I, you define the function codes as character strings and assign the appropriate values to them.
  3. Define PCB Masks as major structures based on the addresses passed in the PROCEDURE statement. Although not shown in the example, you will code the appropriate additional fields in the structure, depending on the type of PCB to which the mask is associated.
  4. To define your PCBs, use major structure declarations.
  5. PL/I calls have a parameter that is not required in COBOL programs or assembler language programs. This is the parmcount, and it is always the first parameter. You define the values that your program will need for the parmcount in each of its calls. The parmcount gives the number of parameters that follow parmcount itself.
  6. The program issues a GU call to the I/O PCB to retrieve the first message segment.
  7. The program can issue a GU call to a DB PCB to retrieve a database segment. The function codes for these two calls are identical; the way that IMS distinguishes between them is by the PCB to which each call refers.
  8. The program then sends an output message to an alternate destination by issuing an ISRT call to an alternate PCB.
  9. When there are no more messages for the program to process, the program returns control to IMS by issuing the END statement or the RETURN statement.
  10. You must bind your program to the IMS language interface module, DFSLI000, after you have compiled your program.