|
View previous topic :: View next topic
|
| Author |
Message |
dharmadam_man
New User
Joined: 20 Apr 2005 Posts: 8
|
|
|
|
I have a dataset with one record. The record layout is as follows.
I have a number in a field starting from position 1 thru 13 (with leading zeroes). Another number starting in position 18 (no leading zeroes). I want to take the number from position 18, subtract 1 and then compare with the number in position 1 thru 13. If the numbers are not equal, I want to set the RC (return code) to 4 or greater.
I do not have DFSORT, but have SYNCSORT and FILEAID. Can someone suggest a way to achieve this. |
|
| Back to top |
|
 |
somasundaran_k
Active User
.jpg)
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
dharmadam_man
Try this job. If you have SYNCSORT you should be able to run it.
This will give a return code of 12 if the numbers are not equal.
Assuming the file is FB and LRECL=80
| Code: |
//STEP1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
0000000010123 10124
/*
//T1 DD DSN=&&T1,DISP=(,PASS)
//T2 DD DSN=&&T2,DISP=(,PASS)
//*
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
COPY FROM(T1) USING(CTL2)
COUNT FROM(T2) EMPTY
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=T1,
OUTREC=((18,05,ZD,SUB,+1),1,50,80:X)
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T2,
INCLUDE=(1,15,ZD,EQ,17,13,ZD)
/*
//
|
hth
-Som |
|
| Back to top |
|
 |
dharmadam_man
New User
Joined: 20 Apr 2005 Posts: 8
|
|
|
|
Som,
Thanks for posting this code. It worked well. I have a question though. The number of digits in the count value, here 10124, can vary. How does the statement OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) would look? |
|
| Back to top |
|
 |
somasundaran_k
Active User
.jpg)
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
dharmadam_man
Please post the layout of the file?
Regds
-Som |
|
| Back to top |
|
 |
dharmadam_man
New User
Joined: 20 Apr 2005 Posts: 8
|
|
|
|
The layout is included. The count of records in the file is stored starting at position 18, but its length can vary. Please see the eamples.
0000000101235 101236
0000001012 1013 |
|
| Back to top |
|
 |
somasundaran_k
Active User
.jpg)
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
Hi
What I meant by the layout is the COBOL copy book. Do you have it? OR what is the maximum length of this field (the count field)?
Regds
-Som |
|
| Back to top |
|
 |
somasundaran_k
Active User
.jpg)
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
Hi
The examples that you had given in the previous post is different from what you described in the first post.
You have mentioned
| Quote: |
I have a number in a field starting from position 1 thru 13 (with leading zeroes).
|
But in the example
| Code: |
0000000101235 101236
0000001012 1013
|
This should be
| Code: |
-----------13 18----
0000000101235 101236
0000000001012 1013
|
If the input is as given above all you need to change is
OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) to
OUTREC=((18,X,ZD,SUB,+1),1,50,80:X) where X is the maximum length of your numeric field (Assuming it's less than or equal to 15 - In SYNCSORT the maximum for a ZD field is 15 digits)
hth
-Som |
|
| Back to top |
|
 |
dharmadam_man
New User
Joined: 20 Apr 2005 Posts: 8
|
|
|
|
There is no COBOL layout. The file is created by this JOB step.
//JS030 EXEC PGM=SORT
//SORTIN DD DSN=CMKJNT.ABC.CLAIM.EXTTERNAL.G0018V00,
// DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=CMKJNT.ABC.CLAIM.EXTERNAL.COUNT,
// DISP=(NEW,CATLG,CATLG),
// UNIT=SYSDA,
// SPACE=(CYL,(20,5),RLSE),
// DCB=(ACSNS.DSCB,BLKSIZE=0,LRECL=88,RECFM=FB
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(1,13,15:COUNT)
/* |
|
| Back to top |
|
 |
somasundaran_k
Active User
.jpg)
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
dharmadam_man
So your count field's starting position is 15.
So change it as follows and let us know the outcome.
OUTREC=((15,08,ZD,SUB,+1),1,50,80:X)
Regds
-Som |
|
| Back to top |
|
 |
dharmadam_man
New User
Joined: 20 Apr 2005 Posts: 8
|
|
|
|
| Yes. It worked well. Thanks for your help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|