I need to search for a Packed Decimal value in RRDS file. That value can appear in multiple position in one record as the record consists of multiple occurrences of one copybook.
I know to search PD values by using SORT card for a given position as :
INCLUDE COND=(1,8,PD,EQ,235109261000026)
SORT FIELDS=COPY
I was also trying to use SS (Substring search), but it is not useful for Pack Decimal values.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
So, your comp-3 is signed. If you are not interested in -ve values, and no "F" in the signs...
Modify Frank's code
Code:
OPTION COPY
INCLUDE COND=(1,80,SS,EQ,X'211111111000026C',OR,
1,80,SS,EQ,X'???????????000026C',OR,
1,80,SS,EQ,X'222222222000026C')
For as many as necessary.
If this is an investigation, (ie, not going blindly into another program) I'd suggest
Code:
OPTION COPY
INCLUDE COND=(1,80,SS,EQ,X'000026C',OR,
1,80,SS,EQ,X'000026F',OR,
1,80,SS,EQ,X'000026D')
If all the fields you are searching for end in the same value. Remember, possible to pick up others in error. Then you can match what is picked against your list, plus you cover the "unsigned" and "negative" as well, just in case.
kapiltamrakar,
Are the search values static? Meaning, are you trying to read search values from a file or is this some kind of predefined constant values ?
Bill,
Frank provided what OP asked for based on OP's sample code or rather trying to clarify that SS works for hex values as well. OP didn't mention if the values would flow from input file or not. If indeed OP wants to pass search values from the input file (based on cobol layout he provided), the above solutions won't work.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Quote:
I need to search for a Packed Decimal value in RRDS file. That value can appear in multiple position in one record as the record consists of multiple occurrences of one copybook.
So, I assume there can be multiple instances of this layout on the same physical record.
Subject to amending search length for actual file, Frank showed a method to INCLUDE the records in which the "string of hex characters", which happened to represent the packed-decimal value being searched for, occured anywhere within the range to be searched.
From the look of the data provided, I suggested a method which was more inclusive for the search, based on Frank's code, by which might be found records which are "needed" but not on the list of needed records, including covering the possibilities, as suggested by Frank, of different sign values in the packed-decimal field.
TS/OP hasn't been clear. What I assumed was that there are records, with multiple occurences of the copybook later provided, whereby the value being searched for could be in any one of a number of places. SS had been attempted with PD, Frank pointed out how to use SS in such a situation, and I went with that and what I could understand of the requirement.
Unless I have wildly misunderstood TS/OP (can happen), I don't see what shouldn't work. Certainly not a full/complete solution, as we have no full/complete idea of what TS/OP wants, but I think a basis for his solution at the very least.