|
View previous topic :: View next topic
|
| Author |
Message |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I have to compare counts from two files and if the difference is more than 1 then need to issue RC=8 or 16 using SORT or File-Aid. Is it possible?
Input-1:
| Code: |
RECORD1 2012
RECORD2 3458
RECORD3 1974
|
Input-2:
| Code: |
RECORD1 2010
RECORD2 3457
RECORD3 1973
|
In above, RECORD1 has difference in count as 2. How to get RC=8 or 16? Please help.
Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
SyncSort manual handy?
Have a look at OUTFIL and see if NULLOFL exists, or some other processing for no records on an OUTFIL group. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
| Ok....will give a try. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I tried below two step SORT solution (could not combine INREC with JOINKEYS) but to no avail It still ends with MAXCC=0000. and NULLOFL does not work.
1st step: Use JOINKEYS to bring pairs of records side by side from two files into a temp output file. Use temp file as input to 2nd step.
2nd step:
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(40:9,4,ZD,SUB,21,4,ZD,TO=ZD,LENGTH=1)),
IFTHEN=(WHEN=(40,1,ZD,GT,+1),
OVERLAY=(45:C'DIFF NOT ONE'))
OUTFIL NULLOFL=4,INCLUDE=(45,4,CH,EQ,C'DIFF')
|
Output:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6
RECORD1 2012RECORD1 2010 2 DIFF NOT ONE
RECORD2 3458RECORD2 3457 1
RECORD3 1974RECORD3 1973 1
|
Please suggest. Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Can you show your full sysout from the step with the NULLOFL, please? Was there a reason not to include the "second step" as the "main task" in the JOINKEYS? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
I don't suppose you mean: "NULLOFL will set the RC to 4 or 12 when no data is in the OUTFIL group. I have INCLUDEd one record and got a zero RC".
How many records are you likely to compare in this way? Do you need to know which has failed (if there are hundreds, it could save someone a lot of time, if there are three, not really, unless it is for a late-night call)? |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I would change LENGTH=1 to LENGTH=4, a 1 byte value for count difference will result in incorrect results.
eg. a difference of 10 will result in 0 for LENGTH=1
Gerry |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
Any update on this, or is it superseded by your new topic?
This will work if you have trailers on the files. I have a MERGE solution if you have headers. Headers and/or trailers can be easily added provided as input to your processing. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi Bill,
Here is the SYSOUT:
| Code: |
SYNCSORT FOR Z/OS 1.3.2.2R
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(40:9,4,ZD,SUB,21,4,ZD,TO=ZD,LENGTH=1)),
IFTHEN=(WHEN=(40,1,ZD,GT,+1),
OVERLAY=(45:C'DIFF NOT ONE'))
OUTFIL INCLUDE=(45,4,CH,EQ,C'DIFF'),NULLOFL=RC4
WER276B SYSDIAG= 6605, 665257, 665257, 1151625
WER164B 6,904K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,118,276 BYTES USED
WER146B 12K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 24; BLKSIZE= 27984
WER257I INREC RECORD LENGTH = 56
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I SORTOUT : RECFM=FB ; LRECL= 56; BLKSIZE= 56
WER410B 5,876K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 102,604 BYTES USED
WER405I SORTOUT : DATA RECORDS OUT 1; TOTAL RECORDS OUT 1
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B SORTIN : EXCP'S=1,UNIT=3390,DEV=3957,CHP=(2A3C343F4046,1),VOL=SYS120
WER416B OUTFIL WAS USED FOR SORTOUT
WER054I RCD IN 3, OUT 3
WER169I RELEASE 1.3 BATCH 0506 TPF LEVEL 2.2
|
Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
There were other questions.
What output are you expecting? Just the RC, or some indication of what didn't "get close" to matching? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
| Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(40:3,4,ZD,SUB,8,4,ZD,TO=ZD,LENGTH=4)),
IFTHEN=(WHEN=GROUP,BEGIN=(40,1,ZD,GT,+1),
PUSH=(45:1,1))
OUTFIL NULLOFL=RC4,
FNAMES=CHKOUT,
INCLUDE=(1,6,CH,EQ,C'DUMMY ',AND,45,1,CH,EQ,C' ')
|
Try to include that in the after your JOINKEYS/REFORMAT statement. Include a DUMMY DD for CHKOUT. Concatenate a record (or just type for testing) which says DUMMY starting in position one. You'll maybe need to change positions, as I used the following data.
| Code: |
X-6839 6838
K-4987 4980
T-3312 3308
DUMMY |
Result was RC=4. Tested with DFSORT. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Here's another take on it, using MERGE. The MERGE is done on a generated sequence number, so that records are taken from the first file, then the second, then the first, then the second, etc. When an out-of-range situation is encountered, the sequence number key is blattered "low", and the MERGE then fails with RC=16, otherwise completes. Tested with DFSORT and using SYSOUT=* for SORTOUT, but I assume the DD DUMMY works :-)
| Code: |
//COUNTCHK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DUMMY
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(13:SEQNUM,7,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(20,1,BI,EQ,B'.......1'),
PUSH=(21:1,12)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'DUMMY'),OVERLAY=(1:1,1)),
IFTHEN=(WHEN=(20,1,BI,EQ,B'.......0'),
OVERLAY=(34:9,4,ZD,SUB,29,4,ZD,EDIT=(TTTT)),HIT=NEXT),
IFTHEN=(WHEN=(34,4,CH,GT,C'0001'),
OVERLAY=(13:X'00'))
MERGE FIELDS=(13,7,CH,A)
//SORTIN01 DD *
DUMMY
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
//SORTIN02 DD *
DUMMY
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
|
|
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
| Bill, I will try these ones and come back ......thanks for all the tips. Yes..I am looking to get RC4 or RC16 whenever a single wrong record is found. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
Sorry, bugged it up with a last minute change...
| Code: |
INREC IFTHEN=(WHEN=INIT,OVERLAY=(13:SEQNUM,7,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(19,1,BI,EQ,B'.......1'),
PUSH=(21:1,12)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'DUMMY'),OVERLAY=(1:1,1)),
IFTHEN=(WHEN=(19,1,BI,EQ,B'.......0'),
OVERLAY=(34:9,4,ZD,SUB,29,4,ZD,EDIT=(TTTT)),HIT=NEXT),
IFTHEN=(WHEN=(34,4,CH,GT,C'0002'),
OVERLAY=(13:X'00'))
MERGE FIELDS=(13,7,CH,A),NOEQUALS
|
I forgot to mention that th EQ,B'.......1' and 0 are testing for oddness or evenness of the number (stole that from a previous post I ran across the other day). In extending the sequence number just in case you had scrillions of counts to check, I messed the position of the final digit :-) |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi Bill, I have ran the job as it is and it abend with U0016 ! Here is the SYSOUT:
| Code: |
SYSIN :
INREC IFTHEN=(WHEN=INIT,OVERLAY=(13:SEQNUM,7,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(19,1,BI,EQ,B'.......1'),
PUSH=(21:1,12)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'DUMMY'),OVERLAY=(1:1,1)),
IFTHEN=(WHEN=(19,1,BI,EQ,B'.......0'),
OVERLAY=(34:9,4,ZD,SUB,29,4,ZD,EDIT=(TTTT)),HIT=NEXT),
IFTHEN=(WHEN=(34,4,CH,GT,C'0002'),
OVERLAY=(13:X'00'))
MERGE FIELDS=(13,7,CH,A),NOEQUALS
WER276B SYSDIAG= 24715, 682923, 682923, 1109550
WER164B 6,904K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 304K BYTES USED
WER146B 12K BYTES OF EMERGENCY SPACE ALLOCATED
WER109I MERGE INPUT : TYPE=F; LRECL= 80
WER257I INREC RECORD LENGTH = 80
WER110I SORTOUT : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER410B 5,876K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 184K BYTES USED
WER068A OUT OF SEQ SORTIN02 , BLOCK 5
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
Please suggest.
Thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| What does your data look like? |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I just copy pasted whatever is given here......
| Code: |
//*
//COUNTCHK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DUMMY
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(13:SEQNUM,7,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(19,1,BI,EQ,B'.......1'),
PUSH=(21:1,12)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'DUMMY'),OVERLAY=(1:1,1)),
IFTHEN=(WHEN=(19,1,BI,EQ,B'.......0'),
OVERLAY=(34:9,4,ZD,SUB,29,4,ZD,EDIT=(TTTT)),HIT=NEXT),
IFTHEN=(WHEN=(34,4,CH,GT,C'0002'),
OVERLAY=(13:X'00'))
MERGE FIELDS=(13,7,CH,A),NOEQUALS
//SORTIN01 DD *
DUMMY
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
RECORD1 2010
RECORD2 3458
RECORD3 1974
RECORD4 0001
//SORTIN02 DD *
DUMMY
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
RECORD1 2012
RECORD2 3457
RECORD3 1973
RECORD4 0005
|
Thanks. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Is there some reason you did not correct this?
| Code: |
| WER068A OUT OF SEQ SORTIN02 , BLOCK 5 |
If you do not correct the error info provided, there is not much we can do. . . |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
Did you ever notice the subject of your post?
Plus:
| Quote: |
| I have to compare counts from two files and if the difference is more than 1 then need to issue RC=8 or 16 using SORT or File-Aid. Is it possible? |
You got your 16, and now you are complaining :-) ?
Look at the first "RECORD4" records, one with a count of one, one with a count of five. Difference is four. Bigger than the difference of two I used for my testing, so the code DELIBERATELY causes the keys to be out-of-sequence, which causes MERGE to issue the RC=16.
Hi Dick,
Sorry, but Ramsri has deluded everyone into thinking the results are wrong :-) |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Bill,
| Quote: |
| Sorry, but Ramsri has deluded everyone into thinking the results are wrong |
I believe what is happening is a User Abend (U0016) rather than an RC=whatever as desired.
Until the sequence error is corrected, i suspect no further progress will be made.
d |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ah. Well, DFSORT has an ABEND/NOABEND option. Has SyncSort?
With NOABEND, you get the RC=16, for DFSORT. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
The latest Syncsort documentation does not contain NOABEND.
Wonder if the problem has been corrected and the job successfully run? |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
ok Bill.......I understood it now......I kept the same data in 01 and 02 and got MAXCC=0 and ran again with earlier data and got U0016.....earlier I was expecting to see MAXCC=16
Thanks a lot for your time and help. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| ramsri wrote: |
earlier I was expecting to see MAXCC=16
Thanks a lot for your time and help. |
Me too :-)
Now go and fix-up your JOINKEYS version with trailers included, The trailers will give you a point at which you can say "ah, I have a dodgy count, now I mustn't write one record to a dummy file, or, I don't have a dodgy count, so I must write one record to a dummy file" and then the empty/non-empty OUTFIL file will get a non-zero RC (four or 12, sorry about that). |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
@ramsri,
You simply MUST stop using really bad terminology.
Syncsort DOES NOT EVER set MAXCC. Ever.
As you continue to use bad terminology all you do is cause lost time when people try to help you. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|