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

Problem in READNEXT


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

New User


Joined: 05 Nov 2014
Posts: 95
Location: India

PostPosted: Wed Mar 16, 2016 12:06 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Mar 16, 2016 12:47 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 16, 2016 5:11 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Mar 17, 2016 9:10 pm
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: 95
Location: India

PostPosted: Fri Mar 18, 2016 5:41 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Mar 18, 2016 8:52 pm
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: 446
Location: USA

PostPosted: Fri Mar 18, 2016 9:41 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top