View previous topic :: View next topic
|
Author |
Message |
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 , 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 |
|
|
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
|
|