MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating a sequence number for duplicate record.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Wed Feb 23, 2005 1:25 pm    Post subject: Creating a sequence number for duplicate record. Reply with quote

Hi
Could anybody please tell me whether this can be solved using SYNCSORT?
The requirement is that I have a file which has duplicate record as follows. The key for the file is Field-1(character). Field-2 is ZD.
The file is FB and length is 80.

Code:

Input file
----------
FIELD-1(1-5) FIELD-2(6-9)       
------------ -----------       
AAAAA        001               
BBBBB        001               
AAAAA        001               
AAAAA        001               
BBBBB        001               
AAAAA        001               
AAAAA        001               
CCCCC        001               
CCCCC        001               
AAAAA        001               
BBBBB        001               
CCCCC        001               

Code:

Output file
----------
FIELD-1(1-5) FIELD-2(6-9)   
------------ -----------   
AAAAA        001           
BBBBB        001           
AAAAA        002           
AAAAA        003           
BBBBB        002           
AAAAA        004           
AAAAA        005           
CCCCC        001           
CCCCC        002           
AAAAA        006           
BBBBB        003           
CCCCC        003           

Appreciate any help on this.
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Feb 23, 2005 2:56 pm    Post subject: Reply with quote

Ace,

Please search before posting. This topic has been discussed earlier. check the last post in this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=2628&highlight=trick

You need Syncsort z/os 1.1 and higher for the above mentioned solution

Here is the sample JCL which is customised to your requirement.
Code:

//STEP0100 EXEC PGM=SYNCTOOL                               
//DFSMSG   DD SYSOUT=*                                     
//TOOLMSG  DD SYSOUT=*                                     
//IN       DD *                                           
AAAAA 001                                                 
BBBBB 001                                                 
AAAAA 001                                                 
AAAAA 001                                                 
BBBBB 001                                                 
AAAAA 001                                                 
AAAAA 001                                                 
CCCCC 001                                                 
CCCCC 001                                                 
AAAAA 001                                                 
BBBBB 001                                                 
CCCCC 001                                                 
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) 
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) 
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) 
//CON      DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR               
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR               
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                                   
  SORT   FROM(IN)  USING(CTL1)                                     
  SPLICE FROM(CON) TO(T3) ON(1,5,CH) WITH(1,96) WITHALL USING(CTL2)
  SORT   FROM(T3)  USING(CTL3)                                     
//CTL1CNTL DD *                                                   
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                                 
  SORT FIELDS=(1,5,CH,A)                                           
  OUTREC FIELDS=(1,88,SEQNUM,8,ZD,8X)                             
  OUTFIL FNAMES=T1,NODETAIL,REMOVECC,                             
  SECTIONS=(1,5,TRAILER3=(1,96,MIN=(89,8,ZD,M11,LENGTH=8)))       
  OUTFIL FNAMES=T2                                                 
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=T3,                                               
  OUTREC=(1,88,                                                   
         ((89,8,ZD,SUB,97,8,ZD),ADD,+1),EDIT=(TTTTTTTT))           
//CTL3CNTL DD *                                                   
  SORT FIELDS=(81,8,CH,A)                                         
  OUTFIL FNAMES=OUT,                                               
  OUTREC=(1,6,94,3)                                               
/*                                                                 


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Wed Feb 23, 2005 3:12 pm    Post subject: Reply with quote

Thank you Kolusu.
I'm sorry that I didn't give a search. Could you please tell me whether SYNCSORT's SPLICE functionality is similar to that of DFSORT?
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Feb 23, 2005 3:26 pm    Post subject: Reply with quote

For those of you who use DFSORT, you can do this more easily and efficiently with the new functions available with z/OS DFSORT V1R5 PTF U95214 or DFSORT R14 PTF UQ95213 (Dec, 2004). For complete information on the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

Here's the DFSORT/ICETOOL job:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAAAA001
BBBBB001
AAAAA001
AAAAA001
BBBBB001
AAAAA001
AAAAA001
CCCCC001
CCCCC001
AAAAA001
BBBBB001
CCCCC001
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
  SORT FROM(IN) TO(T1) USING(CTL1)
  SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Add a seqnum in 81-8 so we can get the records back in
* their original order.
  INREC OVERLAY=(81:SEQNUM,8,ZD)
  OPTION EQUALS
* Sort on the key
  SORT FIELDS=(1,5,CH,A)
* Restart the seqnum at 1 each time the key changes
  OUTREC OVERLAY=(6:SEQNUM,3,ZD,RESTART=(1,5))
/*
//CTL2CNTL DD *
* Sort on the seqnum to get the records back in their original order.
  SORT FIELDS=(81,8,ZD,A)
* Remove the seqnum.
  OUTREC FIELDS=(1,80)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Feb 23, 2005 3:31 pm    Post subject: Reply with quote

Quote:
Could you please tell me whether SYNCSORT's SPLICE functionality is similar to that of DFSORT?


The SPLICE functionality of Syncsort's SYNCTOOL is a subset of the SPLICE functionality of DFSORT's ICETOOL. Of course, since Syncsort does not have any documentation for SYNCTOOL, you have to guess what that subset is, and you also have to guess what any error messages you get from SYNCTOOL mean.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Wed Feb 23, 2005 3:52 pm    Post subject: Reply with quote

Thank You Frank.
Just wondering when is our shop going to get DFSORT. Sad
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Feb 23, 2005 5:40 pm    Post subject: Reply with quote

Ace,

Your shop would have to decide to switch from Syncsort to DFSORT. If you want some ammunition to try to convince whoever needs to be convinced, I can send you some files prepared by the DFSORT Team that discuss what we see as the advantages of DFSORT, as well as considerations for migrating. If you (or anyone else) wants these documents, just send me a note (yaeger@us.ibm.com) offline. Please put "DFSORT" somewhere in your Subject line to catch my attention.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Feb 24, 2005 7:05 am    Post subject: Reply with quote

While i tried to run this Job which was posted by Frank i am getting syntex error
Code:

  INREC OVERLAY=(81:SEQNUM,8,ZD)                       
        *                                             
  OPTION EQUALS                                       
* SORT ON THE KEY                                     
  SORT FIELDS=(1,5,CH,A)                               
* RESTART THE SEQNUM AT 1 EACH TIME THE KEY CHANGES   
  OUTREC OVERLAY=(6:SEQNUM,3,ZD,RESTART=(1,5))         
         *                                             
WER428I  CALLER-PROVIDED IDENTIFIER IS "0001"         
WER268A  INREC STATEMENT   : SYNTAX ERROR             
WER268A  OUTREC STATEMENT  : SYNTAX ERROR             
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE     


Could you pls help me to slove this problem

Thanks in advance
Ravi
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Feb 24, 2005 8:48 am    Post subject: Reply with quote

coolguy,

The error messages(werxxxx) indicate that you are using Syncsort. Frank's Job only works with DFSORT. Your shop has Syncsort and it does not support the OVERLAY or RESTART features. You can use the job posted by me provided that you have the latest version of syncsort.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Feb 24, 2005 9:04 am    Post subject: Reply with quote

Ok thanks for the help Kolusu
Back to top
View user's profile Send private message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Thu Feb 24, 2005 9:09 am    Post subject: Reply with quote

Hi Kolusu
Could you ps explin how the jcl is working? it will help ful for me

Thanks in advance
Coolguy
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Feb 24, 2005 9:11 am    Post subject: Reply with quote

coolguy,

Look at the 5th topic from the top in this link which explains the first 2 steps.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2628&highlight=trick

The third sort is performed to retain the original order of the records as ace did not want the records to be sorted on the key

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group