Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem doing READPREV

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Tue May 26, 2009 8:44 am    Post subject: Problem doing READPREV
Reply with quote

    I have a partial key say:

    Code:
    10  WS-KEY.
         15    WS-A   PIC 9(06)
         15    WS-B   PIC 9(12)
         15    WS-C  REDEFINES WS-B
                        20  WS-C1    PIC 9(06)
                        20  FILLER   PIC X(06)


    Now i move a value to a ws-a(value found in file). i move "999999999999" to ws-b.

    On doing ,

    STARTBR -> respcode 0
    READPREV -> respcode 13

    Again,
    STARTBR -> respcode 0
    READNEXT -> respcode 0
    READPREV -> respcode 0
    READPREV -> respcode 0

    This fetches the last valid record

    Why is that i able to do READNEXT and not a READPREV with the partial key do fetch the last valid record?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 26, 2009 8:54 am    Post subject:
Reply with quote

Hello,

What is in WS-A?

If you do not control the value, your process will be out of control. . .
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Tue May 26, 2009 8:59 am    Post subject:
Reply with quote

File VALUES


Code:
WS-A              WS-B
1111            111111111111
1111            222222222222
1234            111111111111
1234            222222222222
1234            333333333333
1234            444444444444
5555            111111111111


Now ,

With WS-A as 1234 and WS-B as "999999999999", Doing a STARTBR(respcode -> 0)
READPREV (respcode ->13)


Why is this so?

Ideally it should have fetched the record

WS-A 1234 WS-B 444444444444

Can you please help me out?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 26, 2009 9:19 am    Post subject:
Reply with quote

Hello,

You are showing 4-digit values but the key is 6.

How is the data stored 001234 or 123400.

You are also intermixing character data with numeric fields. Generally a bad practice. Suggest you move true numeric values to numeric fields rather than alpha characters that happen to contain some numbers.

Suggest you repro the vsam file and look at the actual data and make sure that the way you are looking for data is the same as the way it is stored.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 26, 2009 4:54 pm    Post subject:
Reply with quote

what is the actual code of your STARTBR?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue May 26, 2009 4:55 pm    Post subject:
Reply with quote

From the CICS Application Programming Reference:
Quote:
If you include a READPREV command immediately following a STARTBR command, your STARTBR command RIDFLD must specify the key of a record that exists on the data set; otherwise the NOTFND condition will occur.

A READPREV command following a READNEXT, or a STARTBR or RESETBR that did not specify a 'last' key value, is treated as though the RIDFLD value had been modified and results in a reposition (as above).
The manuals are pretty thorough when searched.
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Tue May 26, 2009 5:32 pm    Post subject:
Reply with quote

Thank you everyone for your valuable inputs.
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Tue May 26, 2009 5:40 pm    Post subject:
Reply with quote

One last query..

if i move HIGH-VALUES to the complete KEY and then,

STARTBR
READPREV


this works fine. How is this possible?

Is it because STARTBR points at the last record from the file and READPREV reads that last record?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue May 26, 2009 5:49 pm    Post subject:
Reply with quote

Was the file loaded with a HIGH-VALUES record initially? If so, then the RIDFLD points to a file record and the READPREV would work perfectly fine per the manual quote I posted above.
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Wed May 27, 2009 8:27 am    Post subject:
Reply with quote

Yes the file is loaded initially with HIGH-VALUES.

Thanks for your time.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed May 27, 2009 4:52 pm    Post subject:
Reply with quote

Glad to hear your questions are resolved.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us