|
View previous topic :: View next topic
|
| Author |
Message |
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
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.
Kapil |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
kapiltamrakar,
It would help you if have posted the cobol layout of the file and where you plan to search. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| I was also trying to use SS (Substring search), but it is not useful for Pack Decimal values. |
Not completely true. SS allows hex values, so if your PD values use an F or C for the plus sign, you could use a DFSORT statements like this:
| Code: |
OPTION COPY
INCLUDE COND=(1,80,SS,EQ,X'235109261000026C',OR,
1,80,SS,EQ,X'235109261000026F')
|
|
|
| Back to top |
|
 |
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
Hi Skolusu and Frank Yaeger,
Thanks for your replies.
The COBOL LAYOUT is as below
| Code: |
05 KEY.
07 TIN PIC S9(15) PACKED-DECIMAL.
05 CONTROL-GROUP.
07 LOGICAL-DELETE PIC X(1).
88 LOGICALLY-DELETED VALUE 'Y'.
07 NUMERIC-FILL PIC 9(3). |
...
..
I want to search in field "TIN" which is as key for the file.
the example of values which i want to search are as follows :
211111111000026
222222222000026
etc.
Regards,
Kapil |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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.
Thanks, |
|
| Back to top |
|
 |
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
Hi Skolusu , Frank Yaeger and Bill Woodger,
I am Able to get which i was looking for.
Thank You
Regards,
Kapil. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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. |
| Quote: |
| Code: |
05 KEY.
07 TIN PIC S9(15) PACKED-DECIMAL.
05 CONTROL-GROUP.
07 LOGICAL-DELETE PIC X(1).
88 LOGICALLY-DELETED VALUE 'Y'.
07 NUMERIC-FILL PIC 9(3). |
|
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.
If it is no use, TS/OP will be back, I guess. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|