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

ICETOOL ALLDUPS ISSUE - HELP REQUIRED


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

New User


Joined: 21 Oct 2008
Posts: 2
Location: Chennai, India

PostPosted: Mon Jul 25, 2011 3:50 pm
Reply with quote

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'.


THE JCL that I was using is given below.

Code:

//PSTEP150 EXEC GM=ICETOOL                                                           
//INDDN    DD DSN=IPFIle1              ---- FB 450               
//         DISP=SHR                                                                             
//CTL2CNTL DD *                                                       
  SORT FIELDS=(167,07,PD,A,234,40,CH,A,1,50,CH,A)                       
  INCLUDE COND=395,1,CH,EQ,C'N')
/*                                                   
//TEMP     DD DSN=&&TEMP,                                             
//         DISP=(,PASS),                                     
//         UNIT=STOR,SPACE=(CYL,200,50),RLSE)                                                                   
//ALLDUPS  DD DSN=Output ALLDUPS file,               
//         DISP=(,CATLG,DELETE),                                       
//         UNIT=STOR,SPACE=(CYL,(200,50),RLSE)                                                                 
//TOOLIN   DD *                                                       
  SELECT FROM(INDDN) TO(TEMP) ON(234,40,CH) -                           
   ON(167,07,PD) ALLDUPS                                                 
  COPY FROM(TEMP) TO(ALLDUPS) USING(CTL2)         
/*       
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//*


Sree
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 25, 2011 5:04 pm
Reply with quote

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
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jul 25, 2011 7:21 pm
Reply with quote

sszy3svg,
Quote:
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.

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

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jul 25, 2011 7:23 pm
Reply with quote

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?


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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 25, 2011 7:32 pm
Reply with quote

SQLCODE1, Out of two new you have added... As per my understanding...
Code:

500    SQLCODE        N SHOULD IT BE IN OUTPUT?

Should come in output.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jul 25, 2011 9:36 pm
Reply with quote

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.

Code:

500    ESCAPA         N DONT WANT IN OUTPUT   
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jul 25, 2011 9:43 pm
Reply with quote

sszy3svg,


Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=Your input file FB 450 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  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)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(451,8,ZD,EQ,1),PUSH=(460:1,450),RECORDS=2)
 
  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))                 
//*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 25, 2011 10:08 pm
Reply with quote

Skolusu wrote:
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.


Yes.. Got it... Thanks ....icon_smile.gif

Thanks SQLCODE1...
Back to top
View user's profile Send private message
sszy3svg

New User


Joined: 21 Oct 2008
Posts: 2
Location: Chennai, India

PostPosted: Mon Jul 25, 2011 11:08 pm
Reply with quote

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.

Thanks again.
Sree
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jul 25, 2011 11:25 pm
Reply with quote

sszy3svg,

Looks like you don't have the PTF H which supports KEYBEGIN keyword. Use the following control cards which will give you the desired results.

Code:

//SYSIN    DD *                                                       
  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,SEQNUM,8,ZD,RESTART=(451,47))),           
  IFTHEN=(WHEN=GROUP,BEGIN=(498,8,ZD,EQ,1),PUSH=(506:395,1)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(498,8,ZD,EQ,1),PUSH=(507:1,450),RECORDS=2)

  OUTFIL INCLUDE=(498,8,ZD,GT,1,AND,506,1,CH,EQ,C'N'),IFOUTLEN=450,   
  IFTHEN=(WHEN=(498,8,ZD,EQ,2),BUILD=(507,450,/,1,450))               
//*
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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top