View previous topic :: View next topic
|
Author |
Message |
Arun bv
New User
Joined: 29 Dec 2010 Posts: 41 Location: Mumbai
|
|
|
|
when i read a vsam file using partial key in batch program it is showing record not found,but records were actually present in that Vsam file.
it has composite key having six fields and i intialized whole key first ,then populated first field with proper value,for the second field i moved low-values,populated third value,,i didn populate rest as im going to read the file with partial key..
but file status is 23...that is record not found
could anyone guess out on this... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
review a bit Your understanding of partial key
it must be a proper left substring of the full key
so if the full key is ABCDE You can start <browsing> using ...
A, AB, ABC, ABCD
using the three char case and _ as a low value You are trying to start browsing with A_C
and since that is not a proper left substring a NRF is what You get! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
When you say "read", do you mean START and READ NEXT? If you do, you will still get not found if the key for the START is higher than the last record on the file. |
|
Back to top |
|
|
Arun bv
New User
Joined: 29 Dec 2010 Posts: 41 Location: Mumbai
|
|
|
|
thanks enrico....
here the requirement is ,i wont know B,E,F in ABCDEF key....
so i have moved low-values to the whole key first...then i populated the fields which i have(i.e., populated A_CD__ in ABCDEF key) ....then read,,,,
so how to handle this case... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
START with A______. READ NEXT in a loop. Bytes 3-4 higher than part-of-key-you-know, stop, equal process and read next, lower, read next. |
|
Back to top |
|
|
Arun bv
New User
Joined: 29 Dec 2010 Posts: 41 Location: Mumbai
|
|
|
|
sry i forgot to mention
START GRP-V KEY >= GR-KEY
READ GRP-V
then read with partial key(in GR-KEY) ..... |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
Or stop for a few times and ask yourself : create - you or someone from design - alternate indexes if application requires that approach.
Data must be correctly placed to serve processes. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
so i have moved low-values to the whole key first...then i populated the fields which i have(i.e., populated A_CD__ in ABCDEF key) ....then read,,,, |
retelling what You have done, will not fix a broken approach! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Arun bv wrote: |
sry i forgot to mention
START GRP-V KEY >= GR-KEY
READ GRP-V
then read with partial key(in GR-KEY) ..... |
Fine, but READ (a keyed read, unrelated to the START,won't work) or READ NEXT, record which is first equal to or greater than the key of the START (having checked file-status of START, of course)? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is also pointless, re-read enrico's post, to set anything other than the left-most part of the key. The "left-most" can be anything, up to and including the entire key, but setting a bit of left-most and then something further off to the right is pointless and will confuse anyone maintaining your program in the future.
For your processing, set the left-most (or high-order) byte (from your example) and leave the rest as low-values. As already stated, do your lower-but-non-contiguous-key processing in a read-next loop. Don't forget file-status on all IO. Including START and READ NEXT. All, means ALL.
If your data is such that an alternate key would help (you or your analyst, immediate senior, whatever have to decide, but it must be a rational decision based on the data, not on trying to make the code in one program easier) then try to process file such that the input is in the same order as the alternate key. |
|
Back to top |
|
|
|