Page 1 of 1

Include And Outrec in Sort

PostPosted: Thu Feb 02, 2017 8:05 pm
by k singh
Hi

I need a little help regarding include and outrec in sort.

R_code  Key1    key2      code1 Value1  code2   value2.............code100  value100
XX      aa      01      10      1.01    11      1.1                 0       0
YY      bb      01      20      3.2     10      6.8                 0       0      
XX      cc      02      0       0       40      4.5                 10      9.8
 

This is my input file. My file has keys and 100 code values(label values) and each parameter is of 10 length, total length is 2030
I need to create an output showing rows where r_code=XX and the corresponding value(N) when code(N) is equal to 10.

Output should be like this
aa~01~1.01
cc~02~9.8

BUt this gives me an error "INCLUDE/OMIT FIELD BEYOND RECORD"
I do understand that OUTREC is executed first and when Include needs to be executed its not able to find.
Any help on how to solve this

INCLUDE COND=(1,10,ch,EQ,C'XX',AND,(31,10,BI,EQ,10,OR,
51,10,BI,EQ,10,OR,71,10,BI,EQ,10,OR,91,10,BI,EQ,10,OR,
111,10,BI,EQ,10,or,131,10,BI,EQ,10,or,
.............................
2011,10,BI,EQ,10))
OPTION COPY
OUTREC IFTHEN=(WHEN=(31,10,BI,EQ,10),
BUILD=(11,10,C'~',21,10,C'~',41,10)),
IFTHEN=(WHEN=(51,10,BI,EQ,10),
BUILD=(11,10,C'~',21,10,C'~',61,10)),
IFTHEN=(WHEN=(71,10,BI,EQ,10),
BUILD=(11,10,C'~',21,10,C'~',81,10)),
...................................
IFTHEN=(WHEN=(2011,10,BI,EQ,10),
BUILD=(11,10,C'~',21,10,C'~',2021,10))

Re: Include And Outrec in Sort

PostPosted: Fri Feb 03, 2017 1:30 am
by k singh
Hi All
I was able to find the issue. Its VB file so some of the records were smaller so that include statement. wrote another job to get rid of smaller record. the above logic worked fine. thanks a lot for your help

Re: Include And Outrec in Sort

PostPosted: Fri Feb 03, 2017 2:43 pm
by willy jensen
perhaps OPTION VLSCMP,VLSHRT would help?