Follow

JCL Examples

This is part of the Heirloom Computing Elastic Batch Platform forum on paas.heirloomcomputing.com.

Below are a number of example JCL and other input decks to the Heirloom Computing EBP subsystem.

Hello World

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST04 JOB (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
//           MSGLEVEL=(2,2),NOTIFY=USERID
//*
//* copy a message to the printer. (use LIST Web service with this
//* job's job number in the OUTPUT field, no step name and MSG
//* in the DDNAME field)
//*
//STEPID01 EXEC PGM=IEBGENER
//SYSIN    DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD *
Hello Heirloom Computing Elastic Batch Processing World!
/*
//SYSUT2   DD SYSOUT=*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

This generates the following MSG output dataset:

2016-11-29 17:01:37 HEIRLOOM COMPUTING INC - ELASTIC BATCH PLATFORM - JES/JCL (v16.11.29)

2016-11-29 17:01:37 $HASP111I JOB 38174 TEST01   STARTED                                   ON CLASS A
2016-11-29 17:01:37 $HASP117I JCL SCAN START
2016-11-29 17:01:37 $HASP118I          //* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
2016-11-29 17:01:37 $HASP118I          //TEST01 JOB (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
2016-11-29 17:01:37 $HASP118I          //           MSGLEVEL=(2,2),NOTIFY=USERID
2016-11-29 17:01:37 $HASP118I          //*
2016-11-29 17:01:37 $HASP118I          //* copy a message to the printer. (use LIST Web service with this
2016-11-29 17:01:37 $HASP118I          //* job's job number in the OUTPUT field, no step name and MSG
2016-11-29 17:01:37 $HASP118I          //* in the DDNAME field)
2016-11-29 17:01:37 $HASP118I          //*
2016-11-29 17:01:37 $HASP118I          //STEPID01 EXEC PGM=IEBGENER
2016-11-29 17:01:37 $HASP118I          //SYSIN    DD DUMMY
2016-11-29 17:01:37 $HASP118I          //SYSPRINT DD SYSOUT=*
2016-11-29 17:01:37 $HASP118I          //SYSUT1   DD *
2016-11-29 17:01:37 $HASP118I          Hello Heirloom Computing Elastic Batch Processing World!
2016-11-29 17:01:37 $HASP118I          /*
2016-11-29 17:01:37 $HASP118I          /*
2016-11-29 17:01:37 $HASP118I          //SYSUT2   DD SYSOUT=*
2016-11-29 17:01:37 $HASP118I          //* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
2016-11-29 17:01:37 $HASP117I JCL SCAN END

2016-11-29 17:01:37 $HASP125I JOB ANALYSIS START
2016-11-29 17:01:37 $HASP126I              JOB ATTRIBUTE NAME: TEST01
2016-11-29 17:01:37 $HASP126I              JOB ATTRIBUTE CLASS: A
2016-11-29 17:01:37 $HASP126I              JOB ATTRIBUTE ACCOUNT: HCIACCT
2016-11-29 17:01:37 $HASP126I              JOB ATTRIBUTE PROGRAMMER: Hello World job

2016-11-29 17:01:37 $HASP126I              STEP ATTRIBUTE NAME: STEPID01
2016-11-29 17:01:37 $HASP126I              STEP ATTRIBUTE PGM: IEBGENER
2016-11-29 17:01:37 $HASP126I              DD ATTRIBUTE NAME: SYSIN
2016-11-29 17:01:37 $HASP126I              DD ATTRIBUTE NAME: SYSPRINT
2016-11-29 17:01:37 $HASP126I              DD ATTRIBUTE NAME: SYSUT1
2016-11-29 17:01:37 $HASP126I              DD ATTRIBUTE NAME: SYSUT2

2016-11-29 17:01:37 $HASP125I JOB ANALYSIS STOP


2016-11-29 17:01:37 $HASP135I JOB 38174 TEST01   STEP STEPID01          STARTED
2016-11-29 17:01:38 $HASP136I JOB 38174 TEST01   STEP STEPID01          TERMINATED         WITH CC 0

2016-11-29 17:01:38 $HASP112I JOB 38174 TEST01   TERMINATED                                WITH CC 0
2016-11-29 17:01:38 =====================================================
2016-11-29 17:01:38 $HASP174I OUTPUT FROM STEP 'STEPID01' DD NAME 'SYSPRINT'
IUTIL200I HEIRLOOM COMPUTING INC - JOB UTILITIES
IUTIL201I IEBGENER UTILITY PROGRAM 

IUTIL202I READING CONTROL CARDS
IUTIL203I 000 CONTROL CARDS READ

IEBGE208I IEBGENER STARTING:  COPYING SYSUT1 TO SYSUT2
IDCAM245I REPRO 57 BYTES READ
IDCAM244I REPRO 1 RECORDS WRITTEN
IEBGE209I IEBGENER COMPLETED, CC=0 

IUTIL224I IEBGENER UTILITY PROGRAM COMPLETED WITH CC 0
2016-11-29 17:01:38 =====================================================
2016-11-29 17:01:38 $HASP174I OUTPUT FROM STEP 'STEPID01' DD NAME 'SYSUT2'
Hello Heirloom Computing Elastic Batch Processing World!

Python Script Control

#!/usr/bin/python
#//mark job xxxx,class=p
# test python batch job in EBP
# define job class P with max wall clock (elpased time) of 20
# start initiator for P
# submit this job
#
import time

print "EBP Python Test started"
print "job runs for 60 seconds"
for i in range(1,20):
    print "TRT " + str(i*3)
    time.sleep(3)
print "EBP Python Test finished"

Shell Script Control

#!/bin/bash
#//mark job 1234,class=s # test shell script batch job in EBP # define job class S with max wall clock (elpased time) of 20 # start initiator for S # submit this job #
# STDOUT and STDERR DD come out on the job's message dataset,
# shell command echo -x will appear on STDERR, echo command on STDOUT
set -x
echo "Hello EBP from BASH shell"
# # first writable datalib is available as DATA environment
datadir=$DATA
echo "EBP Shell Test started" >$datadir/test.dat

Job Step Conditional Execution

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST05   JOB  (HCIACCT),'COND tests',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID
//* test various COND parameters, basic form being COND=(4,LT) meaning
//* bypass the job step 4 is less than the prior job step's RC (run
//* the step if a prior RC is greater than or equal to 4)
//*
//* note:  Heirloom-extended IEFBR14 is used to return a specific RC
//*
//* unconditionally run RUN1 which returns 8
//RUN1     EXEC PGM=IEFBR14,PARM='RC=8'
//*
//* bypass BYPASS2 because 4 is LT 8 of RUN1
//BYPASS2  EXEC PGM=IEFBR14,COND=(4,LT)
//*
//* run RUN3 because 8 is NOT LT 8 of RUN1; set the RC to 4
//RUN3     EXEC PGM=IEFBR14,COND=(8,LT,RUN1),PARM='RC=4'
//*
//* bypass BYPASS4 because 8 is EQ 8 of RUN1; set the RC to 4
//BYPASS4  EXEC PGM=IEFBR14,COND=(8,EQ,RUN1),PARM='RC=4'
//*
//* run RUN5 because 8 is NOT EQ 8 of RUN1; set the RC to 4 and wait 10 seconds
//RUN5     EXEC PGM=IEFBR14,COND=(8,NE,RUN1),
//              PARM='RC=4 SLEEP=10 SYSOUT=hi SYSERR=there'
//*
//* run RUN6 because 8 is NOT GT 8 of RUN1; set the RC to 4 (long PARM)
//RUN6     EXEC PGM=IEFBR14,COND=(8,GT,RUN1),PARM='RC=4'
//*
//* bypass BYPASS7 because 16 is GT 8 of RUN1; set the RC to 4
//BYPASS7  EXEC PGM=IEFBR14,COND=(16,GT,RUN1),PARM='RC=4'
//*
//* bypass BYPASS8 because 4 is LT 8 of RUN1; set the RC to 4
//BYPASS8  EXEC PGM=IEFBR14,PARM='RC=4',
//              COND=((4,NE,RUN5),(4,NE,RUN6),(4,LT,RUN1))
//*
//* bypass BYPASS9 because it runs ONLY if an abend occurred
//BYPASS9  EXEC PGM=IEFBR14,COND=ONLY
//*
//* abend ABEND10 because PGM doesn't exist (normally abends entire job)
//ABEND10  EXEC PGM=MISSING
//*
//* run RUN11 EVEN if a prior BYPASS9 abended
//RUN11    EXEC PGM=IEFBR14,COND=EVEN,PARM='RC=32'
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Load VSAM KSDS via IDCAMS, read via COBOL

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST60  JOB (25297812),'IDCAMS DEL,DEF,REPRO',CLASS=A,MSGLEVEL=(2,2)
//         SET  HLQ=HCI00               high-level qualifier of DSNs
//*
//* TEST60 - load a VSAM file with IDCAMS, read it with COBOL
//*
//* use IEBGENER to create a PS dataset from inline data
//IEBGENER EXEC PGM=IEBGENER
//SYSUT2   DD DSN=&HLQ..TEST60.DATA,DISP=NEW
//SYSUT1   DD *
9790242093mark
9790242283bill
9790337562john
9790802177jane
9790843247fred
9790906317mary
9790913586cece 
9790913636alex
9790913685debi 
9791780844dawn
9791780851drew
9792438202troy
9792438210ward
9792886517ross
9798857215vera
9798858049phil
9798858056otto
9798858064paul
9798993606rene
9798993721rhys
9798993739mari
9799357744lori
9799357751neil
9799467568kurt
9799471875lisa
9799471883lucy
9799665948kris
9799665997jack
9799889480hugh
9815038161jody
9815722103jane
9815722111jeff
/*
//* use IDCAMS to delete, define
//IDCAMS1  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=W                                                         
//*                                          
//SYSIN    DD  *
 DELETE                                    -                        
     HCI00.TEST60.VSAM                     -                        
     PURGE                                 -                        
     CLUSTER                                                           
 IF LASTCC= 8                              -                        
    THEN                                                                
    SET MAXCC= 0000                                                     
 DEFINE CLUSTER                            -                        
    (NAME(HCI00.TEST60.VSAM)               -                                              
     INDEXED                               -                        
     KEYS(10 0)                            -                        
     UNIQUE                                -                        
     RECORDSIZE(14 14)                     -                        
     FREESPACE(10 10)                      -                        
    )                                      -                        
    DATA                                   -                        
       (NAME(HCI00.TEST60.VSAM.DATA))      -             
    INDEX                                  -                        
       (NAME(HCI00.TEST60.VSAM.INDEX))   
/*
//*
//* use IDCAMS REPRO to load a VSAM KSDS file
//IDCAMS2  EXEC PGM=IDCAMS                                                      
//*                                                                     
//SYSPRINT DD  SYSOUT=W                                                 
//*                                                                     
//INDD     DD  DSN=&HLQ..TEST60.DATA,              
//             DISP=SHR                                                 
//*                                                                     
//OUTDD    DD  DSN=&HLQ..TEST60.VSAM,                          
//             DISP=MOD                                                 
//*                                                                     
//SYSIN    DD  *
 REPRO           -                                                      
 INFILE(INDD)    -                                                      
 OUTFILE(OUTDD)                                                         
 IF LASTCC= 12   -                                                      
 THEN                                                                   
 SET MAXCC= 0000
/*
//* create a program to do a keyed read on one record.
//* Note: set up EBP classlib.n, systemlib.n, datalib.n
//* according to https://heirloomcomputing.zendesk.com/entries/
//*              22825398-EBP-JCL-Integration-with-Elastic-COBOL
//EC01     EXEC PROC=HCECOBOL,PGMID=TEST60
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//COPY.SYSUT1    DD   *
       IDENTIFICATION DIVISION. 
       PROGRAM-ID. TEST60.
      * 
      *  TEST60 - read a record written to a VSAM file, set RC
      *  key: "9798993721" dependent value: "rhys"
      *
       Environment Division.
       Input-Output Section. 
       File-Control.
          Select cust-file Assign To CUSTOMER
          File Status Is ws-status
          Organization Indexed
          Access Is Random
          Record Key Is cust-key
          .
       Data Division.
       File Section.
          FD cust-file.
             01 cust-rec.
                03 cust-key    Pic X(10).
                03 cust-name   Pic X(4).

       WORKING-STORAGE SECTION.
          01 ws-tmp            pic x(10).
          01 ws-status         pic XX.
          01 ws-chkid          pic S9999 comp value 12.
       
       procedure division.
           display "TEST60 - read a record from a VSAM file"
               upon sysout.
           move 0 to return-code.
           open input cust-file.
           perform check.
      *    move "9800000000" to ws-tmp.    *> test lookup failure
           move "9798993721" to ws-tmp.    *> test lookup success
           read cust-file key ws-tmp.
           perform check.
           if cust-name not = "rhys" or
              cust-key  not = "9798993721" then
               move 99 to ws-status
               perform check
           end-if.
           close cust-file.
           perform check.
           display "PASS: name '" cust-name "' has key '" 
               cust-key "'" upon sysout.
           stop run.
       check.
           compute ws-chkid = ws-chkid + 4.
           if ws-status not = '00' then
               display "FAIL: rc=" ws-chkid " stat=" ws-status
                   upon sysout
               move ws-chkid to return-code
               stop run
           end-if
       end program.
/*
//COMPILE.SYSOUT DD   SYSOUT=*
//LINK.SYSOUT    DD   DISP=NEW,DSN=&HLQ..ONEPROG.JAR
//*
//* run the program directly from a job step
//RUN1     EXEC PGM=TEST60
//STEPLIB  DD DISP=SHR,DSN=&HLQ..ONEPROG.JAR
//CUSTOMER DD DISP=SHR,DSN=&HLQ..TEST60.VSAM
//SYSOUT   DD SYSOUT=*
/*
//*
//* **** TEST RESULT
//RESULT  EXEC PGM=IEFBR14,COND=(0,NE,RUN1),
//             PARM='SYSOUT=&JOBNAME+PASS+&LDATE+&LTIME'
//SYSOUT  DD   DISP=(MOD,CATLG),DSN=&HLQ..TESTALL.LOG
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Partitioned Dataset Allocation

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST09   JOB  (22,DEPT22,22IKJ22),'PDS tests',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID
//*
//* test PDS operations
//*
//* allocate a PDS
//RUN1     EXEC PGM=IEFBR14
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD            DISP=(NEW,KEEP),SPACE=(TRK,(1,2,3)),DSN='A.B.C
//             .D.E',DCB=(DSORG=PO)
//* 
//* create a member through GENER
//RUN2     EXEC    PGM=IEBGENER
//SYSUT1   DD *
Hello Heirloom Computing EBP World!
/*
//SYSUT2   DD      DISP=SHR,DSN=A.B.C.D.E(F)
//SYSPRINT DD      SYSOUT=*
//* 
//* print the member through GENER
//RUN3     EXEC    PGM=IEBGENER
//SYSUT1   DD      DISP=SHR,DSN=A.B.C.D.E(F)
//SYSUT2   DD      SYSOUT=*
//*
//* duplicate the PDS via COPY
//RUN4     EXEC    PGM=IEBCOPY
//SYSIN    DD *
COPYPDS    COPY    INDD=DD1,OUTDD=DD2
           SELECT  MEMBER=(F,(F,,R),(F,G))
/*
//SYSPRINT DD      SYSOUT=*
//DD1      DD      DISP=SHR,DSN=A.B.C.D.E
//DD2      DD      DISP=(NEW,KEEP),DSN=A.B.C.D.F,DCB=(DSORG=PO)
//* 
//* print the member through GENER
//RUN5     EXEC    PGM=IEBGENER
//SYSUT1   DD      DISP=SHR,DSN=A.B.C.D.F(G)
//SYSUT2   DD      SYSOUT=*
//SYSPRINT DD      SYSOUT=*
//* 
//* delete the PDSs unless there was a problem
//RUN6     EXEC    PGM=IEFBR14,COND=(0,NE)
//SYSUT1   DD      DISP=(OLD,DELETE),DSN='A.B.C.D.E'
//SYSUT2   DD      DISP=(OLD,DELETE),DSN='A.B.C.D.F'
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

JCL Scan Only

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST10   JOB  (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID,TYPRUN=SCAN
//*
//* check TYPRUN=SCAN with JCL errors.  correcting the JCL
//* error on line 10 will still just do a SCAN when submitted
//*
//STEP1    EXEC PGM=IEBGENER
//SYSIN    DD   DUMMY
//SYSPRINT DD   SYSOUT=*,DSN=ILLEGAL.DSN.ON.SYSOUT
//SYSUT1   DD   *
Hello Heirloom Computing EBP World!
/*
//SYSUT2   DD   SYSOUT=A
//STEP1    EXEC PGM=IEFBR14,PARM='duplicate name'
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Job Submit and Hold

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST11   JOB  (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID,TYPRUN=HOLD
//*  
//* test TYPRUN=HOLD jobs.  release this job with RESTART TEST11
//*
//STEPID01 EXEC PGM=IEBGENER
//SYSIN    DD   DUMMY
//SYSPRINT DD   SYSOUT=*
//SYSUT1   DD   *
Hello Heirloom Computing EBP World!
/*
//SYSUT2   DD   SYSOUT=A
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Submitting a Job through the Internal Reader

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST12   JOB  (22,DEPT22,22IKJ22),'INTRDR tests',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID
//*
//* test EBP INTRDR submission
//*
//* submit a JCL "Hello World" job to the internal reader 
//RUN1     EXEC PGM=IEBGENER
//SYSUT1   DD  *
//TEST13   JOB  (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID
//* copy a message to the printer.  (LIST output for DD name MSG, no 
//* step, step name STEPID01 / DD name SYSUT2 and STEPID01 / SYSPRINT)
//JCL01    EXEC PGM=IEFBR14,PARM='SYSOUT=Hello SYSOUT=World'
//SYSOUT   DD   SYSOUT=*
/*
//SYSUT2   DD   SYSOUT=(,INTRDR)
//SYSPRINT DD   SYSOUT=*
//*
//* submit a Python "Hello World" job to the internal reader 
//RUN2     EXEC PGM=IEBGENER
//SYSUT1   DD  *
#//PYTHON01 JOB class="B"
#python job
print "hello world"
/*
//SYSUT2   DD   SYSOUT=(,INTRDR)
//SYSPRINT DD   SYSOUT=*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Inline and Cataloged Procedures

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST14   JOB  (HCIACCT),'Hello World job',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID,COND=EVEN
//MYCAT    JCLLIB ORDER=(MNH00.JCLLIB.JCL)
//* 
//* test inline, system cataloged and user catalog procedures 
//*
//* note:  test setup required.  Linux-only: cp /bin/cat /data/cat &
//*        cp /bin/echo /data/echo & echo 'test input' >/data/hello
//* results: STEP1.PROCID01-SYSOUT:  "Hello EBP Job Inline.."
//*          STEP2.PROCID01-SYSOUT:  "test input"
//*          STEP3.PROCID01-SYSOUT:  contents from /etc/motd
//*          STEP4.CATSTEP-SYSOUT:   "Hello EBP System Cat.."
//*          STEP6.ECHOSTEP-SYSOUT:  "Hello EBP User Catal.."
//* note:  must run job twice:  first time STEP6 will ABEND because 
//*        at scan time the dynamically created procedure ECHO
//*        does not exist.  the second time it will have been created
//*        thanks to the COND=EVEN the job will run despite the PROC
//*        not being found the first time through
//*
//* define the inline proc
//INLINE   PROC CAT1='/etc/motd'
//PROCID01 EXEC PGM=cat,PARM=&CAT1
//SYSERR   DD   SYSOUT=*
//SYSOUT   DD   SYSOUT=*
//         PEND
//*
//* step 1 calls the inline proc with a specific proc dd replacement
//STEP1    EXEC PROC=INLINE,CAT1=
//PROCID01.SYSIN    DD   *
Hello Heirloom EBP Job Inline Procedure World!
/*
//*
//* step 2 calls the inline proc with a file to cat out
//STEP2    EXEC PROC=INLINE,CAT1='/data/hello'
//*
//* step 3 calls the inline proc the default
//STEP3    EXEC PROC=INLINE
//*
//* step 4 calls the system catalog procedure HCCAT
//* which replaces all DD names of the same name
//STEP4    EXEC PROC=HCCAT
//SYSIN    DD   *
Hello Heirloom EBP System Cataloged Procedure World!
/*
//*
//* step 5 creates a user-defined cataloged procedure
//* (config ebp.datalib and ebp.jcllib both contain /data)
//STEP5    EXEC PGM=IEBGENER
//SYSUT1   DD   *
//ECHO     PROC ARGV='Specify ARGV= to echo something'
//ECHOSTEP EXEC PGM=echo,PARM='&ARGV'
//         PEND
/*
//SYSUT2   DD   DSN=MNH00.JCLLIB.JCL(ECHO),DISP=NEW,DCB=(DSORG=PO)
//SYSPRINT DD   SYSOUT=*
//* 
//* step 6 calls the user catalog procedure ECHO
//* just created (on 2nd running of this job)
//STEP6    EXEC PROC=ECHO,
//              ARGV='Hello Heirloom EBP User Cataloged Procedure World!'
//SYSOUT   DD   SYSOUT=*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Requeueing Jobs to Other Classes

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST15   JOB  (HCIACCT),'Job CPU Time Limit',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID,TIME=(,20)
//*  
//* test requeing of jobs from one class to another
//*
//* note:  test setup required.  define class A with 10 CPU seconds,
//*        and start 1 class A initiator.  define class B with 20
//*        CPU seconds without an initiator.  
//* result:submit this job should result in it starting under 
//*        a class A initiator only to be moved back into a QUEUED
//*        state.  internally it has been changed to Class B.  
//*        to run the job at that point, start a Class B initiator
//*
//STEPID01 EXEC PGM=IEBGENER
//SYSIN    DD   DUMMY
//SYSPRINT DD   SYSOUT=*
//SYSUT1   DD   *
Hello Heirloom Computing EBP World!
/*
//SYSUT2   DD   SYSOUT=A
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

 

Creating and scratching tapes

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST16   JOB  (HCIACCT),'Tape Mgmt',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(2,2),NOTIFY=USERID,TIME=(,20)
//*  
//* test tape creation and cleanup
//*
//* note:  test setup required.  define a datalib.9 configuration
//* parameter that includes the "tape" directory //* //STEPID01 EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT1 DD * Hello Heirloom Comptuing EBP World! /* //* create a tape TP4511 on datalib.9 ("tape" in datalib.9 path) //* that expires on Jan 1, 2014 (which may be in the past) //SYSUT2 DD DISP=NEW,UNIT=TAPE,VOL=SER=TP4511,EXPDT=14001 //* //* clean any expired datasets or tape volumes in datalib.n dirs //STEPID02 EXEC PGM=TMSCLEAN //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

Invoking REXX scripts from TSO

//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//TEST66 JOB (HCIACCT),'Rexx Test',CLASS=A,MSGCLASS=A, 
// MSGLEVEL=(4,4),NOTIFY=&SYSUID 
//* test66: invoke the REXX interpreter with PDS member via TSO 
//* test setup: the "rexx" command must be in one of the 
//* systemlib.n configurations, e.g., 
//* systemlib.6=/usr/local/rexx/bin
//* 
//STEP0020 EXEC PGM=IKJEFT1B 
//SYSEXEC  DD UNIT=SYSALLDA,SPACE=(80,(5,1)), 
//         DSN=&SYSEXEC, 
//         AVGREC=K,DSNTYPE=LIBRARY, 
//         RECFM=FB,LRECL=80,DSORG=PO 
//SYSUT2   DD DISP=(OLD,PASS),VOL=REF=*.SYSEXEC, 
//         DSN=&SYSEXEC(REXXSAMP) 
//SYSIN DD *
     /* REXX */ 
say "Hello world from REXX! Date = "date()", time = "time() 
EXIT 
/* 
//* 
//SYSTSPRT DD SYSOUT=* 
//SYSOUT   DD SYSOUT=* 
//SYSERR   DD SYSOUT=* 
//SYSTSIN  DD * 
REPRO INFILE(SYSIN) OUTFILE(SYSUT2) 
%REXXSAMP 
/* 
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

 Three ways to invoke shell scripts from JCL:

//TESTD9   JOB  (HCIACCT),'Invoke sh from JCL',CLASS=A,MSGCLASS=A,
//              MSGLEVEL=(4,4),NOTIFY=USERID
//*
//* invoke shell scripts from JCL
//*
//* setup required: EBP config for one of the "systemlib0..n"
//* includes the location of an executable "sh" (UNIX/Linux)
//* "sh.exe" (Windows).
//*
//* note: when invoking non-COBOL, non-Java programs from an
//* EXEC statement only SYSIN, SYSOUT and SYSERR DD assignments
//* are allowed.
//*
//         IF   &HLQ='' THEN
//              SET  HLQ=HCI00           high-level qualifier of DSNs
//         ENDIF
//*
//* create a sample shell script in the EBP configured "datalib.0"
//* (default DCB info RECFM=V,DSORG=PS,LINESEQUENTIAL)
//STEP01   EXEC PGM=IEBGENER
//SYSIN    DD   DUMMY
//SYSPRINT DD   SYSOUT=*
//SYSUT1   DD   *
echo Hello Heirloom Computing Elastic Batch Platform Shell Scripting World!
/*
//SYSUT2   DD   DISP=NEW,DSN='&HLQ..MYSCRIPT.SH'
//*
//* invoke a shell script piped into stdin from a script
//* referenced in a DD DSN thats in the configured datalib.0..9
//STEP02   EXEC PGM=sh
//SYSIN    DD   DISP=SHR,DSN='&HLQ..MYSCRIPT.SH'
//*             PATH='/path/to/script' (optional)
//SYSOUT   DD   SYSOUT=*
//SYSERR   DD   SYSOUT=*
//*
//* invoke a shell script on a parameter file
//* note: parameter must be fully qualified
//* note: expect "/bin/sh: 0: Can't open /path/to/MYSCRIPT.SH"
//* sh returns code 127 (step CC)
//STEP03   EXEC PGM=sh,PARM='/path/to/MYSCRIPT.SH'
//SYSIN    DD   DUMMY
//SYSOUT   DD   SYSOUT=*
//SYSERR   DD   SYSOUT=*
//*
//* invoke a shell script directly
//* note:  pgm must match executable file on one of systemlib.0..9
//* configured paths, which themselves may be $PATH environment
//* variables or : separated directories.
//* note: PGM name may be a configured alias, as in,
//* alias.MYSCRIPT=myscript.sh
//* note: MYSCRIPT not found, so this step should ABEND
//STEP04   EXEC PGM=MYSCRIPT
//SYSIN    DD   DUMMY
//SYSOUT   DD   SYSOUT=*
//SYSERR   DD   SYSOUT=*
//*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.

 

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk