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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Need to read the contents of a file name inside another file
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: 2276
Location: @my desk

PostPosted: Fri Aug 22, 2008 12:29 pm    Post subject:
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    Post subject: Reply to: Need to read the contents of a file name inside an
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: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 22, 2008 12:40 pm    Post subject:
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: 2276
Location: @my desk

PostPosted: Fri Aug 22, 2008 12:41 pm    Post subject:
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    Post subject: Reply to: Need to read the contents of a file name inside an
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: 2276
Location: @my desk

PostPosted: Fri Aug 22, 2008 3:09 pm    Post subject:
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    Post subject:
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: 2276
Location: @my desk

PostPosted: Mon Aug 25, 2008 10:38 pm    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:27 pm    Post subject: Reply to: Need to read the contents of a file name inside an
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    Post subject:
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: 2276
Location: @my desk

PostPosted: Tue Aug 26, 2008 12:48 pm    Post subject:
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   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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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