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

Spliced file not to contain dups, all dups to other file.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Thu Apr 16, 2009 11:18 pm
Reply with quote

I have a process that splices together 4 files keeping records that are not duplicated. Now I need the dups to fall into another file.

My splice is:
SPLICE FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) -
WITHEACH -
KEEPNODUPS -
WITH(91,361) -
WITH(452,300) -
WITH(752,62) -

Is there a way to do this in one step. Or do I need to splice the files together with all and then a copy with a DISCARD(DUPS). I need to discard all dups
Inputs:

12345678 data1
12345678 data2
12345678 data3
12345678 data4
23456789 data1
23456789 data1
23456789 data2
23456789 data3
23456789 data4
12345679 data1
12345679 data2
12345679 data3
12345679 data4

Sorted wanted output:
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4

Dup error file
23456789 data1 data2 data3 data4
23456789 data1 data2 data3 data4
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 16, 2009 11:27 pm
Reply with quote

speermb,

How do you classify the duplicates? Any key (1,8) which has more than 4 occurrances?

Also When you say 4 files , are you concatenating them all together? or did you use 4 copy passes them to a single dataset with DISP=MOD? Show me the JCL you used and may be we can suggest an alternative way of getting the results
Back to top
View user's profile Send private message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Fri Apr 17, 2009 12:09 am
Reply with quote

Duplicate would be any item where 1-8 is on any file more than 1X. Currently, it only appears on data1 file multiple times.

Code:

//STEP05C EXEC PGM=ICETOOL                                             
//SYSOUT   DD SYSOUT=*                                             
//SYSPRINT DD SYSOUT=*                                             
//SYSDUMP  DD SYSOUT=*                                           
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//SORTIN   DD DISP=SHR,                                               
//            DSN=data1 file         
//         DD DISP=SHR,       
//        DSN=data2 file           
//         DD DISP=SHR,                                               
//     DSN=data3 file           
//         DD DISP=SHR,                                               
//  DSN=data4 file
//SORTOUT  DD DISP=(NEW,CATLG,DELETE),                                 
//            UNIT=DISK,                                             
//            SPACE=(TRK,(20000,10000),RLSE),                         
//            DCB=(RECFM=FB,LRECL=813,BLKSIZE=0),                     
//            LABEL=RETPD=7,                                           
//           dSN=outfile1       
//TOOLIN   DD *
  SPLICE FROM(SORTIN)  TO(SORTOUT) ON(1,8,CH) -           
          WITHEACH                            -           
          KEEPNODUPS                          -           
          WITH(91,361)                        -           
          WITH(452,300)                       -           
          WITH(752,62)                        -           
  USING(FMT1)                                             
//           
//FMT1CNTL DD      *
  SORT FIELDS=(1,8,CH,A)                                           
  OUTFIL FNAMES=SORTOUT,                                           
         OMIT=(9,1,CH,EQ,C' ',OR,                                   
               91,1,CH,EQ,C' ',OR,                                 
              452,1,CH,EQ,C' '),                                   
         IFTHEN=(WHEN=(752,1,CH,EQ,C' '),                           
           OVERLAY=(752:C'N',757:C'000000',763:C'000000')),         
         IFTHEN=(WHEN=NONE,                                         
            BUILD=(1:1,813))
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Apr 17, 2009 1:31 am
Reply with quote

speermb,

ok do the dups occur together or they spread out in each file? for ex:

take file 1

Code:

ABC
ABC
EFG
DEF 


or do they occur as

Code:

ABC 
EFG
DEF   
ABC 


The keys need not be sorted but do they duplicates occur as pairs?
Back to top
View user's profile Send private message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Fri Apr 17, 2009 10:41 pm
Reply with quote

Yes the duplicates will be in sorted order & the duplicates could be right after one another.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Apr 18, 2009 1:06 am
Reply with quote

speermb,

The following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//SORTIN   DD DISP=SHR,DSN=data1 file
//         DD DISP=SHR,DSN=data2 file     
//         DD DISP=SHR,DSN=data3 file
//         DD DISP=SHR,DSN=data4 file
//SORTOUT  DD SYSOUT=*                                           
//ERROR    DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SPLICE FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) ON(814,8,CH) -       
  WITHEACH WITH(91,361) WITH(452,300) WITH(752,62)        -       
  KEEPNODUPS USING(FMT1)                                         
//FMT1CNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(814:SEQNUM,8,ZD,RESTART=(1,8)))
  OUTFIL FNAMES=SORTOUT,IFOUTLEN=813,                             
  INCLUDE=(814,8,ZD,EQ,1,AND,                                     
           009,1,CH,GT,C' ',AND,                                 
           091,1,CH,GT,C' ',AND,                                 
           452,1,CH,GT,C' '),                                     
  IFTHEN=(WHEN=(752,1,CH,EQ,C' '),                               
  OVERLAY=(752:C'N',757:C'000000',763:C'000000'))                 
  OUTFIL FNAMES=ERROR,BUILD=(1,813),INCLUDE=(814,8,ZD,GT,1)       
/*


Sortout will have (key 23456789 has a match on all four files but has an extra record from file1. So we club the 4 records from each of the file and push the extra record to the error file.)

Code:
     
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4
23456789 data1 data2 data3 data4


Dup error file
Code:

23456789 data1
Back to top
View user's profile Send private message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Mon Apr 20, 2009 6:01 pm
Reply with quote

I don't want infro from records that are duplicated keys in the SORTOUT:
I need this data on the duplicated file.

SORTOUT
12345678 data1 data2 data3 data4
12345679 data1 data2 data3 data4

DUPLICATED data either:

23456789 data1 data2 data3 data4
23456789 data1

or
23456789 data1 data2 data3 data4
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 FTP VB File from Mainframe retaining ... JCL & VSAM 3
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
Search our Forums:

Back to Top