MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
chandra Beginner Joined: 26 Sep 2003 Posts: 130 Topics: 36
Posted: Mon Oct 29, 2007 3:45 pm Post subject: Syncsort - Make duplicate number to unique
I have a account number as shown in the input. I want to add a two digit to the account number as 20 as shown in the output. If the account number is repeats then I need to increase it by one (21) and so on.
Input
----+----1
455521461
507461046
493182005
455521461
363161952
507461046
538101163
507461046
455521461
Output
----+----1-
53810116320
50746104620
50746104621
50746104622
49318200520
45552146120
45552146121
45552146122
36316195220 _________________ Regards,
Chandra
Back to top
krisprems Beginner Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
Posted: Mon Oct 29, 2007 10:31 pm Post subject:
hello chandra
in your i/p first record is , but in the o/p first record is
So, on what basis are you sorting?
In your example where does the KEY start and what is its length? _________________ cHEERs
krisprems
Back to top
vkphani Intermediate Joined: 05 Sep 2003 Posts: 483 Topics: 48
Posted: Tue Oct 30, 2007 12:39 am Post subject: Re: Syncsort - Make duplicate number to unique
Chandra,
The below code gives you the desired results.
Code: //S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
455521461
507461046
493182005
455521461
363161952
507461046
538101163
507461046
455521461
/*
//SORTOUT DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SORTXSUM DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=NONE,XSUM
/*
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=&&T2,DISP=SHR
//T3 DD DSN=T3.TEMP3,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) TO(T3) USING(CTL1)
SORT FROM(T3) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(10:SEQNUM,1,ZD)
SORT FIELDS=(1,9,CH,A)
OUTREC OVERLAY=(1:1,9,10:C'2',11:SEQNUM,1,FS,RESTART=(1,23))
/*
//CTL2CNTL DD *
SORT FIELDS=COPY
/*
//S3 EXEC PGM=SORT
//SORTIN DD DSN=&&T1,DISP=SHR
//SORTOUT DD DSN=T4.TEMP4,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,9,10:C'20')
/*
//S4 EXEC PGM=SORT
//SORTIN DD DSN=T3.TEMP3,DISP=SHR
// DD DSN=T4.TEMP4,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,11,CH,A)
/*
SORTOUT of step S4 contains
Code: 36316195220
45552146120
45552146121
45552146122
49318200520
50746104620
50746104621
50746104622
53810116320
Back to top
vkphani Intermediate Joined: 05 Sep 2003 Posts: 483 Topics: 48
Posted: Tue Oct 30, 2007 1:44 am Post subject:
If you don't want your output to be sorted i.e. if you want the output as is with just numbers (20,21,22) added at the end , then replace the sort card in the step S4 as below.
Back to top
krisprems Beginner Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
Posted: Tue Oct 30, 2007 4:32 am Post subject:
chandra
If it is OK to have the i/p field(1-9) sorted. Then this SORT JOB would be more enough. Code: //STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
455521461
507461046
493182005
455521461
363161952
507461046
538101163
507461046
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
455521461
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,9,CH,A)
OUTREC OVERLAY=(10:SEQNUM,2,ZD,START=20,RESTART=(1,9))
/*
SORTOUT: Code: 36316195220
45552146120
45552146121
45552146122
49318200520
50746104620
50746104621
50746104622
53810116320
Chandra, if this is not what you want please answer the questions from my previous post
vkphani, can't undestand as to why you have complicated so much _________________ cHEERs
krisprems
Back to top
vkphani Intermediate Joined: 05 Sep 2003 Posts: 483 Topics: 48
Posted: Tue Oct 30, 2007 4:45 am Post subject:
krisprems,
good solution.
Back to top
vivek1983 Intermediate Joined: 20 Apr 2006 Posts: 222 Topics: 24
Posted: Tue Oct 30, 2007 5:06 am Post subject:
chandra ,
Change the sort order to descending in the sort card provided by Kris to get your desired output.
Code:
SORT FIELDS=(1,9,CH,D)
_________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
krisprems Beginner Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
Posted: Tue Oct 30, 2007 5:11 am Post subject:
Quote:
krisprems,
good solution.
Thank you
Would like to hear the same from the person who started the topic _________________ cHEERs
krisprems
Back to top
chandra Beginner Joined: 26 Sep 2003 Posts: 130 Topics: 36
Posted: Tue Oct 30, 2007 10:43 am Post subject:
Hi all,
Thank you very much for the solution Krisprems and vkphani.
I want my output to be in sorted order which Krisprems shown.
Thanks once again _________________ Regards,
Chandra
Back to top
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