Page 1 of 1

Binary fields in Sort

PostPosted: Fri Aug 15, 2014 12:15 am
by kjd2121
Hi,

I am new to the forum and have a Sort question.

My input file is VB and the field I need to query is in col 30-31 as follows -
3-
F-
3-
00
0A
..
02
04
..
00
0A

I am trying to split the file based on the value in columns 30-31 - either a value of 10 or 36.

The COBOL field definition is RECORD-TYPE PIC S9(04) COMP.

I believe this is a BI field for Sort.

Here is my code:

SORT FIELDS=COPY

OUTFIL FILES=01,
INCLUDE=(34,2,BI,EQ,X'00001010')

OUTFIL FILES=02,
INCLUDE=(34,2,BI,EQ,X'00100100')

This does not work. I have tried other variations and have failed.

How can I code this to get two output files - One with records that have a 10 in byte 30 and one with records that have a 36 in byte 30?

Thank you.

Re: Binary fields in Sort

PostPosted: Fri Aug 15, 2014 1:58 am
by BillyBoyo
Your binary constant is only one byte long, and you are comparing it to two bytes.

If you want the value that is in byte 35 only, irrespective of what is in byte 34 (the first byte of the COBOL definition) then use 31,1,CH with the X'....', or 35,1,Bi,EQ,10 and 35,1,BI.EQ,36. If you need the value in the two-byte field, 34,2,BI,EQ,10 and 34,2,BI,EQ,36.

Re: Binary fields in Sort

PostPosted: Fri Aug 15, 2014 2:08 am
by kjd2121
Billy,

Seems that was one of the combinations I didn't try. It worked like a miracle :)

Thank you.