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

Record Selection using DFSORT


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

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Sep 30, 2009 7:34 am
Reply with quote

There were two files they have been merged together & my input looks something like below. The value of _ and # at column 27 is an indicator that these records are from two different files, _ from file1 & # from file2 but the records & been merged & sorted in a single file
My requirement for output is, if we have a record(s) with matching key( column 18 till 24 )from file1 then I do not want record(s) of the file2 for the same key to be present in the outfile

INPUT FILE
cols
12345678901234567890123456789
xxxxxxxxxxxxxxxxx ABCDE _
xxxxxxxxxxxxxxxxx ABCDE #
xxxxxxxxxxxxxxxxx DEFGH _
xxxxxxxxxxxxxxxxx DEFGH _
xxxxxxxxxxxxxxxxx DEFFG #
xxxxxxxxxxxxxxxxx HRADD _
xxxxxxxxxxxxxxxxx HRADD #
xxxxxxxxxxxxxxxxx HRADD #
xxxxxxxxxxxxxxxxx KLMNO _
xxxxxxxxxxxxxxxxx KLMNO _
xxxxxxxxxxxxxxxxx GABCD #
xxxxxxxxxxxxxxxxx GABCD #
xxxxxxxxxxxxxxxxx UAVDE _
xxxxxxxxxxxxxxxxx SACAC #


I want my output as
OUTPUT FILE
cols
12345678901234567890123456789
xxxxxxxxxxxxxxxxx ABCDE _
xxxxxxxxxxxxxxxxx DEFGH _
xxxxxxxxxxxxxxxxx DEFGH _
xxxxxxxxxxxxxxxxx HRADD _
xxxxxxxxxxxxxxxxx KLMNO _
xxxxxxxxxxxxxxxxx KLMNO _
xxxxxxxxxxxxxxxxx GABCD # { this & below record should be present as we do not have the match for it in file1)
xxxxxxxxxxxxxxxxx GABCD #
xxxxxxxxxxxxxxxxx UAVDE _
xxxxxxxxxxxxxxxxx SACAC # { this record should be present as we do not have the match for it in file1)

The INPUT & OUTPUT file are both FB 80

Thanks and Regards
Uncle
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 30, 2009 8:19 am
Reply with quote

Hi,

shouldn't this record also be in the output file ?
Code:
xxxxxxxxxxxxxxxxx DEFFG #


Gerry
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Sep 30, 2009 9:08 am
Reply with quote

No, that record should not be present in the outfile, as we have the record(s) with the matching key comming from the file1 (xxxxxxxxxxxxxxxxx DEFGH _ )

Thanks
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 30, 2009 9:18 am
Reply with quote

Hi,

DEFGH does not match DEFFG


Gerry
Back to top
View user's profile Send private message
harry

New User


Joined: 27 Mar 2006
Posts: 31

PostPosted: Wed Sep 30, 2009 10:10 am
Reply with quote

sorry,yes that is a typo error............
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Sep 30, 2009 9:42 pm
Reply with quote

harry

Your rules are not consistent. for ex: how did you end up picking HRADD _ for this input?

Quote:

xxxxxxxxxxxxxxxxx HRADD _
xxxxxxxxxxxxxxxxx HRADD #
xxxxxxxxxxxxxxxxx HRADD #


The first 2 match so it is considered as a pair so you are left with HRADD # but in your output you show the reverse. Please define the rules correctly
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Oct 01, 2009 4:18 am
Reply with quote

Hi Kolusu,

this is how I understood the request, all records from file 1 will always be written out, records from file 2 will only be written out if that record does not exist in file 1.


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Oct 01, 2009 4:49 am
Reply with quote

gcicchet,

If that is indeed the requirement then the following JCL will give him the desired results. However the output will be sorted on the key (18,7)

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                               
XXXXXXXXXXXXXXXXXABCDE    _                                   
XXXXXXXXXXXXXXXXXABCDE    #                                   
XXXXXXXXXXXXXXXXXDEFGH    _                                   
XXXXXXXXXXXXXXXXXDEFGH    _                                   
XXXXXXXXXXXXXXXXXDEFGH    #                                   
XXXXXXXXXXXXXXXXXHRADD    _                                   
XXXXXXXXXXXXXXXXXHRADD    #                                   
XXXXXXXXXXXXXXXXXHRADD    #                                   
XXXXXXXXXXXXXXXXXKLMNO    _                                   
XXXXXXXXXXXXXXXXXKLMNO    _                                   
XXXXXXXXXXXXXXXXXGABCD    #                                   
XXXXXXXXXXXXXXXXXGABCD    #                                   
XXXXXXXXXXXXXXXXXUAVDE    _                                   
XXXXXXXXXXXXXXXXXSACAC    #                                   
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  SORT FIELDS=(18,7,CH,A,27,1,CH,A),EQUALS                   
  OUTREC IFTHEN=(WHEN=INIT,                                   
  OVERLAY=(81:SEQNUM,8,ZD,RESTART=(18,7),27,1)),             
  IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(90:89,1))     
  OUTFIL BUILD=(1,80),OMIT=(89,2,CH,EQ,C'#_')                 
//*


The output from this job is

Code:

XXXXXXXXXXXXXXXXXABCDE    _ 
XXXXXXXXXXXXXXXXXDEFGH    _ 
XXXXXXXXXXXXXXXXXDEFGH    _ 
XXXXXXXXXXXXXXXXXGABCD    # 
XXXXXXXXXXXXXXXXXGABCD    # 
XXXXXXXXXXXXXXXXXHRADD    _ 
XXXXXXXXXXXXXXXXXKLMNO    _ 
XXXXXXXXXXXXXXXXXKLMNO    _ 
XXXXXXXXXXXXXXXXXSACAC    # 
XXXXXXXXXXXXXXXXXUAVDE    _ 
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 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top