View previous topic :: View next topic
|
Author |
Message |
ganeshprasanna
New User
Joined: 21 Feb 2009 Posts: 36 Location: South Portland, Maine
|
|
|
|
I have a partial key say:
Code: |
10 WS-KEY.
15 WS-A PIC 9(06)
15 WS-B PIC 9(12)
15 WS-C REDEFINES WS-B
20 WS-C1 PIC 9(06)
20 FILLER PIC X(06)
|
Now i move a value to a ws-a(value found in file). i move "999999999999" to ws-b.
On doing ,
STARTBR -> respcode 0
READPREV -> respcode 13
Again,
STARTBR -> respcode 0
READNEXT -> respcode 0
READPREV -> respcode 0
READPREV -> respcode 0
This fetches the last valid record
Why is that i able to do READNEXT and not a READPREV with the partial key do fetch the last valid record? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What is in WS-A?
If you do not control the value, your process will be out of control. . . |
|
Back to top |
|
|
ganeshprasanna
New User
Joined: 21 Feb 2009 Posts: 36 Location: South Portland, Maine
|
|
|
|
File VALUES
Code: |
WS-A WS-B
1111 111111111111
1111 222222222222
1234 111111111111
1234 222222222222
1234 333333333333
1234 444444444444
5555 111111111111 |
Now ,
With WS-A as 1234 and WS-B as "999999999999", Doing a STARTBR(respcode -> 0)
READPREV (respcode ->13)
Why is this so?
Ideally it should have fetched the record
WS-A 1234 WS-B 444444444444
Can you please help me out? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You are showing 4-digit values but the key is 6.
How is the data stored 001234 or 123400.
You are also intermixing character data with numeric fields. Generally a bad practice. Suggest you move true numeric values to numeric fields rather than alpha characters that happen to contain some numbers.
Suggest you repro the vsam file and look at the actual data and make sure that the way you are looking for data is the same as the way it is stored. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what is the actual code of your STARTBR? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the CICS Application Programming Reference:
Quote: |
If you include a READPREV command immediately following a STARTBR command, your STARTBR command RIDFLD must specify the key of a record that exists on the data set; otherwise the NOTFND condition will occur.
A READPREV command following a READNEXT, or a STARTBR or RESETBR that did not specify a 'last' key value, is treated as though the RIDFLD value had been modified and results in a reposition (as above). |
The manuals are pretty thorough when searched. |
|
Back to top |
|
|
ganeshprasanna
New User
Joined: 21 Feb 2009 Posts: 36 Location: South Portland, Maine
|
|
|
|
Thank you everyone for your valuable inputs. |
|
Back to top |
|
|
ganeshprasanna
New User
Joined: 21 Feb 2009 Posts: 36 Location: South Portland, Maine
|
|
|
|
One last query..
if i move HIGH-VALUES to the complete KEY and then,
STARTBR
READPREV
this works fine. How is this possible?
Is it because STARTBR points at the last record from the file and READPREV reads that last record? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Was the file loaded with a HIGH-VALUES record initially? If so, then the RIDFLD points to a file record and the READPREV would work perfectly fine per the manual quote I posted above. |
|
Back to top |
|
|
ganeshprasanna
New User
Joined: 21 Feb 2009 Posts: 36 Location: South Portland, Maine
|
|
|
|
Yes the file is loaded initially with HIGH-VALUES.
Thanks for your time. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear your questions are resolved. |
|
Back to top |
|
|
|