Program entry point


The program entry statement is a starting point of the program. The program entry statement should be the first executable statement in the program.

It always immediately after the Procedure Division statement for the COBOL programs. This statement used to make IMS to passes control to application program at the entry statement in the program.

It is used to pass the control from the DL/I to the COBOL program. The application program returns control to IMS when finished the program execution (when GOBACK/STOPRUN executed).

ENTRY ’DLITCBL’ USING pcb1, pcb2…...

The above statement is only for COBOL – DB2 programs. DLITCBL stands for DL/I to COBOL. The entry statement is used to define the entry point in the program. The batch initialization module is responsible for triggering the application program and program is executed under its control.

The DL/I load the required control blocks which are required by application program and loads the application program. After that control will be transferred to the application program when the program started execution.

For IMS program which uses DB2, the entry statement will not be specified. Instead of above entry point the PCBs are coded on the PROCEDURE DIVISION statement like below.

PROCEDURE DIVISION USING pcb1, pcb2…...

Always IO-PCB must be listed in the program entry statement. IO-PCB should require in any of the above formats. IO-PCB should be specified first. The PCB definition inside the Linkage section is called as PCB Mask. The relation can be created between actual PCB’s and PCB masks based on the listing in entry statement. The entry point PCB’s sequence should be same as the PCB’s sequence in PSB.

Steps to follow while calling subprogram:


The above program entry point definition is required in main program only. Program entry point definition not required in sub program. While calling sub program, All the PCBs required by the sub program needs to be passed form main program.

The PSB address can be provided by DL/I to the application program while giving the control. All PCB should be coded in linkage section because of the address passed from DL/I.

Note!
  • PCBs are passed by IMS to program in the same order they are listed in the PSB.
  • The IO-PCB must be listed first.
  • Programs using older versions of IMS had separate entry statements.
  • In recent IMS versions, this is changed and no specific entry statement is required.
  • But to maintain the compatibility with older programs it supports both. Hope this answers your question.