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

KEEP DUPLICATE AND MARK WITH SET ID


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

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Wed Jul 17, 2013 5:29 pm
Reply with quote

I have a file that has duplicate records..I want to add an incremenatal "set id" to each duplicate pair...can this be done with DFSORT
INPUT
Code:

AAA
AAA
BBB
BBB
CCC
CCC
...
ZZZ
ZZZ


OUTPUT to look like this
Code:
1AAA
1AAA
2BBB
2BBB
3CCC
3CCC
...
26ZZZ
26ZZZ
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jul 17, 2013 5:47 pm
Reply with quote

Which sort product and release level do you have, please run the step below and post the SYSOUT.
Code:

//STEP0010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD *         
  RECORD                 
/*                       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *         
  SORT FIELDS=COPY       

Input & output DSORG, RECFM and LRECL required
Key values positions, lengths and formats required

What EXACTLY are the rules here for adding this extra field.
I see that you have shown it as a variable length field in your example - or should it always be a fixed two byte field.

You have been on the forum long enough to have learnt that a question posed should be accompanied by all the relevant information required to help you.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 17, 2013 9:10 pm
Reply with quote

It'll be a WHEN=GROUP PUSHing an ID (and, since you want it "in front of" the data, you'll have to PUSH the rest as well).

You probably don't want to make the thing less readable by having a variable-length insert...
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Wed Jul 17, 2013 10:44 pm
Reply with quote

expat wrote:
Which sort product and release level do you have, please run the step below and post the SYSOUT.
Code:

//STEP0010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD *         
  RECORD                 
/*                       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *         
  SORT FIELDS=COPY       


Input & output DSORG, RECFM and LRECL required
Key values positions, lengths and formats required

What EXACTLY are the rules here for adding this extra field.
I see that you have shown it as a variable length field in your example - or should it always be a fixed two byte field.

You have been on the forum long enough to have learnt that a question posed should be accompanied by all the relevant information required to help you.


I'm using Z/OS DFSORT V1R12

Here is the file/record info
It's fixed, but adding 4 bytes to the beginning to hold the "set id"
100 LRECL in
104 LRECL out
Key is first 3 bytes AAA, BBB etc

Rules are increment the "set id" by 1 for each duplicate set
correct output is
Code:
0001AAA
0001AAA
0002BBB
0002BBB
....
0026ZZZ
0026ZZZ
Thank you for assisting
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 17, 2013 11:23 pm
Reply with quote

So, look at IFTHEN=(WHEN=GROUP with KEYBEGIN, you will need to PUSH a 4-digit ID and then your entire record. The details depend on your RECFM and LRECL, which we don't know.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jul 17, 2013 11:40 pm
Reply with quote

srj1957 wrote:
expat wrote:
Which sort product and release level do you have, please run the step below and post the SYSOUT.



I'm using Z/OS DFSORT V1R12

Here is the file/record info
It's fixed, but adding 4 bytes to the beginning to hold the "set id"
100 LRECL in
104 LRECL out
Key is first 3 bytes AAA, BBB etc


srj1957,

Expat has asked you to post the sysout so that we can determine the level of DFSORT your shop has. Even if you are running Z/OS DFSORT V1R12, if your shop doesn't have the SPE H installed you will not be able to use certain features. So it is important that you post the sysout which will help us determine the level of DFSORT your shop has.

Either way use the following Control cards.

Code:

//SYSIN    DD *                                         
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(4X,1,100)),           
        IFTHEN=(WHEN=GROUP,KEYBEGIN=(5,3),PUSH=(ID=4))
//*
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Jul 18, 2013 1:26 am
Reply with quote

Here is teh SYSOUT form a previous job

Code:
  BROWSE - SYSOUT   REFOMT2  SORT     - Page  1     Line  1      Cols 1-80       
 COMMAND ===>                                                SCROLL ===> CURSOR
******************************** Top of Data ***********************************
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K90026 E9-K60824 C9-BASE   E5-K62149
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:44 ON WED JU
                                                                               
           SORT FIELDS=COPY                                                     
           INCLUDE COND=(3,1,CH,EQ,C'|')                                       
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K90026 E9-K60824 C9-BASE   E5-K62149
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE088I 0 SRJDUP  .REFOMT2 .SORT    , INPUT LRECL = 1500, BLKSIZE = 27000, TYPE
ICE093I 0 MAIN STORAGE = (MAX,6291456,6291456)                                 
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6234096,6234096)                           
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO   ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Jul 18, 2013 10:02 am
Reply with quote

Hi,

the topic says
Quote:
KEEP DUPLICATE and MARK ....


does it mean there may not be duplicates for all records ?

Can there be more than 1 pair of duplicates ? ie. more than 2 for the same record ?


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

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Jul 18, 2013 4:09 pm
Reply with quote

gcicchet wrote:
Hi,

the topic says
Quote:
KEEP DUPLICATE and MARK ....


does it mean there may not be duplicates for all records ?

Can there be more than 1 pair of duplicates ? ie. more than 2 for the same record ?


Gerry


Always pairs of duplicates only 2 for each set
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 Duplicate transid's declared using CEDA CICS 3
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
No new posts Duplicate data in PUT CONTAINER using... CICS 4
No new posts Remove set of duplicate records from ... DFSORT/ICETOOL 10
Search our Forums:

Back to Top