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
 

 

Merging two files and removing duplicates from one file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
SharathG

New User


Joined: 23 Jan 2007
Posts: 12
Location: India

PostPosted: Tue Jan 23, 2007 12:33 pm    Post subject: Merging two files and removing duplicates from one file
Reply with quote

Hi All,

I have 2 files as follows. Each of them have LRECL of 80.

File-1: -
1111111111AA
1111111111BB
1111111111CC
2222222222AA
2222222222BB
3333333333AA
3333333333BB
4444444444AA
4444444444BB
5555555555AA
5555555555BB

File-2: -

1111111111ABC
1111111111DEF
2222222222ABC
2222222222DEF
3333333333ABC
3333333333DEF

I would like to merge these 2 files and remove duplicates from file-1 which have the same characters in 1-10. So, my output file should be: -

Output File: -
1111111111ABC
1111111111DEF
2222222222ABC
2222222222DEF
3333333333ABC
3333333333DEF
4444444444AA
4444444444BB
5555555555AA
5555555555BB

These 2 files basically contain data unloaded from Tables in a DB2 database using DSNUPROC from 2 different development regions. I have to merge these 2 files, remove duplicates from file-1 and load the file back to Region-1 table. There are many child tables which are dependent on this table and the same should be done for those tables also.

I tried and succeeded in creating a Dynamic Sort card which will take all records from File-1 which do not have same characters in 1-10 of file-2 and then merge it with file-2 giving me the desired output. But the file size might increase to more than 10,000 records and the Dynamic Sort card cannot handle that many If then else conditions. I am not sure but i think the limit is 1630.

Any inputs are welcome. Please reply to this if want any more details.
Back to top
View user's profile Send private message

manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Tue Jan 23, 2007 5:48 pm    Post subject:
Reply with quote

Use the code below

//*******************************************************
//Step1 EXEC PGM=SORT
//*******************************************************
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT FILE 1,DISP=SHR
// DD DSN=INPUT FILE 2,DISP=SHR
//SORTOUT DD DSN=OUTPUT FILE,DISP=SHR
//SYSIN DD *
SORT FIELDS=(01,12,CH,A)
SUM FIELDS = NONE
/*


Regards,
Manikandan.
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 Jan 23, 2007 10:06 pm    Post subject:
Reply with quote

Manikandan,

You "solution" does not even come close to doing what Sharath requested. In the future, please test your "solutions" before you post them.
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 Jan 23, 2007 10:09 pm    Post subject:
Reply with quote

Sharath,

Here's a DFSORT/ICETOOL job that will do what you asked for:

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)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.IN2,VOL=REF=*.IN2,DISP=(OLD,PASS)
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
SELECT FROM(IN2) TO(T1) ON(1,10,CH) FIRST USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(1,10,CH) -
  KEEPBASE KEEPNODUPS WITHALL WITH(1,81) USING(CTL3)
SORT FROM(CON) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,INCLUDE=(81,2,CH,EQ,C'VV'),
    BUILD=(1,80)
/*
//CTL4CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,10,CH,A)
/*
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 Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
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 Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm


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