After DC gives control to the program specified by an initial task code, that program can transfer control to other DC programs on the same level. That is, the issuing program does not expect return of control.
Steps to Transfer Control
To transfer control laterally, perform the following steps:
Because control is transferred, there is no need to perform the IDMS-STATUS routine.
'COBOL programmers'. If you specify a parameter list, the specified data items must be defined in the LINKAGE SECTION of both the calling and the receiving programs.
'PL/I programmers'. If you specify a parameter list, the specified data items must be defined as based storage in both the calling and the receiving programs. For further considerations related to this subject, see Appendix A, “PL/I Considerations”.
Example of Transferring Control Laterally
The program excerpt below shows a TRANSFER CONTROL request that includes a parameter list containing database retrieval information.
The ERRCHEK program performs error checking and passes control to the GETPROG program, which performs the database access.
PROGRAM-ID. ERRCHEK. DATA DIVISION. WORKING-STORAGE SECTION. 01 GETPROG PIC X(8) VALUE 'GETPROG'. LINKAGE SECTION. 01 PASS-DEPT-INFO. 05 PASS-DEPT-ID PIC 9(4). 05 PASS-DEPT-INFO-END PIC X. PROCEDURE DIVISION. BIND MAP SOLICIT. BIND MAP SOLICIT RECORD SOLICIT-REC. MAP IN USING SOLICIT. *** PERFORM ERROR CHECKING *** IF SOLICIT-DEPT-ID NOT NUMERIC THEN GO TO SOLICIT-ERROR. *** ACQUIRE STORAGE FOR DEPT-ID TO BE PASSED *** GET STORAGE FOR PASS-DEPT-INFO TO PASS-DEPT-INFO-END WAIT LONG USER KEEP STGID 'PDIN' ON DC-NEW-STORAGE NEXT SENTENCE. MOVE SOLICIT-DEPT-ID TO PASS-DEPT-ID. *** TRANSFER CONTROL TO DATABASE ACCESS PROGRAM *** TRANSFER CONTROL TO GETPROG XCTL USING PASS-DEPT-INFO. ______________________________________________________________________________ PROGRAM-ID. GETPROG. DATA DIVISION. WORKING-STORAGE SECTION. 01 GETPROG PIC X(8) VALUE 'GETPROG'. LINKAGE SECTION. 01 P-DEPT-INFO. 05 P-DEPT-ID PIC 9(4). 05 P-DEPT-INFO-END PIC X. PROCEDURE DIVISION USING P-DEPT-INFO. COPY IDMS SUBSCHEMA-BINDS. READY. MOVE P-DEPT-ID TO DEPT-ID-0410. *** OBTAIN DEPARTMENT USING PASSED DEPT-ID *** OBTAIN DEPARTMENT CALC ON DB-REC-NOT-FOUND PERFORM ERR-NO-DEPT. . *** FURTHER DATABASE PROCESSING ***
Copyright © 2013 CA.
All rights reserved.
|
|