Get value from file & use it is a symbolic variable for
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Job Control Language(JCL)

#1: Get value from file & use it is a symbolic variable for Author: lal PostPosted: Thu Apr 13, 2017 11:16 pm
    —
Hallo,
Good Morning, I have a requirement to fetch a value from the first record in the input file and use that value as a symbolic variable to generate the dataset names in the subsequent steps.

I understand that I can achieve this as follows:
1) 1st step of the JOBA - Get the value from the file and build the SET statement and write it to a PDS member - PDS.LIBRARY(NAMEDS).

For instance // SET NAME=LENOVO

2) 2nd step of the JOBA - Use program like EZACFSM1 and provide a new job JOBB in the instream data and mention the JCLLIB and Include the member (NAMEDS) generated in 1st step and use the symbolic variable in the DSname of the new job and write the output of this JOBA step to internal reader

Code:

//STEPXX  EXEC PGM=EZACFSM1
//SYSOUT   DD SYSOUT=(*,INTRDR)
//SYSIN    DD DATA,DLM=##
//JOBB    JOB 00000000,
//          MSGCLASS=X,
//         CLASS=Q
//LBDPROC JCLLIB ORDER=PDS.LIBRARY
//*
//        INCLUDE MEMBER=NAMEDS
//*
//JSTEP01     EXEC PGM=IEFBR14
//FILE01      DD   DSN=TEST.A&NAME..FILE,
//            DISP=(MOD,DELETE,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE)
//*
##


My question:
I know this works but it will generate 2 jobs - JOBA & JOBB. So my question is...is there anyway we can avoid writing the JOBB to internal reader and use the symbolic variable from the first step of JOBA in the subsequent steps.

Thanks in advance[/code]

#2:  Author: Nic CloustonLocation: At Home PostPosted: Fri Apr 14, 2017 3:57 am
    —
No - once the job has been submitted then the JCL is finalised. The only 'changes' possible are dynamic data set allocation.

#3:  Author: lal PostPosted: Fri Apr 14, 2017 7:52 am
    —
Thanks Nic Clouston for your thoughts...Can you please share a sample JCL of how to achieve this in a single job instead of creating 2 jobs...Thanks...

#4:  Author: kolusuLocation: San Jose PostPosted: Fri Apr 14, 2017 11:53 am
    —
lal wrote:
Thanks Nic Clouston for your thoughts...Can you please share a sample JCL of how to achieve this in a single job instead of creating 2 jobs...Thanks...


lal,

I never understood the fascination of 1 job/step.

Either way if you insist on creating 1 job, then don't bother about the set statement. Generate IDCAMS/TSO Commands to define the new dataset. You can allocate a dataset in many ways. Change the program/utility that generates the SET statements to generate IDCAMS/TSO commands and use them in the same job. Quite simple exercise.

#5:  Author: lal PostPosted: Mon Apr 17, 2017 12:51 am
    —
Hi Kolusu,
Thanks for the response and Sorry, if the question/reply was bit cryptic...

The reason I prefer single job is that I need to build a generic job to be used to work with different kinds of data and also if feasible schedule that
job in the scheduler with predecessor/successor jobs.

For instance if the input file contains key word 'Lenovo' I need to process the data for 'Lenovo' and run 4 to 5 steps for this input file and generate
different GDG's (Some of these are tape datasets as they are used to store huge volume of data)

Here are preview of various job steps -
Input File - XXXXX.COMPANY.DATA

Step1: Take backup of input file
Input File: XXXXX.COMPANY.DATA
Output file: XXXXX.COMPANY.DATA.LENOVO.BKUP(+1)

Step2:
Input File: XXXXX.COMPANY.DATA.LENOVO.BKUP(+1)
Output files:
XXXXX.COMPANY.DATA.LENOVO.GOOD.RECS(+1)
XXXXX.COMPANY.DATA.LENOVO.BAD.RECS(+1)
XXXXX.COMPANY.DATA.LENOVO.SUSPENSE.RECS(+1)

Step3:
Input File:XXXXX.COMPANY.DATA.LENOVO.BAD.RECS(+1)
Output File: XXXXX.COMPANY.DATA.LENOVO.ERROR.REPORT(+1)

Job goes on for several steps working with the data processed by previous steps...


So this way input file contains data for various companies like Dell, HP and so on and everytime I need to process the data for specific companies and generate
company specific GDG's...

Please correct me if I am wrong, your suggestion would work if it's a sequential DASD dataset but not sure if it's feasible for GDG Tape datasets...Appreciate your response...

#6:  Author: kolusuLocation: San Jose PostPosted: Mon Apr 17, 2017 4:21 pm
    —
lal wrote:
Hi Kolusu,
Thanks for the response and Sorry, if the question/reply was bit cryptic...

The reason I prefer single job is that I need to build a generic job to be used to work with different kinds of data and also if feasible schedule that
job in the scheduler with predecessor/successor jobs.


lal,

You mentioned that you have LENOVO in a dataset. So why not change the pgm that creates this dataset to create a PDS MEMBER instead of a dataset and it will have

Code:
// SET NAME=LENOVO


And you INCLUDE this member in your JCL. Then you will have just 1 job.

#7:  Author: lal PostPosted: Tue Apr 18, 2017 12:12 am
    —
Thanks a lot Kolusu for your suggestions...it sounds like we cannot create the PDS member with symbolic variable declaration/definition in the same job and use it. So the only way is to create PDS member in predecessor jobs...Thanks again...



MVSFORUMS.com -> Job Control Language(JCL)


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group