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

Reading/updating records from a VSAM file sequentially error


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bryan_lab
Currently Banned

New User


Joined: 12 May 2007
Posts: 3
Location: Philippines

PostPosted: Tue Nov 18, 2008 7:07 am
Reply with quote

Hi,

Can someone help me with this? This is my first time to do a CICS program and I'm having a problem updating the record sequentially.

These are what I have done with my program:

1. Issue a start browse to start from the first record.
2. Perform read next until end of file.
2.a. Update that record using the rewrite.

My problem is when I'm updating the record that I have read, I'm encountering an INVREQ. I don't know what to do with this.

I'll appreciate if someone can help me with this.

Thanks.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Nov 18, 2008 7:58 am
Reply with quote

If you've reached end of file, you don't have a record available to rewrite. You haven't given enough information in order for someone to help you.
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: Tue Nov 18, 2008 8:09 am
Reply with quote

You don't really provide a very good explanation of what's going on -- for example, the manual says about REWRITE:
Quote:
Description

REWRITE updates a record in a file on a local or a remote system. You must always precede this command with a read with the UPDATE option.

For VSAM data sets, you must not change the key field in the record.
You don't say you've done a READ with UPDATE which is required per the manual. And I agree with Terry -- if you hit end of file, you don't have a record to rewrite, anyway.
Back to top
View user's profile Send private message
bryan_lab
Currently Banned

New User


Joined: 12 May 2007
Posts: 3
Location: Philippines

PostPosted: Tue Nov 18, 2008 8:11 am
Reply with quote

Hi,

Sorry for that. it's like this:


1. startbr (start from the first record)
2. read next
3. Perform process-rtn until end of file

process-rtn.
validate and rewrite
read next

My problem is for the first read (I'm sure it will be a problem also on the succeeding records). let's say i have read from record number 1. after i validate it and it's ok, i need to update that record. I'm encountering an INVREQ on the rewrite command. when i checked the response code, it's 16.

Thanks.
Bryan
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: Tue Nov 18, 2008 8:32 am
Reply with quote

What's the RESP2 field? That'll tell you per the manual exactly why the rewrite is failing. However, as I said in my first post, if you do not READ or READNEXT the record with UPDATE, your REWRITE will fail. Period.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Nov 18, 2008 8:38 am
Reply with quote

you need to end the browse before performing the update, and then
start browse again.

Process-rtn.
validate
endbrowse
read/update
start browse
readnext
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Nov 18, 2008 8:39 am
Reply with quote

Hello,

Please do not post the same question in both forums. . .

Thank you,

d.sch.
Back to top
View user's profile Send private message
bryan_lab
Currently Banned

New User


Joined: 12 May 2007
Posts: 3
Location: Philippines

PostPosted: Tue Nov 18, 2008 8:48 am
Reply with quote

Hi All,

Thanks for all your response. I'll try what Earl has suggested.


dick scherrer,

I do apologize for that.

Thanks again.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Nov 18, 2008 9:41 am
Reply with quote

Hello,

Quote:
I do apologize for that.
Not to worry icon_smile.gif

The "post police" are here to keep an eye out. . .

Good luck,

d
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top