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
 
Record Selection using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Record Selection using DFSORT
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: 1703
Location: Australia

PostPosted: Wed Sep 30, 2009 8:19 am    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Sep 30, 2009 9:18 am    Post subject:
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    Post subject:
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    Post subject: Reply to: Record Selection using DFSORT
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: 1703
Location: Australia

PostPosted: Thu Oct 01, 2009 4:18 am    Post subject:
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    Post subject: Reply to: Record Selection using DFSORT
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    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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm

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