Skip to content

Sample COBOL Program CMNOPSCH

Program CMNOPSCH delivered in the CMNZMF SAMPLES library is an example of a COBOL program that calls Serena XML Services through the COBOL batch client program, SERXMLCC. The sample program uses the PACKAGE GENERAL SEARCH service to list packages with IDs that fit mask JONH00057* in the ChangeMan ZMF instance that runs under SERNET subsystem L.

Program CMNOPSCH passes XML requests to SERXMLCC using the PSCH02-REQUEST data structure in copybook XMLCPSCH. Replies from SERXMLCC are received in the PSCH02-RESULT data structure in the same copybook.

These are the significant processing steps in program CMNOPSCH.

  1. Prepare request data in the PSCH02-REQUEST data structure in copybook XMLCPSCH in Working Storage.

    1. Initialize the entire REQUEST-BUFFER.

    2. Set <subsys> name by moving a literal to the HEADER-SUBSYS variable. The literal value is the subsystem ID of the target SERNET instance.

    3. Set <package> name by moving a literal to the I-PACKAGE variable. The literal value is the search mask for the package search operation.

    4. Set the REQUEST-BUFFER-LENGTH variable in copybook XMLCPSCH by using the MOVE LENGTH OF operator.

  2. Call COBOL batch client program SERXMLCC, passing the address of the REQUESTBUFFER in the PSCH02-REQUEST data structure and the RESULT-BUFFER in the PSCH02-RESULT in copybook XMLCPSCH in Working Storage.

  3. Process data returned by SERXMLCC in the PSCH02-RESULT data structure in copybook XMLCPSCH in Working Storage.

    1. If the STATUS-RETURN-CODE is 0, increment Working Storage subscript RESULT-SUBSCR from 1 to the value of RESULT-COUNT returned by SERXMLCC, and display data from each occurrence of RESULT-AREA in the RESULT-BUFFER.

      Note

      Working Storage subscript STATUS-SUBSCR is used to translate the numeric code in O-PACKAGESTATUS into the familiar three-character abbreviation for package status in lookup table STATUS-VALUES in Working Storage.

    2. If the STATUS-RETURN-CODE value is not 0, display the values of the STATUS variables in the RESULT-BUFFER, and set the return code for program CMN0PSCH to the STATUS-RETURN-CODE.

  4. Exit the program.

This JCL shows steps to compile and link edit sample COBOL program CMNOPSCH with dynamic calls to XML Services batch client program SERXMLCC.

Note

You must copy the source for sample program CMNOPSCH from the delivered CMNZMF SAMPLES library to a library with LRECL=80 to input the source to the compiler. The SAMPLES library has LRECL=4096.

//COBOL   EXEC PGM=IGYCRCTL,
//             PARM='LIB,DYNAM',
//             REGION=2048K
//STEPLIB   DD DSN=SYS2.ECOB310.SIGYCOMP,DISP=SHR
//SYSPRINT  DD SYSOUT=*
//SYSLIB    DD DSN=*somnode*.SERCOMC.ASMCPY,DISP=SHR
//SYSIN     DD DSN=*somnode*.CMNZMF.CUSTOM.SAMPLES(CMNOPSCH),
//             DISP=SHR
//SYSLIN    DD DSN=&&LOADSET,
//             DISP=(MOD,PASS),
//             UNIT=SYSDA,SPACE=(TRK,(3,3)),
//             DCB=(BLKSIZE=3200)

...

//SYSUT1    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT2    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT3    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT4    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT5    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT6    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSUT7    DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//*
//LKED     EXEC PGM=HEWL,
//             COND=(4,LT),
//             REGION=1024K
//SYSLIB    DD DSN=CEE.SCEELKED,DISP=SHR
//SYSPRINT  DD SYSOUT=*
//SYSLIN    DD DSN=&&LOADSET,DISP=(OLD,DELETE)
//SYSLMOD   DD DSN=*somnode*.SERCOMC.CUSTOM.LOAD(CMNOPSCH),
//             DISP=SHR
//SYSUT1    DD UNIT=SYSDA,SPACE=(TRK,(10,10))
//*
//EXECUTE  EXEC PGM=CMNOPSCH,
//             COND=(4,LT)
//STEPLIB   DD DSN=*somnode*.CMNZMF.CUSTOM.LOAD,DISP=SHR
//          DD DSN=*somnode*.SERCOMC.CUSTOM.LOAD,DISP=SHR
//          DD DSN=*somnode*.CMNZMF.LOAD,DISP=SHR
//          DD DSN=*somnode*.SERCOMC.LOAD,DISP=SHR
//          DD DSN=CEE.SCEERUN,DISP=SHR
//SYSPRINT  DD SYSOUT=*
//SYSUDUMP  DD SYSOUT=*
//SNAPOUT   DD SYSOUT=*
//SER#PARM  DD DSN=*somnode*.SERCOMC.TCPIPORT,DISP=SHR
//SERPRINT  DD SYSOUT=*

Display from Sample Program CMNOPSCH

This is an example of the data displayed to SYSOUT by sample program CMNOPSCH.

PACKAGE    STA TYP LVL INSTALL CREATOR
========== === === === ======== ========
DEMO000021 DEV PLN SMP 20081024 USER240
DEMO000022 DEV PLN SMP 20090323 USER240
DEMO000023 DEV PLN SMP 20081023 USER240
DEMO000027 BAS PLN SMP 20081117 USER239
DEMO000028 DEV PLN SMP 20081015 USER239
DEMO000029 DEV PLN SMP 20081025 USER239