Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

STARTBR and READNEXT problem

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: STARTBR and READNEXT problem
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
http://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: 8120
Location: East Dubuque, Illinois, USA

PostPosted: Thu Apr 22, 2010 8:24 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Apr 22, 2010 8:35 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Apr 22, 2010 9:36 am    Post subject: Reply to: STARTBR and READNEXT problem
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts CICS Question RE: Browse, Readnext an... moezbud CICS 7 Sun Mar 05, 2017 5:45 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us