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

Need to copy one record from each file into new file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Tue Jun 23, 2009 4:00 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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