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

Splitting file and eliminating duplicates in a single step.


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

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 6:58 pm
Reply with quote

I have a requirement.

First step
I need to split a file into file A and file B. File A should contain records with string X and file B with String Y

Second step
is to eliminate duplicates on File A based on a condition and then write the total at the end of the file

third step
is to eliminate duplicates from File B based on other condition and then write the total at the end of the file

Is it possible to combine all 3 steps in one?

I can share the sort cards i used for the different steps. let me know your thoughts.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue May 05, 2009 7:38 pm
Reply with quote

Quote:
Can you advise if this can be combined in 1 step?
I'd think so, what is the lrecl and recfm?
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 7:47 pm
Reply with quote

All the 3 files are LRECL of 80 byte and RECFM of FB
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue May 05, 2009 8:07 pm
Reply with quote

If you added in your inrec a common area for the key that is different between the two types of records, then a single sort would be enough.
For the sum to work, you may need to add the type (AA or AB) to the sort key.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue May 05, 2009 8:58 pm
Reply with quote

cjt,

use the following JCL. I assumed that your AA records have values at pos 32 that you want to sum and AB records have values at pos 67 that needs to be summed.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=Your input 80 bytes,DISP=SHR     
//FILEAA   DD SYSOUT=*                                         
//FILEAB   DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  INCLUDE COND=(30,2,SS,EQ,C'AA,AB')                           
                                                               
  INREC IFTHEN=(WHEN=(30,2,SS,EQ,C'AA'),OVERLAY=(81:32,9)),     
        IFTHEN=(WHEN=(30,2,SS,EQ,C'AB'),OVERLAY=(81:67,9))     
                                                               
  SORT FIELDS=(30,2,CH,A,13,11,CH,A,81,09,ZD,A)                 
                                                               
  OUTFIL FNAMES=FILEAA,INCLUDE=(30,2,CH,EQ,C'AA'),             
  BUILD=(1,31,81,09,ZD,M11,41,40),REMOVECC,                     
  TRAILER1=(10:'TOTAL AMOUNT',                                 
            40:TOTAL=(81,09,ZD,M5,LENGTH=20))                   
                                                               
  OUTFIL FNAMES=FILEAB,INCLUDE=(30,2,CH,EQ,C'AB'),             
  BUILD=(1,46,47,13,ZD,M11,60,7,81,09,ZD,M11,76,5),REMOVECC,   
  TRAILER1=(10:'TOTAL AMOUNT',                                 
            40:TOTAL=(81,09,ZD,M5,LENGTH=20))                   
/*
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Wed May 06, 2009 2:29 pm
Reply with quote

Thanks a million Kolusu for your time as well. the method specified by you is working for me.

I have one question. please bear with me.

What does 'SS' stand for in the statement

INCLUDE COND=(30,2,SS,EQ,C'AA,AB')
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed May 06, 2009 2:43 pm
Reply with quote

SS, 3.7.4.1
See also substring comparison operator
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Wed May 06, 2009 3:08 pm
Reply with quote

thanks for the info CICS guy
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 How to split large record length file... DFSORT/ICETOOL 8
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 Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top