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
 
Merged file to remove duplicate so order is not affected

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
subarna roy

New User


Joined: 07 Dec 2007
Posts: 16
Location: mumbai

PostPosted: Fri Feb 08, 2008 12:44 pm    Post subject: Merged file to remove duplicate so order is not affected
Reply with quote

Hi
I need to merge two file and I need to remove the duplicates based upon some specific field ( eg class number), but whenever i am doing so, the out put file is getting sorted in the order of the sort field.
But business need is the files should be merged , and the records in the merged file should be in order as they were in the individual file. And also the merged file shud not contain any duplicate records with same class number( the field name i had mentioned above) only.

Please help me.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 08, 2008 3:10 pm    Post subject:
Reply with quote

subarna roy

Is your req like this?
FILE-1
Code:

A1
A1
C3
V4


FILE-2
Code:

A2
C4
V5



The o/p should be
Expected O/p
Code:

A1
C3
V4
A2
C4
V5
Back to top
View user's profile Send private message
subarna roy

New User


Joined: 07 Dec 2007
Posts: 16
Location: mumbai

PostPosted: Fri Feb 08, 2008 3:26 pm    Post subject:
Reply with quote

hi krisprems,

you are right.


Thanks
Subarna
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Fri Feb 08, 2008 5:08 pm    Post subject:
Reply with quote

Hi subarna roy,

Let us assume files are with RECFM=F or RECFM=FB and LRECL=80.
Let us assume the class number field starts in position 7 and length 7.
Please check with the following code for your requirement.
Suppose if the class number is in both file1 and file2, the following code will keep only one class number from file1 in output.
Code:
// EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//FILE1 DD DSN=FILE1,DISP=SHR
//FILE2 DD DSN=FILE2,DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,CATLG)
//T2 DD DSN=&&T1,DISP=(,CATLG)
//OUT DD SYSOUT=*
//TOOLIN DD *
 COPY FROM(FILE1) TO(T1) USING(CTL1)
 COPY FROM(FILE2) TO(T1) USING(CTL2)
 SELECT FROM(T1) TO(T2) ON(7,7,CH) FIRST
 SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
 INREC OVERLAY=(81:C'1',SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
 INREC OVERLAY=(81:C'2',SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
 SORT FIELDS=(81,9,CH,A)
 OUTFIL OUTREC=(1,80)
/*
//

Thanks,
Shankar
Back to top
View user's profile Send private message
subarna roy

New User


Joined: 07 Dec 2007
Posts: 16
Location: mumbai

PostPosted: Fri Feb 08, 2008 5:59 pm    Post subject:
Reply with quote

Hi Shankar

Will this code be appropriate if i need to merge 11 files and then want to remove the duplicates on the basis of a particuler field?

Regards
Subarna
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 193
Location: india

PostPosted: Sun Feb 10, 2008 2:36 pm    Post subject:
Reply with quote

Well i dont think that there will be any problem, you can merge as many files you want to merge by using the JCL posed by shankar.v.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Feb 11, 2008 11:11 am    Post subject:
Reply with quote

Hi subarna roy,

Let us assume files are with RECFM=F or RECFM=FB and LRECL=80.
Let us assume the class number field starts in position 7 and length 7.
Please check with the following code for your requirement.
Suppose if the class number is in both file1 and file2, the following code will keep only one class number from file1 in output.
Code:
// EXEC PGM=ICETOOL                                       
//DFSMSG DD SYSOUT=*                                       
//TOOLMSG DD SYSOUT=*                                     
//FILES DD DSN=FILE1,DISP=SHR                                               
//      DD DSN=FILE2,DISP=SHR
//      DD DSN=FILE3,DISP=SHR
//      .
//      .
//      .
//      DD DSN=FILEn,DISP=SHR                                             
//T1 DD DSN=&&T1,DISP=(,DELETE)                           
//OUT DD SYSOUT=*                                         
//TOOLIN DD *                                             
 SELECT FROM(FILES) TO(T1) ON(7,7,CH) FIRST USING(CTL1)   
 SORT FROM(T1) TO(OUT) USING(CTL2)                         
/*                                                                                                       
//CTL1CNTL DD *                                           
 INREC OVERLAY=(81:SEQNUM,9,ZD)                           
/*                                                         
//CTL2CNTL DD *                                           
 SORT FIELDS=(81,9,CH,A)                                   
 OUTFIL OUTREC=(1,80)                                     
/*
//

Thanks,
Shankar
Back to top
View user's profile Send private message
subarna roy

New User


Joined: 07 Dec 2007
Posts: 16
Location: mumbai

PostPosted: Mon Feb 11, 2008 2:32 pm    Post subject:
Reply with quote

Hi
Thanks...it worked.



Regards
Subarna
Back to top
View user's profile Send private message
subarna roy

New User


Joined: 07 Dec 2007
Posts: 16
Location: mumbai

PostPosted: Tue Feb 12, 2008 11:58 am    Post subject:
Reply with quote

Hi

The above code mentioned by Shankar was working fine, but as per business need we can't use ICETOOL, they r suggesting to use SYNC SORT. Can u pls tell me how I can do it with SYNC SORT or something else ( other than ICE TOOL)
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue Feb 12, 2008 10:33 pm    Post subject:
Reply with quote

The ICETOOL application should work with SyncSort as well. However, if for some reason, you are prevented from coding PGM=ICETOOL in your shop, try PGM=SYNCTOOL.

As an alternative, you can convert the ICETOOL application to a SORT job:
Code:

//SORT1 EXEC PGM=SORT                             
//SORTIN  DD DSN=FILE1,DISP=SHR
//        DD DSN=FILE2,DISP=SHR
//         .
//         .
//        DD DSN=FILEn,DISP=SHR
//SYSOUT  DD SYSOUT=*                                 
//SORTOUT DD DSN=&&SRT1,DISP=(NEW,PASS)             
//SYSIN   DD *                                       
    INREC OVERLAY=(81:SEQNUM,9,ZD)                   
    SORT FIELDS=(7,7,CH,A),EQUALS                     
    SUM FIELDS=NONE                                   
//**************************************************   
//SORT2 EXEC PGM=SORT                             
//SORTIN  DD DSN=&&SRT1,DISP=(OLD,PASS)               
//SYSOUT  DD SYSOUT=*                                 
//SORTOUT DD DSN=FINAL.OUTPUT,DISP=(NEW,CATLG)
//SYSIN   DD *                                         
    SORT FIELDS=(81,9,CH,A)                           
    OUTREC FIELDS=(1,80) 
/*

Please note that both ICETOOL and the SORT application are passing the data twice.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm

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