View previous topic :: View next topic
|
Author |
Message |
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Hi experts,
I have a requirement for a record read as below.
I have a VSAM KSDS file defined with keys and non key area as shown.
Code: |
Pharm Subs DOB(Key) Mem Claim(Non Key)
ID(Key) ID(Key) Name(NonKey)
FASW 1234563 19870808 Kris Ramin 4767DD
FASW 1234563 19870808 Kris Ramin HGHJS665
FASW 1234563 19870808 Kris Ramin 879234
FASW 7666668 19990101 Don Fisher 5346SDF
FASW 7666668 19990101 Don Fisher 2355
FASW 7666668 19990101 Don Fisher 3244 |
What would be the fastest way (In terms of computing/CPU time) to access the first record of the set with Keys starting with
"FASW 7666668", I mean basically I am trying to point to the record
Code: |
"FASW 7666668 19990101 Don Fisher 5346SDF" |
but I do not have information about the 3rd part of the key, i.e date of birth. Is there a way I can directly point to that record without sequentially going through the records ?
Please help. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You did not bother to mention if you are using CICS or batch, nor which programming language (if any) you are using.
Depending upon these details, USUALLY the easiest way would be to do a generic key read (which works in batch and CICS albeit a bit differently) on the Pharm ID and Subs ID. A generic key read starts from the first byte of the key but does NOT include the entire key -- it could include all but 1 byte of the key, or all but 6 bytes of the key or even just the first byte of the key -- but a generic key read MUST start with the first byte of the key (so if you wanted to pull records by Subs ID and DOB, a generic key read could not be used).
And in these days where tens to hundreds of millions of lines of code get executed per second of CPU time, the ONLY time to working about "computing/CPU time" is when you have discovered you have a performance issue -- such as batch work not being completed in the batch window. Most of the time, the code has to be executed millions to billions of times to identify any difference in CPU time between two methods. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Thanks for the reply.
Sorry for not mentioning the details. I am using CICS and language is COBOL.
And I missed to mention an important point in my post. Basically I know only the subscriber ID of the first set of the record i.e 1234563. But I do not have any information about the 2nd subscriber ID to which I actually want to point to, i.e is the one with 7666668.
Please help.
Please let me know since this is slightly different from the requirement I mentioned originally, do i need to raise a new post ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
So do a generic key read on the Pharm ID -- which you DO know, right? Save the first Sub ID in WORKING-STORAGE. Keep reading records, comparing each Sub ID to your saved value. When they are not the same, you have found the second Sub ID. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Thanks Again. But I also wanted to minimize the sequential read of the records. Here until I reach the second sub ID, I am reading the records one by one right ?
Something just came to my mind now. Instead of above, if I populate the PHARM ID as FASW and the SUB ID as 1234563 and then move high-values to rest of fields and do a GTEQ CICS read will it point me to the last record of the 1st set ? So If I do one more READNEXT will I reach the first record of FASW 7666668 set ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Yes, you are reading records sequentially but presumably not nearly as many.
And using HIGH-VALUES with GTEQ will, generally, work -- but you'll need to ensure there's a group level to receive the HIGH-VALUES or none of the elementary variables are defined as numeric since HIGH-VALUES cannot be used with numeric variables. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Thanks a lot Bob. Will try it out. |
|
Back to top |
|
|
|