Hi All,
I have a VB, LRECL=27989 record which contain a string X'0908'. The string may occur multiple times in a record or may not present, its also not in a fixed position in the record..
I want to copy the partial record after the occurrence of this string and the next 2 bytes should be 01,02,03,04 or 05.
I have copied the partial record after the first occurrence of the string but not able to check the next 2 bytes.
Below SORT CARD is to COPY
from 6th to 5 bytes then
from 18th to 5 bytes then
from 31st to 2 bytes then
158 bytes after the first occurrence of string X'0908'.
SORT FIELDS=COPY
INCLUDE COND=(1,27989,SS,EQ,X'0908')
INREC PARSE=(%01=(STARTAFT=X'0908',FIXLEN=158)),
BUILD=(6,5,18,5,31,2,%01)
Could you please suggest how to check 2 bytes after I find the string, if the 2 bytes does not match then I should search next occurrence of the string in record and then check 2 bytes.
Please let me know if you need more information.
Thanks
Husen
//*====================================================================
//SORT0908 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD *
?????AAAAA???????BBBBB????????CC?? 01-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1
?????AAAAA???????BBBBB????????CC?? X1-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? 02-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-
?????AAAAA???????BBBBB????????CC?? X2-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? 03-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3
?????AAAAA???????BBBBB????????CC?? X3-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? 04-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-
?????AAAAA???????BBBBB????????CC?? X4-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BA
?????AAAAA???????BBBBB????????CC?? 05-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5
?????AAAAA???????BBBBB????????CC?? X5-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-B
?????AAAAA???????BBBBB????????CC?? 06-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-
?????AAAAA???????BBBBB????????CC?? X6-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-
?????AAAAA???????BBBBB????????CC?? 07-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7
?????AAAAA???????BBBBB????????CC?? X7-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? 08-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-
?????AAAAA???????BBBBB????????CC?? X8-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BA
?????AAAAA???????BBBBB????????CC?? 09-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9
?????AAAAA???????BBBBB????????CC?? X9-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-B
?????AAAAA???????BBBBB????????CC?? 10-10-10-10-10-10-10-10-10-10-10-10
?????AAAAA???????BBBBB????????CC?? X0-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-
?????AAAAA???????BBBBB????????CC?? 11-11-11-11-11-11-11-11-11-11-11-1
?????AAAAA???????BBBBB????????CC?? 1X-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC??||01-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1
?????AAAAA???????BBBBB????????CC??||X1-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? ||02-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-
?????AAAAA???????BBBBB????????CC?? ||X2-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? ||03-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3
?????AAAAA???????BBBBB????????CC?? ||X3-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? ||04-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-
?????AAAAA???????BBBBB????????CC?? ||X4-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BA
?????AAAAA???????BBBBB????????CC?? ||05-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5
?????AAAAA???????BBBBB????????CC?? ||X5-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-B
?????AAAAA???????BBBBB????????CC?? ||06-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-6-
?????AAAAA???????BBBBB????????CC?? ||X6-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-
?????AAAAA???????BBBBB????????CC?? ||07-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7
?????AAAAA???????BBBBB????????CC?? ||X7-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
?????AAAAA???????BBBBB????????CC?? ||08-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-8-
?????AAAAA???????BBBBB????????CC?? ||X8-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BA
?????AAAAA???????BBBBB????????CC?? ||09-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9-9
?????AAAAA???????BBBBB????????CC?? ||X9-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-B
?????AAAAA???????BBBBB????????CC?? ||10-10-10-10-10-10-10-10-10-10-10-10
?????AAAAA???????BBBBB????????CC?? ||X0-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD-
?????AAAAA???????BBBBB????????CC?? ||11-11-11-11-11-11-11-11-11-11-11-1
?????AAAAA???????BBBBB????????CC?? ||1X-BAD-BAD-BAD-BAD-BAD-BAD-BAD-BAD
//*
//SORTOUT DD SYSOUT=*
//*--------------------------------------------------------------------
//SYSIN DD *
INCLUDE COND=(1,80,SS,EQ,X'0908') GET RID IF THOSE NOT X'0908'
INREC PARSE=(%01=(STARTAFT=X'0908',FIXLEN=158)),
BUILD=(6,5,
18,5,
31,2,
%01) WHOLE PART AFTER X'0908'
SORT FIELDS=COPY
OUTFIL INCLUDE=(13,2,CH,EQ,L(C'01', GET RID OF THOSE NOT '01'-'11'
C'02',
C'03',
C'04',
C'05',
C'06',
C'07',
C'08',
C'09',
C'10',
C'11'))
//*
//*====================================================================