View previous topic :: View next topic
|
Author |
Message |
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Hi all,
I am trying to access a KSDS file sequentially.
How do i use UPDATE option on READNEXT command in CICS?
Can somebody provide me the syntax.
It throws me token not found error.
Thanks,
Marina. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Perhaps if you provided the actual CICS statements you're using first .... |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Below is the code snippet i have been using.
It throws me token not found error.
EXEC CICS READNEXT
DATASET('KSDS')
INTO(WS-FILE-VAR)
RIDFLD(WS-EMPNO)
UPDATE
RESP(WS-RESP-CODE)
END-EXEC.
/*UPDATING KSDS FILE*/
EXEC CICS REWRITE
DATASET('KSDS')
FROM(WS-FILE-VAR)
RESP(WS-RESP-CODE)
END-EXEC.
Thanks,
Marina. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Don't do this! You may lock-out (deadly embrace) due to the file being in LSR. You need to save the current key, issue an ENDBR, issue a READ for UPDATE then a REWRITE, then take the saved-key, move the last byte to a the last byte of a redefined binary-fword (clears it to LOW-VALUES first), add 1, then move this updated last byte to the last byte of the saved-key. Now, issue a STARTBR (using the saved-key) and it should point you to the next record or you'll get a NOTFND, which means EOF. You can really mess up the CRP (current record pointer) if you don't follow similar steps.
Browses can be notoriously inefficient, but with the help of LSR, the non-efficiency level is reduced.
When a "Browsed" file is defined to LSR, the "QR" TCB can do other work while the browsing is occurring. However, when the file is NOT defined to LSR (known as NSR), the "QR" must wait until the Browsing has completed and if the browsing tales a while, you could back up tasks waiting to be dispatched and you DO NOT want to do this. |
|
Back to top |
|
|
Earl Haigh
Active User
Joined: 25 Jul 2006 Posts: 475
|
|
|
|
Quote: |
It throws me token not found error |
please post the error you are receiving that says token not found, never heard of this condition in a CICS read.
In addition, in the Mainframe world, we normally use the
term "returns error", not "throws error" |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Hi all,
I have a doubt regarding browsing in ESDS file.
In the examples I see they are moving LOW-VALUES to the RIDFLD before using STARTBR.
MOVE LOW-VALUES TO ESDS-KEY.
EXEC CICS STARTBR
DATASET(‘ESDS’)
RIDFLD(ESDS-KEY)
RBA
This means they are starting from the beginning of the file.
Is it allowed to position elsewhere say for eg:- at the 5th record or do we always have to start from the beginning of the file.
MOVE 5 TO ESDS-KEY
EXEC CICS STARTBR
DATASET(‘ESDS’)
RIDFLD(ESDS-KEY)
RBA
Thanks,
Marina. |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Hi all,
I have a doubt regarding browsing in ESDS file.
In the examples I see they are moving LOW-VALUES to the RIDFLD before using STARTBR.
MOVE LOW-VALUES TO ESDS-KEY.
EXEC CICS STARTBR
DATASET(‘ESDS’)
RIDFLD(ESDS-KEY)
RBA
This means they are starting from the beginning of the file.
Is it allowed to position elsewhere say for eg:- at the 5th record or do we always have to start from the beginning of the file.
MOVE 5 TO ESDS-KEY
EXEC CICS STARTBR
DATASET(‘ESDS’)
RIDFLD(ESDS-KEY)
RBA
Thanks,
Marina. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
What did the manual (link at the top of the page) tell you? |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
There no examples or code snippets in the manual.
Its just explanations.
In case someone has had previous experience they would ahve a better idea about this.
Thanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I thought the CICS Language Reference manual was pretty clear:
Quote: |
STARTBR specifies the record in a file, or in a data table, on a local or a remote system, where you want the browse to start. No records are read until a READNEXT command (or, for VSAM and tables, a READPREV command) is executed.
A browse operation, where direct means browse of the base data set (using the primary key), may be:
* A direct browse of a key sequenced data set (KSDS or data-table) by record key.
* A direct browse of an entry sequenced data set (ESDS) by relative byte address (RBA). |
You cannot give it record number for ESDS but you can give it RBA. If your ESDS is fixed length, finding the RBA becomes multiply record number desired by record length and adjust for offset. If the ESDS is variable length, then you may have to experiment some to see how it works. |
|
Back to top |
|
|
|