IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

More than 1 Include criteria for single SORTOUT


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Roy Ware

New User


Joined: 19 Sep 2013
Posts: 14
Location: USA

PostPosted: Wed Sep 13, 2017 11:45 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 934
Location: Maryland

PostPosted: Thu Sep 14, 2017 12:27 am
Reply with quote

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
View user's profile Send private message
Roy Ware

New User


Joined: 19 Sep 2013
Posts: 14
Location: USA

PostPosted: Thu Sep 14, 2017 12:32 am
Reply with quote

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......
icon_redface.gif
deleted
Back to top
View user's profile Send private message
Roy Ware

New User


Joined: 19 Sep 2013
Posts: 14
Location: USA

PostPosted: Thu Sep 14, 2017 6:17 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 934
Location: Maryland

PostPosted: Thu Sep 14, 2017 7:56 pm
Reply with quote

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
View user's profile Send private message
Roy Ware

New User


Joined: 19 Sep 2013
Posts: 14
Location: USA

PostPosted: Thu Sep 14, 2017 7:58 pm
Reply with quote

That did the trick!
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 934
Location: Maryland

PostPosted: Thu Sep 14, 2017 8:05 pm
Reply with quote

BTW: when switching between INCLUDE/OMIT, don't forget to change AND/OR, too!

Be careful about logical expressions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts include cond ascii constant DFSORT/ICETOOL 4
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Creating a single-record file with CO... DFSORT/ICETOOL 8
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts Sum based on criteria for each id, ea... COBOL Programming 1
Search our Forums:

Back to Top