Search

Friday, September 25, 2015

Trigger JCL via SPOOL option in CICS

CODE SNIPPET

 
IDENTIFICATION DIVISION.  
PROGRAM-ID. SAMPLE.  
AUTHOR.
DATE-WRITTEN. 04/01/XXXX.
DATE-COMPILED. 04/01/XXXX.
*******************************************************************
* CODE SNIPPET TO FORM JCL VIA CICS.                              *
* ONLINE PROGRAM CALLED THROUGH TRANSACTION                       *

*******************************************************************


ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.

01 WS-T PIC X (8).
01 JCL-CARDS.
05 FILLER PIC X (80) VALUE '//SAMPLE JOB (XYZ),"BATCH RUN"','.00
05 FILLER PIC X(80) VALUE '// CLASS=E,MSGLEVEL=(1,1),REGION=0M,MSGCLASS=X'.
05 FILLER PIC X(80) VALUE '//THREAD EXEC PGM=IKJEFT01,DYNAMNBR=20'.
05 FILLER PIC X(80) VALUE '//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=CEE.SCEECICS,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=CEE.SCEELKED,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=SYS1.DSNXXX.SDSNLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=DSNXXX.DBXX.RUNLIB.LOAD,DISP=SHR'.


05 FILLER PIC X(80) VALUE '// DD DSN=ABCD.XXX.COBLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=ABCD.XXX.ASMLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '//SYSTSPRT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSPRINT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSABOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSDBOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSUDUMP DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSIN DD *'.  
05 WS-THREAD-DTLS.
  10 FILLER PIC X(12) VALUE 'CTRANSAC 0001'.  
  10 FILLER PIC X(68) VALUE ' '.
05 FILLER PIC X(80) VALUE ' '.
05 FILLER PIC X(80) VALUE '/*'.
05 FILLER PIC X(80) VALUE '//SYSTSIN DD *'.
05 FILLER PIC X(80) VALUE ' DSN SYSTEM(DBXX)'.
05 FILLER PIC X(80) VALUE ' RUN PROGRAM(PXXXXXX)-'.
05 FILLER PIC X(80) VALUE ' PLAN(PXXXX)'.
05 FILLER PIC X(80) VALUE 'END'.
05 FILLER PIC X(80) VALUE '//*'.
05 FILLER PIC X(80) VALUE '/*EOF'.

01 FILLER REDEFINES JCL-CARDS.
  05 CARD OCCURS 27 TIMES INDEXED BY CARD-INDEX PIC X(80).
 
01 WS-JCL-LINES PIC 9(3) VALUE 27.

PROCEDURE DIVISION.

A-MAIN-PARA.

PERFORM B-MAIN-PROCESS THRU B-MAIN-PROCESS-EXIT
 
PERFORM C-TERMINATION THRU C-TERMINATION-EXIT

A-MAIN-PARA-EXIT.
EXIT.
 
B-MAIN-PROCESS.

EXEC CICS
SPOOLOPEN OUTPUT
USERID('INTRDR')
NODE('XXXX')
TOKEN(WS-T) 
NOHANDLE
END-EXEC


PERFORM VARYING CARD-INDEX FROM 1 BY 1 UNTIL CARD-INDEX > WS-JCL-LINES
EXEC CICS SPOOLWRITE
          TOKEN(WS-T)
FROM(CARD(CARD-INDEX))
FLENGTH(80)
NOHANDLE
END-EXEC

END-PERFORM

EXEC CICS SPOOLCLOSE
TOKEN(WS-T)
NOHANDLE
END-EXEC.

 
B-MAIN-PROCESS-EXIT.
EXIT.

C-TERMINATION.
GOBACK.
 
C-TERMINATION-EXIT.
EXIT.

Sample JCL:

//SAMPLE JOB (XYZ),'BATCH RUN',0.0
//CLASS=E,MSGLEVEL=(1,1),REGION=0M,MSGCLASS=X
//THREAD EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR
// DD DSN=CEE.SCEECICS,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=SYS1.DSNXXX.SDSNLOAD,DISP=SHR
// DD DSN=DSNXXX.DBXX.RUNLIB.LOAD,DISP=SHR
// DD DSN=ABCD.XYZ.COBLOAD,DISP=SHR
// DD DSN=ABCD.XYZ.ASMLOAD,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
 CTRANSC 0001
/*
//SYSTSIN DD *
DSN SYSTEM(DBXX)
RUN PROGRAM(PXXXXXX)-
PLAN(PXXXX)
END
//*  

No comments:

Post a Comment