Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Combine two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Combine two files
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 Moderator


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

PostPosted: Fri Jul 11, 2008 8:51 pm    Post subject:
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    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 Comparing two sequential files Mohan Kothakota COBOL Programming 14 Mon Apr 16, 2018 6:35 pm
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts How to build one file from two input ... daniele DFSORT/ICETOOL 5 Tue Feb 27, 2018 6:45 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 14 Fri Dec 01, 2017 10:29 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us