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 copy one record from each file into new file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vkumard

New User


Joined: 13 Dec 2005
Posts: 9

PostPosted: Tue Jun 23, 2009 2:21 am    Post subject: Need to copy one record from each file into new file
Reply with quote

I have 3 files with 100 records. I want to write into a file with every alternative line from the input files:

1st record - 1 st record from 1st input file
2nd record - 1 st record from 2nd input file
3rd record - 1 st record from 3rd input file
4th record - 2nd record from 1st i/p file
5th record - 2nd record from 2nd i/p file
and so on..
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 23, 2009 3:55 am    Post subject: Reply to: Need to copy one record from each file into new fi
Reply with quote

vkumard,

Is there anything in the files that can identify the record as to which file it belongs?

What is the LRECL/RECFM of input and output files?

Kolusu
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jun 23, 2009 4:00 am    Post subject:
Reply with quote

vkumard,

Here's one way to do it with DFSORT/ICETOOL. I assumed your input files have RECFM=FB and LRECL=80, and there's nothing in the files that can identify the record to which each file belongs.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//IN3 DD DSN=...  input file3 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T2) USING(CTL1)
COPY FROM(IN3) TO(T3) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,3,ZD)
/*
//S2 EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTDIAG DD DUMMY
//SYSUDUMP  DD  SYSOUT=*
//SORTIN01 DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN02 DD DSN=&&T2,DISP=(OLD,PASS)
//SORTIN03 DD DSN=&&T3,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
 OPTION EQUALS
 MERGE FIELDS=(81,3,CH,A)
 OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
vkumard

New User


Joined: 13 Dec 2005
Posts: 9

PostPosted: Tue Jun 23, 2009 6:19 am    Post subject: Thanks a lot frank
Reply with quote

It worked fine.
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 -> DFSORT/ICETOOL 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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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