MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Incrementing Symbolic Parameter

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Fri Apr 16, 2004 3:04 pm    Post subject: Incrementing Symbolic Parameter Reply with quote

Is there a way to increment the symbolic parameter in the JCL?
I would like to define a file as:
USERID.FILE&NUM..IN

I want to start with NUM = 01 and increment it by 1. So that 1st file will be USERID.FILE01.IN; 2nd file will be USERID.FILE02.IN etc.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Apr 16, 2004 3:18 pm    Post subject: Reply with quote

abhikush,


Why not define a unique symbolic for each dataset?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Fri Apr 16, 2004 3:41 pm    Post subject: Reply with quote

Kolusu,

Had it been only 2 files I would have done so. I have around 100 files. Coding for each of them is certainly an idea. But it would be tedious.

If I explain what I am trying to achieve maybe someone could come up with a better idea.

I have 100 files each containing 15 accounts (not all them should have data) and this is what I am planning:
1. With 1st file as input. Execute a JCL to unload accounts from DB2.
2. The last step of the JCL kicks of another JCL to load the accounts into another DB2 tables of another region.
3. After loading it check if 2nd file is empty. If it is not empty then kick off unload JCL (JCL in step 1). If the file is empty then end.

The above will happen until it finds and empty file or all the 100 files are procesed.

I cannot combine the 100 files into one file as the program supports only 15 accounts at a time.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Apr 16, 2004 8:02 pm    Post subject: Reply with quote

Well, you can certainly increment a variable however you wish. The question is - how are you going to code the logic to initialize the variable to 1, and then increment it by 1 for each job executed?

May I presume that you will be setting the value for &NUM somewhere at the beginning of the job, most likely with a SET statement:

//JOB01 MYJOB ()...
//*
// SET NUM=01
//*
//STEPX
//DDX DD DSN=USERID.FILE&NUM..IN,DISP=(,CATLG,DELETE),...

//JOB02 MYJOB ()...
//*
// SET NUM=02
//*
//STEPX
//DDX DD DSN=USERID.FILE&NUM..IN,DISP=(,CATLG,DELETE),...

Any reason why using a GDG would not work better in this scenario?
Back to top
View user's profile Send private message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Sat Apr 17, 2004 9:57 am    Post subject: Reply with quote

Well using set at the begining of the job will mean I have to write 100 Jobs for 100 different files.
I will be calling a job recursively. i.e

____________________________________________________
JOBAAA ...
...
SET NUM=1
...
Using internal driver submit JOBXXX
____________________________________________________

JOBXXX ...
....
STEP01
INFILE DD USERID.FILE&NUM..IN
....
STEP02
Increment NUM by 1
Using internal driver resubmit JOBXXX
____________________________________________________

I need to find out how to increment NUM by 1 so that I don't have to code for each of the 100 file.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Sat Apr 17, 2004 11:30 am    Post subject: Reply with quote

Well, obviously the only way that you can pass the value for NUM between jobs, and to be able to increment its value, it will have to be stored in an external dataset so it can be accessed by each subsequent job.

I would approach it this way (as an example):

Create a member in a PDS 'MY.PDS' called NUM. The content is the SET command, so that 'MY.PDS(NUM)' contains one record:

// SET NUM=01

Then, in your job, place an JCLLIB and INCLUDE statement at the top (below the //JOB card) to use this PDS:

// JCLLIB ORDER=MY.PDS
// INCLUDE MEMBER=NUM

Now, you can use the variable &NUM, which will have an initial value of 01. At the end of your job, you can then update 'MY.PDS(MEM)' and increment the value by 1. Now, the next job that runs will have &NUM set to 02, and so on.
Back to top
View user's profile Send private message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Sun Apr 18, 2004 12:10 pm    Post subject: Reply with quote

Thanks "superk".

Now the next question will be how do I increment the value in 'MY.PDS(NUM)' automatically.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Sun Apr 18, 2004 6:40 pm    Post subject: Reply with quote

What is your preference of either a language or utility? It's a rather simplistic program:

read the record
find value for counter
add 1 to the value for the counter
write the updated record
Back to top
View user's profile Send private message
Mike Chantrey
Intermediate


Joined: 10 Sep 2003
Posts: 234
Topics: 1
Location: Wansford

PostPosted: Mon Apr 19, 2004 7:52 am    Post subject: Reply with quote

If you have DFSORT and are up to date on the maintenance, I'm sure DFSORT's arithmetic capabilities can handle this easily (the ADD operator with a 2-digit mask looks like what you want).

Suggested DFSORT control card:
Code:

 OPTION COPY                                         
 OUTREC FIELDS=(1,11,12,2,ZD,ADD,+1,M11,LENGTH=2)   

With SORTIN and SORTOUT both pointing to your 'SET' control member initally containing
Code:

// SET NUM=00


I can't test this since we don't have the necessary DFSORT maintence (but we will very soon...). So apologies if it's wrong.
If you don't have the necessary maintenance on DFSORT you'll get a syntax error pointing at the 'ADD'.
If think there's other ways of doing this with DFSORT not using ADD but I can't remember the details.

For full details of DFSORT's arithmetic abilities please see http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmurfm.html#exp

I'm not
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Mon Apr 19, 2004 9:03 am    Post subject: Reply with quote

Mike, your SORT code works just fine.
Back to top
View user's profile Send private message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Mon Apr 19, 2004 2:58 pm    Post subject: Reply with quote

Thanks Mike. It works.
SuperK thanks for the idea.
Back to top
View user's profile Send private message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Fri Apr 23, 2004 9:06 pm    Post subject: Reply with quote

SUPERK what I am doing wrong

I defined the following three statements right after the job card (//JOB):
// SET NUM=001
//PRC JCLLIB ORDER=MY.PDS
// INCLUDE MEMBER=NUM

NUM has the following value 001.

When I check the JCL for syntax I get the following error:
001
CAY6315E STATEMENT NOT ALLOWED IN AN INCLUDE GROUP
CAY6006S VERB "1 " IS UNKNOWN

Is there anything I am missing here Question
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Mon Apr 26, 2004 9:33 am    Post subject: Reply with quote

Hmmmm. Hard to say. I cut and pasted your code into a job here and it ran fine:

//SUPERK JOB (....),CLASS=X,MSGCLASS=X
//*
//PRC JCLLIB ORDER=SUPERK.CNTL
// INCLUDE MEMBER=NUM
//*
//STEP0001 EXEC PGM=IEFBR14
//DD1 DD DSN=&SYSUID..TEST.N&NUM,
// DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(0,0),RLSE)
//*

Contents of 'SUPERK.CNTL(NUM)':

// SET NUM=001

A couple of things:

It is redundant to have the SET command, when the contents of the member MEM in MY.PDS should already be initialized to be that command.
Back to top
View user's profile Send private message
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Tue Apr 27, 2004 5:48 pm    Post subject: Reply with quote

I think that you'll find that the problem is that CA-JCLCHECK is converting the // INCLUDE MEMBER=NUM to // INCLUDE MEMBER=001 and therefore it issues the message as obviously a member normally cannot be named as such. Perhaps there is a bug with CA-JCLCHECK, perhaps NUM is a special symbol in CA-JCLCHECK (you could eliminate this possibility by changing NUM to something that would not be a special symbol).
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
abhikush
Beginner


Joined: 26 Dec 2002
Posts: 12
Topics: 3

PostPosted: Wed Apr 28, 2004 8:37 pm    Post subject: Reply with quote

Thanks a ton "SUPERK". It is working for me too. I guess it was just one of those days.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group