Hi ,
I have an input PS : having the following details
Code:
011D M ABC
011D M DEF
011D M 124
I need to retrevie only the third record as it has numeric input at '124' but the copybook declaration for the field is characters. Can we write a sort to retreive only records consisting of numeric data at the position mentioned ?
I used the below sort but it did not serve the purpose
SORT FIELDS=COPY
INCLUDE COND=(46,3,FS,EQ,NUM)
Please guide me on this
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
Quote:
I used the below sort but it did not serve the purpose
does not really help- explains nothing.
are you sure that 46 for 3 is the correct positioning?
according to your layout, it is 41 for 3.
is the file fixed or variable length?
if it is var, then it would be 45 for 3. +4 for the RDW
INCLUDE COND=(41,3,CH,GE,C'000',AND,41,3,CH,LE,C'999')
with that condition something like '0AB' would pass,
remember ... '000' < '0AB' < '999'
using this approach You should check each column
(41,1,CH,GE,C'0',AND,41,1,CH,LE,C'9',AND,42,1,CH,GE,C'0',AND,42,1,CH,LE,C'9',AND,43,1,CH,GE,C'0',AND,43,1,CH,LE,C'9')
my post does not relate to the best way of solving the issue with sort,
just points out a logic flaw