View previous topic :: View next topic
|
Author |
Message |
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
I need to copy an input file to an output file. The output filename is dynamic and will be decided only during runtime. Is there any possible way using SORT ??
EX:
Jobstep1 – This step executes a pgm which increments a sequence number. Say the incremented Sequence number from the program is 123
Jobstep2 – I need to copy a file say “ABCD.INPUT.FILE” to
an output file named “ABCD.ABXXX.FILE “ where XXX stand for the incremented number 123 (From jobstep1)
The incremented Seq # is arrived upon during run time only.
Regards,
Karthi. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Not in the same job, as all symbolics are resolved at JCL interpretation.
Maybe this is a good case for using a GDG |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
DKartiya,
Name the output dataset in the copy job as ABCD.AB&NUM..FILE
Write a SET statement for the above symbolic thru your program.
Make the copy job as the successor to the job in which program is executed. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Hi Arun,
I'll check back on this and get back. Thanks for ur reponse.
Regards,
DKartiya |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Arun,
My idea of SET statement that it is used for incrementing / decrementing
an occurence number or for moving data to conditional names.
I still tried to find on this and couldnt arrive on anything.
Can you please let me know how the SET needs to be given.
(This will be passed as linkage right. Will it be a problem if i already
have an input variable passed in the linkage.)
Thanks !!
Regards,
Deeba. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Why not use a GDG which increments the generation number automatically. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
These jobs are in the critical path, which needs to run in parallel.
Can't have a GDG!! |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
If the same jobs run every cycle, why not just use unique dataset names that do not change.
I still can not see why a GDG will not work, unless you want to use the same GDG base in every job, which sounds a little screwy to me. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
When we use the same GDG in 2 jobs, then one of the job will go on hold.
I need to have the jobs run in parallel.
Arun,
Looks like we cannot pass values from COBOL to JCL. The only thing
that we can pass is the RETURN CODE register value. Thanks.
Regards,
DKartiya |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Karthi, can't you just do this:
- copy ABCD.INPUT.FILE to another static dataset name, such as
ABCD.INPUT.FILE.COPY.
- then rename the dataset ABCD.INPUT.FILE.COPY to ABCD.ABXXX.FILE based on the value for XXX as passed by the first jobstep. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
SuperK,
copy ABCD.INPUT.FILE to another static dataset name, such as
ABCD.INPUT.FILE.COPY. ==>Yes i can do this
- then rename the dataset ABCD.INPUT.FILE.COPY to ABCD.ABXXX.FILE based on the value for XXX as passed by the first jobstep.
==> I am not sure how we can receive the value XXX from the first job step. If only I can receive, i can do it in the send step iteslf.
I check through the COBOL forum and only came to a conclusion that we
cannot pass values/data from COBOL to JCL.
Let me know if my understanding is right. Thanks !!
Regards,
Karthi. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Correct, you can not pass values to JCL once the JCL has been interpreted by JES.
Another suggestion, each job writes to a static dataset, and a sucessor job then copies the static dataset to the GDG - even with contention, it should not be for more than a couple of minutes. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Yeap .. Cannot have this done through JCL ... Got to go with other options.
Expat / Arun and Superk - Thanks a lot for ur inputs and patience :-)
Thanks,
Karthi. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
DKartiya,
Cant you write the value of 'XXX' to a dataset as
and include the same in your subsequent job where NUM is a part of your dataset name? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
But not in the same job, which the OP has indicated should happen. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
OP has indicated should happen |
Yes, I noticed that in his first post. But I am not sure if he's fine to go with 2 jobs now.
Quote: |
My idea of SET statement that it is used for incrementing / decrementing
an occurence number or for moving data to conditional names.
I still tried to find on this and couldnt arrive on anything.
Can you please let me know how the SET needs to be given. |
The SET you which talks about is a COBOL keyword. Dont confuse it with the JCL SET statement which is used to assign/initialize symbolic parameters. Check out the JCL Reference manual if you are not familiar with this. |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
Just an “out of the box” thought: Your program could do a dynamic allocation of the output dataset then copy the file or call a utility (like sort) to copy the file. |
|
Back to top |
|
|
|