Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
aniceg
Warnings : 1

New User


Joined: 04 Apr 2008
Posts: 8
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
References
Moved: Fri Jul 11, 2008 8:07 am by superk From JCL to DFSORT/ICETOOL
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 4684
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1