You can issue a CL command from an ILE COBOL program through a dynamic program call to QCMDEXC.
In the following example program, the CALL to QCMDEXC (at sequence number 000160) results in the processing of the Add Library List Entry (ADDLIBLE) CL command (at sequence number 000110). The successful completion of the CL command results in the addition of the library, COBOLTEST, to the library list.
Figure 78. Issuing a CL command from an ILE COBOL program.
5722WDS V5R3M0 030905 LN IBM ILE COBOL CBLGUIDE/CMDXMPLE ISERIES1 03/09/15 13:40:28 Page 2 S o u r c e STMT PL SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG DATE 1 000100 IDENTIFICATION DIVISION. 2 000200 PROGRAM-ID. CMDXMPLE. 3 000300 ENVIRONMENT DIVISION. 4 000400 CONFIGURATION SECTION. 5 000500 SOURCE-COMPUTER. IBM-ISERIES 6 000600 OBJECT-COMPUTER. IBM-ISERIES 7 000700 DATA DIVISION. 8 000800 WORKING-STORAGE SECTION. 9 000900 01 PROGRAM-VARIABLES. 10 001000 05 CL-CMD PIC X(33) 001100 VALUE "ADDLIBLE COBOLTEST". 11 001200 05 PACK-VAL PIC 9(10)V9(5) COMP-3 001300 VALUE 18. 12 001400 PROCEDURE DIVISION. 001500 MAINLINE. 13 001600 CALL "QCMDEXC" USING CL-CMD PACK-VAL. 14 001700 STOP RUN. 001800 * * * * * E N D O F S O U R C E * * * * * |
For more information about QCMDEXC, see the CL Programming.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.