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: 78
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: 7236

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: 1610
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: 78
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: 1610
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: 331
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 Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm
No new posts TXT2PDF problem - printing @ in PDF vipul65 All Other Mainframe Topics 9 Thu Aug 25, 2016 12:48 am


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