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

Merging two files and removing duplicates from one file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Tue Jan 23, 2007 10:06 pm
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 Developer


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

PostPosted: Tue Jan 23, 2007 10:09 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top