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

DL/I Programming


To enable a program to communicate correctly with IMS, certain programming conventions needs to be followed. An application program is treated as a subroutine of IMS, and standard subroutine linkages and parameters lists, hook IMS to application programs. A proper linkage between the program and PCBs passed by IMS needs to be established.

Linkage Section:

01	PCB1-MASK.
	03    DATA-BASE-NAME		PIC X(8).
	03    CURRENT-SEGMENT-LEVEL	PIC XX.
	03    STATUS-CODE			PIC XX.
		88  SUCCESSFUL			VALUE '  '.
		88  OPEN-ERROR			VALUE 'AI'.
		88  NEW-LEVEL-UPWARDS		VALUE 'GA'.
		88  END-OF-DATA-SET		VALUE 'GB'.
		88  SEGMENT-NOT-FOUND		VALUE 'GE'.
		88  NEW-SEGMENT-TYPE		VALUE 'GK'.
		88  DUPLICATE-SEGMENT		VALUE 'II' 'LB'.
		88 END-OF-MESSAGES		VALUE 'QC'.
		88 END-OFMSG-SEGMENTS		VALUE 'QD'.
	03    DLI-PROCESSING-OPTION	PIC X(04).
		88 GET-FUNCTION			VALUE 'G'.
		88 INSERT-FUNCTION			VALUE 'I'.
		88 REPLACE-FUNCTION 		VALUE 'R'.
		88 DELETE-FUNCTION			VALUE 'D'.
		88 ALL-THE-ABOVE			VALUE 'GIRD'.
		88 LOAD-SEG-IN-ASC-SEQ-HIDAM	VALUE 'LS'.
	03   RESERVED-FOR-DLI		PIC S9(09) COMP.
	03   SEGMENT-NAME-FEEDBACK	PIC X(08).
	03   LENGTH-OF-CONCAT-KEY	PIC S9(09) COMP.
	03   NUMBER-OF-SENSITIVE-SEG	PIC S9(09) COMP.
	03   KEY-FEEDBACK.
05 ................
05 ...............
	  ..........

Procedure Division:

ENTRY  'DLITCBL'   USING PCB1-MASK.
	......
	......

GOBACK:

In the above example the PCB is defined in Linkage section which sets the linkage between the program and PSB. The ENTRY statement assigns a standard IMS name to the entry point of the program. The entry point of a COBOL IMS program must be DLITCBL. The USING clause lists the names of the PCB masks coded in the Linkage Section. ENTRY statement also gives the program access to the PCB through the USING clause.

The data names in Linkage Section describe the data areas in the PCB. These data names make up a data structure called the PCB mask. The PCB mask is defined in the Linkage Section because the PCB itself resides in storage owned by IMS. It does not reside in any of the application program's data areas. Although the order in which the PCB masks are coded in Linkage Section does not matter, they need to be listed on the ENTRY statement in the same sequence as they appear in the program's PSBGEN.

The ENTRY statement provides a mechanism for DL/I to transfer control to the program. When the program ends, it must pass control back to DL/I so that DL/I can deallocate its resources and close the data base data sets. To do that GOBACK statement is required. If the program is ended with a STOP RUN statement, control returns directly to the operating system; DL/I never has a chance to perform its termination functions.


IMS CALL - PARAMETER LIST:

The CALL statement parameter list and the data items identified in the parameter list make up the DL/I interface language. The first parameter is the number of parameters followed in the CALL statement. Note that this parameter is optional. The Second parameter names a four-byte Function Code that describes the type of service requested.

For example to retrieve a segment the value to be coded is 'GU' or 'GN'. The third parameter identifies the PCB mask referenced in the call. The PCB mask parameter is included in the call parameter list as well as in the entry coding, because many IMS programs use more than one PCB. The PCB mask parameter is required even if the program accesses only one PCB.

The fourth parameter gives the address of the data area into which IMS places the retrieved segment. Some programs retrieve segments of various types using the same retrieval call, in which case an I/O area must be large enough to contain the data retrieved.

CALL 'CBLTDLI' USING PARAMETER-COUNT
        DLI-FUNCTION
        PCB-MASK
        SEGMENT-IO-AREA
        [SEGMENT-SEARCH-ARGUMENTS]

In the above example the 1st parameter is optional, 2nd, 3rd and 4th parameters are required with all retrieval calls. The fifth parameter can be optionally specified from one to fifteen SSAs to further describe a retrieval.



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