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

UPDATE option on READNEXT command in CICS


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

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Jun 19, 2009 5:27 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Jun 19, 2009 5:33 pm
Reply with quote

Perhaps if you provided the actual CICS statements you're using first ....
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Jun 19, 2009 5:38 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 19, 2009 6:00 pm
Reply with quote

this link which is the syntax and this link explains the TOKEN keyword and the definition of data-area and its use.

possibly that is your problem. if so, you will need to modify your REWRITE.
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: Fri Jun 19, 2009 8:38 pm
Reply with quote

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
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Sat Jun 20, 2009 10:24 am
Reply with quote

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
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Thu Jun 25, 2009 5:09 pm
Reply with quote

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
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Thu Jun 25, 2009 5:09 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 5:27 pm
Reply with quote

What did the manual (link at the top of the page) tell you?
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Thu Jun 25, 2009 5:32 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 5:43 pm
Reply with quote

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
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 RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top