IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

STARTBR and READNEXT problem


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vmj

New User


Joined: 16 May 2006
Posts: 16
Location: Philippines

PostPosted: Thu Apr 22, 2010 7:55 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8573
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 22, 2010 8:24 am
Reply with quote

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
View user's profile Send private message
vmj

New User


Joined: 16 May 2006
Posts: 16
Location: Philippines

PostPosted: Thu Apr 22, 2010 8:28 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19245
Location: Inside the Matrix

PostPosted: Thu Apr 22, 2010 8:35 am
Reply with quote

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
View user's profile Send private message
vmj

New User


Joined: 16 May 2006
Posts: 16
Location: Philippines

PostPosted: Thu Apr 22, 2010 9:03 am
Reply with quote

Thank you very much guys! My mistake, i now realize the fault icon_redface.gif .

You all are great HELP. Thank you icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19245
Location: Inside the Matrix

PostPosted: Thu Apr 22, 2010 9:36 am
Reply with quote

You're welcome icon_smile.gif

Quote:
My mistake
We all make mistakes - sometimes we get too close to the situation and another pair of eyes helps. . .

Good luck,

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts problem in select max when executing ... IMS DB/DC 6
No new posts Sysncsort - Justification problem SYNCSORT 6
No new posts E1BRESP 22 while doing readnext CICS 2
No new posts Problem getting record length of a re... COBOL Programming 2
No new posts Problem while trying to manipulate re... DFSORT/ICETOOL 3
Search our Forums:

Back to Top