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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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