View previous topic :: View next topic
|
Author |
Message |
vmj
New User
Joined: 16 May 2006 Posts: 16 Location: Philippines
|
|
|
|
Hi all,
I'm having a problem with STARTBR and READNEXT.
I'm reading a file that have a key structured like this.
AAA001
AAA002
AAB001
BBA001
BBC001
BBC002
BBC003
DEF001
DFF001
ZZZ001
I want to display records starting with 'B' onwards, On STARTBR, my RIDFLD is 'B', i verified this using CEDF. On READNEXT, it's supposed to read record 'BBA001', instead it reads record 'AAA001', verified this again using CEDF. No other processing was done in between STARTBR and READNEXT.
Why is that?
I coded that section like this.
Code: |
Perform 1100-STARTBR thru 1100-EXIT.
Perform 1200-READNEXT thru 1200-EXIT until SCREEN-FULL.
Perform 1300-END-READ thru 1300-EXIT.
1100-STARTBR.
EXEC CICS
STARTBR
FILE ('FILEA')
RIDFLD(WS-KEY)
KEYLENGTH(10)
RESP(WS-RESP-CODE)
RESP2(WS-RESP2-CODE)
LENGTH(FILE-LEN)
GENERIC
END-EXEC.
PERFORM 1800-CHECK-RESPONSE THRU 1800-EXIT.
1100-EXIT.
EXIT.
1200-READNEXT.
EXEC CICS
READNEXT
DATASET ('FILEA')
INTO(FILEA-FLE)
RIDFLD(FILEA-KEY)
KEYLENGTH(61)
LENGTH(FILE-LEN)
RESP(WS-RESP-CODE)
RESP2(WS-RESP2-CODE)
GENERIC
END-EXEC.
PERFORM 2350-PROCESS THRU 2350-EXIT.
1200-EXIT.
EXIT. |
I know that this code works because i've already use this on another program, the only difference with that program that i can see is the key that it reads, the keys are numeric, while in this new program the keys are Alphanumeric.
I tried searching this forum and found this thread
www.ibmmainframes.com/viewtopic.php?t=46733
unfortunately, it didn't answer my questions.
I'm hoping someone here knows the answer and a workaround. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
There might be a slight problem in your code:
Code: |
EXEC CICS
STARTBR
FILE ('FILEA')
RIDFLD(WS-KEY)
KEYLENGTH(10) |
and
Code: |
EXEC CICS
READNEXT
DATASET ('FILEA')
INTO(FILEA-FLE)
RIDFLD(FILEA-KEY)
KEYLENGTH(61) |
Let's see ... you are using a different key, a different key length ... wanna bet CICS is doing an implied ENDBR since you totally changed the way you're accessing the file? In which case the READNEXT will return whichever record FILEA-KEY is pointing to (if it is LOW-VALUES, that could be the first record in the file). I'm not able to verify this in the manual right now but you could easily enough find out for sure. |
|
Back to top |
|
|
vmj
New User
Joined: 16 May 2006 Posts: 16 Location: Philippines
|
|
|
|
Let me add that i remove GENERIC from STARTBR to enable READPREV, but when doing READPREV, suppose my RIDFLD from STARTBR is 'BBA001', the program response a 'NOTFND' code, which is not what it's suppose to do. Right?
Hi Robert,
By removing the GENERIC from STARTBR, i'm able to supply the correct KEYLENGTH, 61, of the file in STARTBR, which is the same in the READNEXT.
I just tried it and it behave just the same.
Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you make the correction Robert posted (you are using a different key, a different key length ... ) and run the program again.
Post back if the corrected code still behaves unexpectedly. |
|
Back to top |
|
|
vmj
New User
Joined: 16 May 2006 Posts: 16 Location: Philippines
|
|
|
|
Thank you very much guys! My mistake, i now realize the fault .
You all are great HELP. Thank you |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
We all make mistakes - sometimes we get too close to the situation and another pair of eyes helps. . .
Good luck,
d |
|
Back to top |
|
|
|