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

Use the same file name in STEP for copying records from File


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

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 1:35 pm
Reply with quote

Please find my requirement as follows:
1. A file name(File01) will be written to a Dataset(PS file FileA) in STEP01 of the job. This File name has a sequence number (as a part of its qualifier) which is generated dynamically.
2. In STEP02 of the job we need to copy the records from a different file say File02 to File01.

a. How to read the file name from the PS file FileA (which is created in STEP01)
b.How to use the same file name in STEP02 for copying records from File02?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue May 26, 2009 2:04 pm
Reply with quote

It's quite unclear what you are asking.

Quote:
This File name has a sequence number (as a part of its qualifier) which is generated dynamically.
By "file name" are you referring to the contents of "PS file FileA" or to . . . icon_confused.gif
Quote:
How to read the file name from the PS file FileA using a jcl
As have been stated many times earlier-- JCL itself will do nothing, you need to direct some program or utility to do that.
Quote:
How to use the same file name in STEP02 for copying records from File02?
Just provide the correct DSN in step02... icon_confused.gif
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 26, 2009 2:07 pm
Reply with quote

How is the dataset created in STEP01, dynamically by the program or via the JCL statements
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 2:22 pm
Reply with quote

Explanation of the requirement:

1. Content of a dataset F0123QGH.TSBXXXX.DSN01(MEM01) is
F0123QGH.TSBXXXX.SEQ001 (in STEP01). When the job runs next time the "SEQ001" would be changed to "SEQ002" and so on.
2. In STEP02, we need to copy the records from an Input file F0123QGH.TSBXXXX.FILEA to the F0123QGH.TSBXXXX.SEQ001.

Here my question is, how to get the sequence file name (in STEP01) and use it in STEP02?

Please let me know if I'm still unclear.
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 2:56 pm
Reply with quote

There is a program which updates the File F0123QGH.TSBXXXX.DSN01(MEM01) with the sequence file name F0123QGH.TSBXXXX.SEQ00*.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 26, 2009 3:18 pm
Reply with quote

As previously requested, how is the dataset created in STEP01

Is it via JCL statements or dynamically by the program.
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 3:19 pm
Reply with quote

There is a program which updates the File F0123QGH.TSBXXXX.DSN01(MEM01) with the sequence file name F0123QGH.TSBXXXX.SEQ00*.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 26, 2009 3:48 pm
Reply with quote

itjagadesh wrote:
There is a program which updates the File F0123QGH.TSBXXXX.DSN01(MEM01) with the sequence file name F0123QGH.TSBXXXX.SEQ00*.

Yes, I did happen to understand that icon_rolleyes.gif

Now, you say that STEP01 creates the dataset which is given in the PDS member. Please explain to me in great detail what happens. Does the program executed in STEP01 read the PDS member and dynamically create the dataset named in the PDS, or does the dataset mentioned in the PDS appear in a JCL DD statement to create the dataset.

The best solution would be that the PDS member is created as
Code:
// SET     DSNAME=dataset.name

and then it could be included into the JCL - see example below
Code:

//         JCLLIB ORDER=(PDS name)
//*
//DSNAME   INCLUDE MEMBER=Member name
//*
//STEP01   EXEC PGM=whatever
//DDNAME   DD DSN=&DSNAME,DISP=....
//*
//STEP02   EXEC PGM=whatever
//DDNAME   DD DSN=&DSNAME,DISP=....
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 4:02 pm
Reply with quote

Hi,

Please see in the below step the SEQP is the DDname of the Sequence file to the PGM01
//STEP01 EXEC PGM=PGM01
//SEQP DD DSN=F012QGH.MOSDAILY.SEQUENCE,DISP=SHR,
// AMP='BUFND=30,BUFNI=15'
//SYSPRINT DD SYSOUT=A
//SYSOUT DD SYSOUT=A
//SYSUDUMP DD SYSOUT=A

The Sequence file F012QGH.MOSDAILY.SEQUENCE will have a file name in turn, which we should read and use it in the next step to copy the records from the file say, File01 of STEP02 to the file name say File02 in F012QGH.MOSDAILY.SEQUENCE.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 26, 2009 4:56 pm
Reply with quote

Just a suggestion, but, why not use a GDG and have done with all of this farting about.
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 26, 2009 5:36 pm
Reply with quote

Actually as per our current requirement we just need to include the repro step alone. So I don't know how to go about it.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue May 26, 2009 7:26 pm
Reply with quote

The REPRO JCL is pretty simple using a GDG as output
Code:

//STEPnnnn EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//OUTFILE  DD DSN=GDG.base.name(+1),DISP=.......
//SYSIN    DD *
 REPRO IDS(input dataset name) OFILE(OUTFILE)
/*
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 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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