View previous topic :: View next topic
|
Author |
Message |
fredrick andrews
New User
Joined: 10 Jun 2010 Posts: 52 Location: chennai
|
|
|
|
I have a requirement where I will have to set a Return code of 0, If there is orderliness * in the records and any other Return code (4,8,...) if they are not properly ordered.
Input File: ( FB / 50 )
Code: |
11111
aaaaa
bbbbb }-> dups
bbbbb } follow immediately
bbbbb } follow immediately
ccccc
22222
33333
ggggg
hhhhh
iiiii
ttttt
|
If this is the I/p file , the RC should have been 0.
Input file :
Code: |
11111 -> dup1
aaaaa
bbbbb -> dup 2
bbbbb -> dup 2
11111 -> dup1 ( did not follow first occurence )
bbbbb -> dup2 ( did not follow sec occurence )
ccccc
22222
33333
ggggg
hhhhh
iiiii
ttttt
|
Orderliness - If there are duplicates , they should be in a group . So, If there are say 3 duplicates , then all of these 3 should be ordered together.
In this case, the Return code should be 0.
Else, the RC should be Non -Zero. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Hi fredrick,
Try this two step process..
If your data is ordered(based on your rules), the RC would be 4 else it would be 5.
Code: |
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=-->>input file
//SORTOUT DD DSN=-->> Output file1
//SORTXSUM DD DSN=-->> XSUM file
//SYSIN DD *
SORT FIELDS=(1,5,CH,A,81,8,ZD,A)
INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,5))
SUM FIELDS=NONE,XSUM
//*
//STEP020 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDD1 DD DSN=-->>XSUM File
//OUTDD DD DSN=-->> Dummy file
//SYSIN DD *
PRINT IFILE(INDD1) COUNT(1)
IF LASTCC=0 THEN -
DO
SET MAXCC=5
END
|
Thanks,
Ashwin. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Hi,
A small correction on the IDCAMS step's SYSIN card to set RC=0 for correct order and RC=5 for not in order.
Code: |
//SYSIN DD *
PRINT IFILE(INDD1) COUNT(1)
IF LASTCC=0 THEN -
SET MAXCC=5
ELSE SET MAXCC=0
|
Thanks,
Ashwin. |
|
Back to top |
|
|
fredrick andrews
New User
Joined: 10 Jun 2010 Posts: 52 Location: chennai
|
|
|
|
Hi aswin,
It worked...
Sorry for the delay in replying...
Thanks! |
|
Back to top |
|
|
|