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
 

 

Problem in READNEXT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
amitc23

New User


Joined: 05 Nov 2014
Posts: 79
Location: India

PostPosted: Wed Mar 16, 2016 12:06 pm    Post subject: Problem in READNEXT
Reply with quote

Hi
I am getting slight problem in EXEC CICS READNEXT. I am reading a file from start and reading upto 50 records (If there are more than 50) and sending them out through MQ. The receiving system in turn sends me back the last record it has received and i start reading after that and again send 50 records until all the records have been sent.

For this initially I am getting a record with keys as zeroes from the external system and I am doing a STARTBR on my file with that key , followed by READNEXT.

But for the second time when I recieve the key of the 50th record sent, I am following the same STARTBR and READNEXT, but it reads the 50th record again and sends back, so effectively sending the 50th record twice.

As a workaround , currently I am adding 1 to the key when i get it ( first time and subsequent times ) , but that does not look good to me.

Is there any other method I can achieve this. This is a CICS VSAM file with keylength 35.

Thanks
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Mar 16, 2016 12:47 pm    Post subject: Reply to: Problem in READNEXT
Reply with quote

You have a "guessed" key-value (which won't be on the file) and an actual key-value (which will). You need "current request not equal to intial request guessed key" and do something different. It doesn't especially matter what, as long as it is clear why.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 16, 2016 5:11 pm    Post subject: Reply to: Problem in READNEXT
Reply with quote

I'm confused. When you receive your second set of keys, is this a new task or the same task? If it's the same task, you don't need another STARTBR, just continue with a REANEXT until your next set of keys or EOF. Internally, VSAM is keeping the CRP (Current Record Pointer) for you.

Have your SYSPROG define a suitable LSR Pool for this file, regardless.

Long Browses on NSR (non-LSR) Files can be unsuitable for the QR-TCB, which can cause a monopoly.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1695
Location: NY,USA

PostPosted: Thu Mar 17, 2016 9:10 pm    Post subject:
Reply with quote

Quote:
When you receive your second set of keys, is this a new task or the same task?

I don't think TS will hold RETURN for that long icon_smile.gif, but We don't know for sure.
Please double check this and see if this is relevant for your situation as you did not give us file definitions and keys information completely.
Back to top
View user's profile Send private message
amitc23

New User


Joined: 05 Nov 2014
Posts: 79
Location: India

PostPosted: Fri Mar 18, 2016 5:41 pm    Post subject:
Reply with quote

Hi

I implemented the workaround then, as the task is terminated and started again. I incremented the key by 1 and it seems working fine because that would anyways be the next key value.

Thanks All
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1695
Location: NY,USA

PostPosted: Fri Mar 18, 2016 8:52 pm    Post subject:
Reply with quote

Quote:
I incremented the key by 1
Dangerous thing to do, advise you to spend some time and handle it wisely than a temp fix.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 371
Location: USA

PostPosted: Fri Mar 18, 2016 9:41 pm    Post subject: Reply to: Problem in READNEXT
Reply with quote

The other team is returning you the last processed record (i.e. 50th) and you are doing a STARTBR with that key. I am sure you must be using a GTEQ in STARTBR and then, since that key (i.e. 50th record) is found, you get that record (which is a duplicate to process).
To overcome this you added 1 to the key BUT that is a bad practice.

So, after reading for the first time you should check whether what you received from the other team is equal to what you get after that first READNEXT. If same then skip. And also check that It's not equal to zeroes before skipping, otherwise you won't get the initial record.

.
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 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
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am


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