View previous topic :: View next topic
Author
Message
Roy Ware New User Joined: 19 Sep 2013Posts: 14 Location: USA
I'm using SyncSort and have come across something I need but cannot seem to get correct.
Code:
SORT FIELDS=(0110,18,CH,A, POLICY-NUMBER
0128,04,PD,A) RINK-DATE
OUTFIL INCLUDE=(098,02,BI,EQ,X'010C', EXTRACT-CODE
AND,005,02,CH,EQ,C'01') W-DOCUMENT-CODE
OPTION VLSHRT,SIZE=E70000000,EQUALS
/*
The SORT FIELDS works, but it seems like the INCLUDE is ignored. Checking with FileAid, I should have an output file consisting of about 20,000 records. Instead, I end up with the original file's 300,000 records.
I RTFM, but couldn't find a multiple condition example for wither INCLUDE or OMIT. Does anyone have any suggestions?
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
First, it makes sense to ignore unneeded records BEFORE sorting them. Use initial INCLUDE COND= statement, instead of INCLUDE= parameter of OUTFIL statement.
Next, there is no such thing as "multiple condition", at least in SORT utilities.
There is ALWAYS a single condition which may consist of complex logical expression: mainly with AND/OR logical operators.
Verify more carefully your specified fields offset, and stored values.
Take care of RECFM=VB (it shifts all fields 4 bytes to the right).
There are no such things as miracles.
Back to top
Roy Ware New User Joined: 19 Sep 2013Posts: 14 Location: USA
Ach! Come on, lad! All of mainframe programming is basically believing in miracles! (Just ask those Java nuts!).
But seriously, your solution was perfect. I forgot to put the include before the sort.
Thank you for your help.
Now to figure out how to delete a duplicated post......
deleted
Back to top
Roy Ware New User Joined: 19 Sep 2013Posts: 14 Location: USA
This is getting to the point of hari kari.
Here's what I have in my Job results:
Code:
SORT FIELDS=(0110,18,CH,A,
0128,04,PD,A)
INCLUDE COND=(005,02,CH,EQ,C'01',
AND,098,02,BI,EQ,X'010C')
OPTION VLSHRT,SIZE=E70000000,EQUALS
RCD IN 909263, OUT 0
According to FileAid, these are my fields:
Code:
W-DOCUMENT-CODE EXTRACT-CODE
2/AN 2/PS
(1-2) (94-95)
My JCL is
Code:
//TSO3972S JOB (20,49),'REW',NOTIFY=TSO3972,
// MSGCLASS=Q,CLASS=A,MSGLEVEL=(1,1)
//SORT01 EXEC PGM=SORT,PARM='SIZE=MAX'
//SYSUDUMP DD SYSOUT=Y
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,
// DSN=AT.REW.#090.PAP080.OTHERS.D080917.ORIG
//SORTOUT DD DSN=RT.REW.#030.AGB2000C.ORIG.FILE.SORT(+1),
// DISP=(,CATLG,DELETE),DATACLAS=DAILY
//* SPACE=(TRK,(0800,0800),RLSE),UNIT=WORK,
//* DISP=(,CATLG,DELETE)
//SYSIN DD DISP=SHR,DSN=CHG.AGT1.STAGE.#000003.CTC(AGB2000C)
OMIT COND=(005,02,CH,NE,C'01', W-DOCUMENT-CODE
AND,098,02,BI,NE,X'010C') EXTRACT-CODE
SORT FIELDS=(110,18,CH,A, POLICY-NUMBER
128,04,PD,A) RINK-DATE
OPTION VLSHRT,SIZE=E70000000,EQUALS
//*
I get the same results if I swap the INCLUDE with the SORT. Oh yeah - on the latest test, I tried OMIT with the same results.
What am I doing wrong???
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
In FileAid, verify not only the format/position of your input fields, but their actual values (in HEX).
Present here real values found in your file via FileAid.
While it's not clear yet, run your test with reduced input file (or, at least, use STOPAFT=nn parameter)
Back to top
Roy Ware New User Joined: 19 Sep 2013Posts: 14 Location: USA
That did the trick!
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2023 Location: USA
BTW: when switching between INCLUDE/OMIT, don't forget to change AND/OR, too!
Be careful about logical expressions.
Back to top
Please enable JavaScript!