View previous topic :: View next topic |
Author |
Message |
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Fri Apr 16, 2004 3:04 pm Post subject: Incrementing Symbolic Parameter |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Apr 16, 2004 3:18 pm Post subject: |
|
|
abhikush,
Why not define a unique symbolic for each dataset?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Fri Apr 16, 2004 3:41 pm Post subject: |
|
|
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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Apr 16, 2004 8:02 pm Post subject: |
|
|
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 |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Sat Apr 17, 2004 9:57 am Post subject: |
|
|
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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Sat Apr 17, 2004 11:30 am Post subject: |
|
|
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 |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Sun Apr 18, 2004 12:10 pm Post subject: |
|
|
Thanks "superk".
Now the next question will be how do I increment the value in 'MY.PDS(NUM)' automatically. |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Sun Apr 18, 2004 6:40 pm Post subject: |
|
|
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 |
|
|
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Mon Apr 19, 2004 7:52 am Post subject: |
|
|
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
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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Mon Apr 19, 2004 9:03 am Post subject: |
|
|
Mike, your SORT code works just fine. |
|
Back to top |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Mon Apr 19, 2004 2:58 pm Post subject: |
|
|
Thanks Mike. It works.
SuperK thanks for the idea. |
|
Back to top |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Fri Apr 23, 2004 9:06 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Mon Apr 26, 2004 9:33 am Post subject: |
|
|
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 |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Tue Apr 27, 2004 5:48 pm Post subject: |
|
|
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 |
|
|
abhikush Beginner
Joined: 26 Dec 2002 Posts: 12 Topics: 3
|
Posted: Wed Apr 28, 2004 8:37 pm Post subject: |
|
|
Thanks a ton "SUPERK". It is working for me too. I guess it was just one of those days. |
|
Back to top |
|
|
|
|