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

Combine two files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aniceg
Warnings : 1

New User


Joined: 04 Apr 2008
Posts: 10
Location: chennai

PostPosted: Fri Jul 11, 2008 7:50 am
Reply with quote

I have a file with the following fields. The record length is 50
Name(10) address(10) Rollno(10) seqno(10) age(10)
Ash Mumbai 89 78 18
Priya Chennai 56 58 23
Gayathri Madurai 29 69 19
Sathya Madurai 88 59 21

There is another file with the following fields. The record length is 40
Name(10) address(10) Rollno(10) age(10)
Ash Mumbai 89 18
Priya Chennai 56 23
Gayathri Madurai 29 19

based on the comparison of these two files the third file should be created which contains those records for which the roll no matches and the third file should contain seq no included at the end of the file .Record length of third file is 50
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: Fri Jul 11, 2008 8:51 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed the output could be sorted by the rollno. If you want the output sorted in some other way (e.g in the original order of the file1 or file2 records), let me know.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/50)
//IN2 DD DSN=...  input file2 (FB/40)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5,)),DISP=(MOD,PASS)
//OUT  DD DSN=...  output file (FB/50)
//TOOLIN   DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(21,10,CH) -
  WITHALL WITH(1,51) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(51:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(51:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(51,2,CH,EQ,C'VB'),
    BUILD=(1,30,31:41,10,41:31,10)
/*
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top