So you mean to say if i use in the below format , this will work ?
SORT FIELDS=COPY
INCLUDE COND=((4,1,BI,EQ,1),OR,
(4,1,BI,EQ,2),OR,
(4,1,BI,EQ,3),OR,
(4,1,BI,EQ,4),OR,
(4,1,BI,EQ,5))
The input file has the data in COMP format . This is a 9 byte field that has been declared as S9(9) COMP . So it would occupy 4 bytes . I want to extract records that end with 1, 2,3,4,5 in the 9th position
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Syntactically it is correct, but you haven't given enough information to know if it will work.
S9(9) isn't nine bytes, it is nine digits. The S means it has been defined as signed. Can it contain a negative value? If yes, then do you want those negative values to be included as well?
Code:
000000005
000000015
For the first of those, the fourth byte will be X'05', so it will be INCLUDEd. For the second, it will be X'0F', so won't be INCLUDEd.
Do you have some sample values of the entire four-byte field?
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
If you are looking to extract records with binary fields using decimal numbers, I would think you need to get DFSORT to convert the number from BI to ZD before you extract based on the ZD field in position 9. Do this as an extension of the input record and drop the extension on output.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
For variable-length records you should do the extension at the beginning of the record, else all your variable-length records will become fixed-length records which happen to have an RDW.
It doesn't matter what order you put the commands in, DFSORT will always process them in its own order. INCLUDE/OMIT COND= comes before INREC.
There is no need to store all nine digits. If you have a sequence of numbers, test for the sequence, not individually.
I tried this , but something is wrong in my coding , . I am getting the below error .
Code:
SYSIN :
INREC BUILD(1,4,15,4,BI,TO=ZD,LENGTH=1,9)
SORT FIELDS=COPY
OUTFIL INCLUDE=((9,1,CH,EQ,C'1'),OR,
(9,1,CH,EQ,C'2'),OR,
(9,1,CH,EQ,C'3'),OR,
(9,1,CH,EQ,C'4'),OR,
(9,1,CH,EQ,C'5'))
BUILD=(1,4,10500)
*
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Can you let me know what is wrong in my statement ?
Nope , it not working . i am still seeing all the records .
19th is the relative position (15 + 4 bytes)
SYSIN :
INREC BUILD(1,4,19,4,BI,TO=ZD,LENGTH=1,9)
SORT FIELDS=COPY
OUTFIL INCLUDE=((5,1,CH,EQ,C'1'),OR,
(5,1,CH,EQ,C'2'),OR,
(5,1,CH,EQ,C'3'),OR,
(5,1,CH,EQ,C'4'),OR,
(5,1,CH,EQ,C'5')),
BUILD=(1,4,10500) ----------> 10500 is the total length of the record
WER108I SORTIN : RECFM=V ; LRECL= 10500; CISIZE = 12288
WER073I SORTIN : DSNAME=INPUT.FILE.VB
WER257I INREC RECORD LENGTH = 10501
WER110I SORTOUT : RECFM=VB ; LRECL= 10504; BLKSIZE= 27998
WER074I SORTOUT : DSNAME=OUTPUT.FILE.EXTRACT
WER405I SORTOUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER054I RCD IN 1512850, OUT 1512850