Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy contents to an output file whose DSN name is dynamic

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Copy contents to an output file whose DSN name is dynamic
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 20, 2009 3:03 pm    Post subject:
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: 2171
Location: @my desk

PostPosted: Fri Feb 20, 2009 3:04 pm    Post subject:
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 20, 2009 3:44 pm    Post subject:
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 20, 2009 3:55 pm    Post subject:
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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

Moderator Team Head


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

PostPosted: Fri Feb 20, 2009 4:52 pm    Post subject: Reply to: Copy contents to an output file whose DSN name is
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 20, 2009 4:59 pm    Post subject:
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    Post subject: Reply to: Copy contents to an output file whose DSN name is
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: 2171
Location: @my desk

PostPosted: Fri Feb 20, 2009 5:38 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 20, 2009 5:42 pm    Post subject:
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: 2171
Location: @my desk

PostPosted: Fri Feb 20, 2009 5:54 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us