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

Copy contents to an output file whose DSN name is dynamic


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

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 2:28 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 20, 2009 3:03 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 20, 2009 3:04 pm
Reply with quote

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
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 3:09 pm
Reply with quote

Hi Arun,

I'll check back on this and get back. Thanks for ur reponse.

Regards,
DKartiya
Back to top
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 3:41 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 20, 2009 3:44 pm
Reply with quote

Why not use a GDG which increments the generation number automatically.
Back to top
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 3:46 pm
Reply with quote

These jobs are in the critical path, which needs to run in parallel.
Can't have a GDG!!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 20, 2009 3:55 pm
Reply with quote

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
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 4:50 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Feb 20, 2009 4:52 pm
Reply with quote

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
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 4:56 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 20, 2009 4:59 pm
Reply with quote

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
View user's profile Send private message
DKartiya

New User


Joined: 30 Jan 2008
Posts: 26
Location: Chennai

PostPosted: Fri Feb 20, 2009 5:04 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 20, 2009 5:38 pm
Reply with quote

DKartiya,

Cant you write the value of 'XXX' to a dataset as
Code:
//SET NUM=XXX

and include the same in your subsequent job where NUM is a part of your dataset name?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 20, 2009 5:42 pm
Reply with quote

But not in the same job, which the OP has indicated should happen.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 20, 2009 5:54 pm
Reply with quote

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. icon_biggrin.gif

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
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Feb 20, 2009 8:54 pm
Reply with quote

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
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top