View previous topic :: View next topic
|
Author |
Message |
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Hi All,
I have a file (the file length is 80 bytes FB) with the following layout
XXXXXXYYYYYY
(Where XXXXXX and YYYYYY are 2 different fields PIC 9(6))
I have to increment the first field everyday and the 2nd field has to be incremented only from Sunday thru Monday. The 2nd field should not be incremented on Saturday.
Also when the numbers (in the field) reaches the maximam value '999999' it should get reset to 000001.
Is it possible to achieve this thru a SORT card.
Thanks. |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Also am using SYNCSORT FOR Z/OS 1.3.2.1R |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
A tiny little REXX would work in a second or two.
I know, the requirement says JCL.
Shouldn't it be all about the solution? |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Yeap. REXX should also be fine. Though would be good to have it in SYNCSORT.
Would appreciate any help !! |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
DKartiya,
The below Syncsort job would work for your requirement. I have assumed the starting positions to be 1 and 8.
You may need to modify it appropriately.
Code: |
//STEP01A EXEC PGM=SORT
//SYMNAMES DD *
DAY,S'&LWDAY'
//SORTIN DD *
000006 000010
000007 000011
000008 999999
000009 000013
999999 000014
000001 999998
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(1:1,6,ZD,ADD,+1,M11,LENGTH=6,81:DAY)),
IFTHEN=(WHEN=(81,3,CH,NE,C'SAT'),
OVERLAY=(8:8,6,ZD,ADD,+1,M11,LENGTH=6),HIT=NEXT),
IFTHEN=(WHEN=(1,6,ZD,EQ,0),
OVERLAY=(1:C'000001'),HIT=NEXT),
IFTHEN=(WHEN=(8,6,ZD,EQ,0),
OVERLAY=(8:C'000001')),IFOUTLEN=80 |
SORTOUT
Code: |
000007 000011
000008 000012
000009 000001
000010 000014
000001 000015
000002 999999 |
|
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Thanks Arun!! This works for me |
|
Back to top |
|
|
DKartiya
New User
Joined: 30 Jan 2008 Posts: 26 Location: Chennai
|
|
|
|
Had another query, Incase I wanna increment the sequnce nbrs daily ..
say suppose the fmt is
XXXXXX YYYYYY
Both the nbrs are to be incremented everyday and should be reset on reaching the maximum value '999999' to '000001'.
Is it possible to do without the sysnames?
Thanks!! |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Yes. it is |
|
Back to top |
|
|
|