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

Need to read the contents of a file name inside another file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
srinath.r

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Fri Aug 22, 2008 12:23 pm
Reply with quote

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

Moderator


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

PostPosted: Fri Aug 22, 2008 12:29 pm
Reply with quote

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

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Fri Aug 22, 2008 12:33 pm
Reply with quote

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

Global Moderator


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

PostPosted: Fri Aug 22, 2008 12:40 pm
Reply with quote

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

Moderator


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

PostPosted: Fri Aug 22, 2008 12:41 pm
Reply with quote

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

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Fri Aug 22, 2008 12:51 pm
Reply with quote

The Sortcard used in the next step is

MERGE FIELDS=(1,25,A),FORMAT=BI


Thanks
Srinath R
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Aug 22, 2008 3:09 pm
Reply with quote

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

Code:
SYSOUT=*   
to
Code:
SYSOUT=(*,INTRDR)   

after verfying the generated jcl.

Thanks,
Arun
Back to top
View user's profile Send private message
srinath.r

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Mon Aug 25, 2008 4:40 pm
Reply with quote

Thanks Arun!!!

The above piece of code is working...
This is what i was looking for...

Thanks
Srinath R
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Aug 25, 2008 10:38 pm
Reply with quote

Srinath,

You're welcome.

Thanks,
Arun
Back to top
View user's profile Send private message
srinath.r

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Tue Aug 26, 2008 12:19 pm
Reply with quote

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

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:27 pm
Reply with quote

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

New User


Joined: 07 Nov 2006
Posts: 6
Location: Banglore

PostPosted: Tue Aug 26, 2008 12:43 pm
Reply with quote

Thanks Aaru!!!

Is the sequence number of 2 bytes incremented automatically for each record...

Thanks
Srinath R
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 26, 2008 12:48 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. 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 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
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top