View previous topic :: View next topic
|
Author |
Message |
rashmirgowda
New User
Joined: 18 Jun 2008 Posts: 25 Location: india
|
|
|
|
Hi,
I am having a VSAM file with the KEY LENGTH of 18.For EG.,the data looks like below:
NA0000010119000198
NA0000010119000199
NA0000010119000200
NA0000010119000201
NA0000010119000202
NA0000010119000203
NA0000010119000204
NT0000010119000001
NT0000010119000002
NT0000010119000003
The first 7 characters will be USER-ID,next 5 characters will be date which will be in julian format and the next 6 characters will be counter
I want to fetch the last record of userid NA00000 directly.I tried by moving HIGH-VALUES to the remaining of the key and issued STARTBR command and READPREV.But i am getting RESP-CD as 16 with GENERIC option.
Code: |
EXEC CICS STARTBR
DATASET ('SHEETS')
RESP (WS-RESP-CD)
RIDFLD (WS-MSKEY)
GENERIC
KEYLENGTH (18)
END-EXEC. |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why not GTE NA0000099999999999 without the GENERIC? |
|
Back to top |
|
|
rashmirgowda
New User
Joined: 18 Jun 2008 Posts: 25 Location: india
|
|
|
|
Hi,
I checked by giving the key as 'NA0000099999999999' in STARTBR and it is successful.But i am getting as Record Not Found error in READPREV inorder to get the last record. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
The CICS manual says ( concerning READPREV ):
"A generic key may not be specified, nor may a browse that was started with the GENERIC option include a READPREV command."
Suggest that you issue a READNEXT immediately following the STARTBR, after which you can then issue the READPREV to retrieve the record you seek. |
|
Back to top |
|
|
rashmirgowda
New User
Joined: 18 Jun 2008 Posts: 25 Location: india
|
|
|
|
Hi,
I have tried with the Generic option in STARTBR by passing the key as 'NA0000099999999999' but getting RESP-CD as 16.
Also tried with using the same key value with GTEQ option in STARTBR is successful and used READNEXT and READPREV immediately. But it is fetching the next record i.e., NT0000010119000001 instead of NA0000010119000204. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
If you do a READNEXT, the READPREV will get that record again. A second READPREV should retrieve the record you want. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
rashmirgowda wrote: |
I tried by moving HIGH-VALUES to the remaining of the key and issued STARTBR command and READPREV.But i am getting RESP-CD as 16 with GENERIC option. |
16 is INVREQ.
Application Programming Reference wrote: |
INVREQ
RESP2 values: 25 - The KEYLENGTH and GENERIC options are specified, and the length defined for the data set to which this file specified in the KEYLENGTH option is greater than or equal to the length of a full key. |
Try reading the manual.
Application Programming Guide wrote: |
To position the browse at the last record in the file, ready for a backward browse, specify a RIDFLD of X'FF' characters. This applies to starting a browse of a KSDS, ESDS, or RRDS. For a standard ESDS, specify the RBA option. For an extended ESDS, specify the XRBA option. For an RRDS, specify the RRN option. |
The above seems to imply no generic, no smaller keylength, followed with a readprev. |
|
Back to top |
|
|
rashmirgowda
New User
Joined: 18 Jun 2008 Posts: 25 Location: india
|
|
|
|
Thanks All, It worked.I have used GTEQ in STARTBR followed by READNEXT and two READPREV. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If you have access to IBM transaction CECI, you can educate yourself regarding CICS commands, options, keywords, etc.
It's hands-on, intuitive (for the most part) and more comprehensive than a manual.
Normally, CECI is only available in non-Production environments.
I would hope this is a true statement in your shop.
Check with your CICS Tech Support and/or CICS Sysprog(s) for access and usage.
You can also find documentation in the current version/release of your CICS Supplied Transactions manual.
Bill |
|
Back to top |
|
|
Rogerio Ferreira Coelho
New User
Joined: 13 Jun 2007 Posts: 11 Location: Sao Paulo - Brazil
|
|
|
|
Hi,
You don't can user GENERIC, do like this sample:
STARTBR
READNEXT
READPREV
READPREV - HERE ARE THE RECORD YOU WANT:
I'm not sure why, but you need do 2 reaprev, after READNEXT
RECORD KEY
SRFA201011601109300070638
SRFA201011601129050070985
SRFA201011601135190071089
SRFA201011601135240071098
SRFA201011601305470071730
SRFA201011601320130072280
SRFA201011601334130072633
SRFA201011601334170072641
SRFA201011601334220072649
SRFA201011800907200009474
SRFA201011801045100010105
SRFA201011801050460010155
STARTBR FILE(SRCSH1) RI(&RI)
STATUS: COMMAND EXECUTION COMPLETE NAME=
EXEC CICS STARTBR
File( 'SRCSH1 ' )
< Sysid() >
RIdfld( 'SRFA2010116011...........' ) The key has completed with x'FF'
< Keylength() < GEneric > >
< REqid( +00000 ) >
< RBa | Xrba | RRn | DEBRec | DEBKey >
< GTeq | Equal >
RESPONSE: NORMAL EIBRESP=+0000000000 EIBRESP2=+0000000000
READNEXT FILE(SRCSH1) RI(&RI)
STATUS: COMMAND EXECUTION COMPLETE NAME=
EXEC CICS READNext
File( 'SRCSH1 ' )
< SYsid() >
( SEt() | Into( 'SRFA201011601305470071730<CASO><REG001>0010010000' ... ) )
< Length( +11484 ) >
RIdfld( 'SRFA201011601305470071730' ) The next record after
< Keylength() >
< REQid( +00000 ) >
< RBa | Xrba | RRn >
< UNcommitted | Consistent | REPeatable | UPdate Token() >
< Nosuspend >
RESPONSE: NORMAL EIBRESP=+0000000000 EIBRESP2=+0000000000
READPREV FILE(SRCSH1) RI(&RI)
STATUS: COMMAND EXECUTION COMPLETE NAME=
EXEC CICS READPrev
File( 'SRCSH1 ' )
< SYsid() >
( SEt() | Into( 'SRFA201011601305470071730<CASO><REG001>0010010000' ... )
< Length( +11484 ) >
RIdfld( 'SRFA201011601305470071730' ) The same record
< Keylength() >
< REQid( +00000 ) >
< RBa | Xrba | RRn >
< UNcommitted | Consistent | REPeatable | UPdate Token() >
< Nosuspend >
RESPONSE: NORMAL EIBRESP=+0000000000 EIBRESP2=+0000000000
READPREV FILE(SRCSH1) RI(&RI)
STATUS: COMMAND EXECUTION COMPLETE NAME=
EXEC CICS READPrev
File( 'SRCSH1 ' )
< SYsid() >
( SEt() | Into( 'SRFA201011601135240071098<CASO><REG001>0010010000' ... )
< Length( +11067 ) >
RIdfld( 'SRFA201011601135240071098' ) And here you have
< Keylength() >
< REQid( +00000 ) >
< RBa | Xrba | RRn >
< UNcommitted | Consistent | REPeatable | UPdate Token() >
< Nosuspend >
RESPONSE: NORMAL EIBRESP=+0000000000 EIBRESP2=+0000000000 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I'm not sure why, but you need do 2 reaprev, after READNEXT |
For positioning. It is a feature. . . |
|
Back to top |
|
|
|