IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

JCL with variables


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
M Lee Klein

New User


Joined: 08 Feb 2022
Posts: 39
Location: USA

PostPosted: Sat Sep 17, 2022 1:14 am
Reply with quote

I have this jcl that I run to extract from an archive.

I'd like to be able to use variables for items in bold so that I can use an input file and run this job multiple times for each member in the input file.

Suggestions on where to start?

//STEP1 EXEC PGM=SARBCH,PARM='MK.SAR.PROD'
//SYSPRINT DD SYSOUT=*
//DISKOUT DD DSN=MK.TEST.SAR.JB4179,MGMTCLAS=MCNOBD,
// DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,
// DCB=(RECFM=FBA,LRECL=121,BLKSIZE=0),
// SPACE=(CYL,(20,10),RLSE)
//SYSIN DD *
/PRINT ID=ABCDEFG DDNAME=DISKOUT GEN=11578 SEQ=0002
//

INPUT file

JB1234,ABCDEFG,11578,1
JB2345,HIGKLMN,11579,2
JB3456,OPQRSTU,11580,1
etc...
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sat Sep 17, 2022 1:36 am
Reply with quote

The SET-variables in JCL are resolved before the job is submitted (similar to macro expansion). You cannot do it taking values from the file, when the job is running.

If you do not change your general (wrong) approach, you must do it in two separate stages = two separate jobs.

Stage 1. The preparation job. It takes your “parameters” a.k.a. values from your file, and creates (as regular text) the JCL itself, to be used at stage 2.

Stage 2. You can submit the dynamically generated JCL text from stage 1, to be executed as normal job (with no “variables” used at this time.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts JCL Variables JCL & VSAM 1
No new posts reset/clear ALL application profile v... TSO/ISPF 3
No new posts REXX - Adding variables CLIST & REXX 8
No new posts using based or defined variables PL/I & Assembler 2
No new posts Numeric check on packed signed and un... COBOL Programming 4
Search our Forums:

Back to Top