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
 

 

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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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