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
 

 

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

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

New User


Joined: 27 Aug 2008
Posts: 14
Location: USA

PostPosted: Thu Apr 16, 2009 11:18 pm    Post subject: Spliced file not to contain dups, all dups to other file.
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    Post subject: Reply to: Spliced file not to contain dups, all dups to othe
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: 14
Location: USA

PostPosted: Fri Apr 17, 2009 12:09 am    Post subject:
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    Post subject:
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: 14
Location: USA

PostPosted: Fri Apr 17, 2009 10:41 pm    Post subject:
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    Post subject: Reply to: Spliced file not to contain dups, all dups to othe
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: 14
Location: USA

PostPosted: Mon Apr 20, 2009 6:01 pm    Post subject: Reply to: Spliced file not to contain dups, all dups to othe
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    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 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 Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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