Joined: 21 Oct 2008 Posts: 2 Location: Chennai, India
HI,
I have a FB 450 Input file. I am supposed to create an ALLDUPS file for the 2 fields (234,40,CH) and (167,07,PD).
I am supposed to do this for all recs that has (395,1,CH,EQ,C'N').
I tried doing this by first creating an ALLDUPS file for the 2 fields and then including only recs with (395,1,CH,EQ,C'N').
In case of Duplicate recs which has 1 rec with 395th byte 'N' and the other rec with 395th byte as 'Y', the duplicate with 'Y' gets omitted.
I want to retain the ALLDUPS rec with 365th byte as 'Y', if it has a corresponding duplicate with 365th byte as 'N'.
Hi,
I have simulated similar requirement for 80 byte record length file.
KEY1: 1,3
KEY2: 8,10
Flag:23,1
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
100 DEXTER Y WANT IN OUTPUT
100 DEXTER N WANT IN OUTPUT
200 HILLARY N WANT IN OUTPUT
200 HILLARY Y WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
400 ABCD Y DONT WANT IN OUTPUT
400 ABCD Y DONT WANT IN OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A,8,10,CH,A,23,1,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,3,84:8,10)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(81,13),PUSH=(101:23,1))
OUTFIL OMIT=(101,1,CH,NE,C'N'),BUILD=(1,80)
/*
Output will be,
Code:
100 DEXTER N WANT IN OUTPUT
100 DEXTER Y WANT IN OUTPUT
200 HILLARY N WANT IN OUTPUT
200 HILLARY Y WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
I have a FB 450 Input file. I am supposed to create an ALLDUPS file for the 2 fields (234,40,CH) and (167,07,PD). I am supposed to do this for all recs that has (395,1,CH,EQ,C'N').
Quote:
In case of Duplicate recs which has 1 rec with 395th byte 'N' and the other rec with 395th byte as 'Y', the duplicate with 'Y' gets omitted.
I want to retain the ALLDUPS rec with 365th byte as 'Y', if it has a corresponding duplicate with 365th byte as 'N'. May be I am misunderstanding this but this is contradictory to what you said earlier.
Are you trying to select all 'N' records first and then trying to find out how many (and which) records have dups?
OR
Are you trying to find out how many records have both 'Y' and 'N' type records for given key fields and then selecting 'N' type records?
OR
Are you trying to find out, how many records have dups on key fields, and then selecting 'N' and 'Y' records and if for a given combination, If you have both records, 'N' record get priority. What happens when you have all 'N' type records for a given key fields? What happens when you have all 'N' type records for a given key fields?
OR
Are you trying to find out somethinh else? - Please explain.
In any case, please provide sample input and expected output.
Escapa,
Would you get expected output for below input?
Code:
100 DEXTER Y WANT IN OUTPUT
100 DEXTER N WANT IN OUTPUT
200 HILLARY N WANT IN OUTPUT
200 HILLARY Y WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
300 BUSH N WANT IN OUTPUT
400 ABCD Y DONT WANT IN OUTPUT
400 ABCD Y DONT WANT IN OUTPUT
500 SQLCODE N SHOULD IT BE IN OUTPUT?
600 SQLCODE1 Y SHOULD IT BE IN OUTPUT?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Escapa,
You have the right approach but you forgot to remove the unique keys when OP wants ALLDUPS. Add the following record to your input file and see as to why you retained the unique record.
You have the right approach but you forgot to remove the unique keys when OP wants ALLDUPS. Add the following record to your input file and see as to why you retained the unique record.
Joined: 21 Oct 2008 Posts: 2 Location: Chennai, India
Hi All,
Thank you everyone for your replies.
I'll try to explain in a little more detail.
My I/P file will have the 3 fields as given below.
POSITIONS
167,7,PD 234,40,CH 395,1,CH
-----------------------------------
200006 NEW YORK METRO N
200006 NEW YORK METRO N
200008 NEW YORK METRO N
200009 NEW YORK METRO Y
200016 NEW YORK N
200017 NEW YORK N
200017 NEW YORK N
200018 NEW ENGLAND N
200018 NEW ENGLAND N
200019 NEW YORK METRO N
200019 NEW YORK METRO Y
200059 NEW YORK METRO Y
200059 NEW YORK METRO Y
201058 NEW YORK METRO N
201058 NEW YORK METRO N
//*
The expected output is
200006 NEW YORK METRO N
200006 NEW YORK METRO N
200017 NEW YORK N
200017 NEW YORK N
200018 NEW ENGLAND N
200018 NEW ENGLAND N
200019 NEW YORK METRO N
200019 NEW YORK METRO Y
201058 NEW YORK METRO N
201058 NEW YORK METRO N
I was trying the examples given by Escapa and Skolusu. But it gave the following error.
********************************* TOP OF DATA **********************************
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 12:51 ON MON JU
SORT FIELDS=(234,40,CH,A,
167,07,PD,A,
395,01,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(451:234,40,167,7)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(451,47),PUSH=(451:SEQ=8,395,1)),
$
ICE006A 0 OPERAND DEFINER ERROR
IFTHEN=(WHEN=GROUP,BEGIN=(451,8,ZD,EQ,1),PUSH=(460:1,450),RECORDS=2)
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTFIL INCLUDE=(451,8,ZD,GT,1,AND,459,1,CH,EQ,C'N'),IFOUTLEN=450,
IFTHEN=(WHEN=(451,8,ZD,EQ,2),BUILD=(460,450,/,1,450))
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707
ICE052I 3 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
Not sure if my version of DFSORT doesnt support WHEN=GROUP.