View previous topic :: View next topic
|
Author |
Message |
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
Hi,
I have a file name created in a step.. Say the file name is ABC.DEF. The content of the file may have another file name or filenames listed in each line as a record....
let the contents of the file ABC.DEF be
XYZ.AAA
I need make use of the file name XYZ.AAA in the next step..
Please let me know is there any utility to perform this.. or any other way of doing this through SORT utility... |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
srinath.r,
Quote: |
I need make use of the file name XYZ.AAA in the next step |
What is your next step doing?
Are all the filenames of the same length, if you have multiple filenames?
Thanks,
Arun |
|
Back to top |
|
|
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
Yes, All the files are of same record length...
I will be using these files in the sort step to merge into a single file and use it for further processing.. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
You will need to use a dynamic file allocation routine if the files contained in dataset 1 are to be used within the same job.
One the JCl has been interpretted by JES the JCL is then unchangeable, so you can not then use those files from within the same JCL unless the allocation is dynamic. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Are you merging the files based on some key or you just need to concatenate all the files? Can you post here the sort card you use in step2.
Thanks,
Arun |
|
Back to top |
|
|
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
The Sortcard used in the next step is
MERGE FIELDS=(1,25,A),FORMAT=BI
Thanks
Srinath R |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi Srinath,
Can you try this. It reads your input file and creates the subsequent merge job .
Code: |
//STEP00 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your.input.file...........
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('//XXXXXXXX JOB (XXXX),''SORT JOB'',CLASS=C,MSGCLASS=X,',/,
'// NOTIFY=&SYSUID,REGION=4096K',/,
'//STEP00 EXEC PGM=SORT',/,
'//SYSOUT DD SYSOUT=*',/,
'//SORTOUT DD SYSOUT=*',/,
'//SYSIN DD *',/,
' MERGE FIELDS=(1,16,A),FORMAT=BI'),
BUILD=(C'//SORTIN',SEQNUM,2,ZD,C' DD DISP=SHR,DSN=',1,44,80:X)
//* |
SYSOUT will have the merge jcl. You can change
to
after verfying the generated jcl.
Thanks,
Arun |
|
Back to top |
|
|
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
Thanks Arun!!!
The above piece of code is working...
This is what i was looking for...
Thanks
Srinath R |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Srinath,
You're welcome.
Thanks,
Arun |
|
Back to top |
|
|
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
Hi Arun,
Just a Curious to know what the "BUILD" option is used for in the Sortcard given by you...
Also let me know the usage of REMOVECC ...
Thanks
Srinath R |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Srinath,
From the manuals
BUILD:
Quote: |
You can reformat records in one of the following three ways: v BUILD: Reformat each record by specifying all of its items one by one. Build gives you complete control over the items you want in your reformatted records and the order in which they appear. You can delete, rearrange and insert fields and constants. |
REMOVECC:
Quote: |
If you do not want the ANSI carriage control characters in your report, you can add OUTFIL’s REMOVECC parameter to your OUTFIL statement. REMOVECC tells DFSORT to remove the carriage control character from the first byte of each record. As a result, the data starts in column 1 of the report rather than in column 2. |
Code: |
BUILD=(C'//SORTIN',SEQNUM,2,ZD,C' DD DISP=SHR,DSN=',1,44,80:X) |
This BUILDS a record.
First it writes //SORTIN, followed by the seqnum of 2 bytes (this would make the DD name look like SORTIN01,SORTIN02 etc)
then writes DD DISP=SHR,DSN= and
then the data from colums 1 to 44 from the input and
then padding spaces till column no 80. |
|
Back to top |
|
|
srinath.r
New User
Joined: 07 Nov 2006 Posts: 6 Location: Banglore
|
|
|
|
Thanks Aaru!!!
Is the sequence number of 2 bytes incremented automatically for each record...
Thanks
Srinath R |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Srinath,
Quote: |
Is the sequence number of 2 bytes incremented automatically for each record |
Yes. By default it gets incremented by 1 unless you provide some specific value.
Thanks,
Arun |
|
Back to top |
|
|
|