Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Indexed File Rewrite

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Wed Dec 15, 2010 6:53 pm    Post subject: Indexed File Rewrite
Reply with quote

Can we rewrite an indexed file without a prior read. I believe we can do it when we open the file is accessed using RANDOM/DYNAMIC mode.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Wed Dec 15, 2010 7:02 pm    Post subject:
Reply with quote

From the COBOL Programming Guide manual, with emphasis added by me:
Quote:
1.10.3.6 Replacing records in a VSAM file

To replace a record in a VSAM file, use REWRITE on a file that you opened as I-O. If the file was not opened as I-O, the record is not rewritten and the status key is set to 49. Check the file status key after each REWRITE statement.

For sequential files, the length of the replacement record must be the same as the length of the original record. For indexed files or variable-length relative files, you can change the length of the record you replace.

To replace a record randomly or dynamically, you do not have to first READ the record. Instead, locate the record you want to replace as follows:

* For indexed files, move the record key to the RECORD KEY data item, and then issue the REWRITE.

* For relative files, move the relative record number to the RELATIVE KEY data item, and then issue the REWRITE.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Dec 15, 2010 7:42 pm    Post subject:
Reply with quote

How come you always know where to look in the Manual/s, Robert! ;)
Back to top
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Wed Dec 15, 2010 7:49 pm    Post subject:
Reply with quote

Thanks Robert. It is good that he knows where to look in the manual icon_smile.gif. I looked into the cobol language reference before posting this query. But it wasn't as explicit as the above stated line.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Wed Dec 15, 2010 7:51 pm    Post subject:
Reply with quote

Anuj, I've had to look up a LOT over the years, so I've learned the manuals well. This is one of the better skills to develop -- I always tell people, I don't know everything, but I know where to find it! icon_biggrin.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Wed Dec 15, 2010 7:53 pm    Post subject:
Reply with quote

Mariraj P., the Language Reference guide has the syntax, whereas the Programming Guide tends to have the implementation details. This isn't a perfect split, though, so if you look in one manual and don't find what you're needing to know, look in the other one.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Thu Dec 16, 2010 2:11 am    Post subject:
Reply with quote

But try to look up the syntax for COBOL reference modification if you don't know that's what it is called. I do not remember ":" being in the index.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Thu Dec 16, 2010 2:49 am    Post subject:
Reply with quote

FYI,
You can also find Reference Modification listed in the COBOL Language Reference Manual Index under it's CLIST/REXX nomenclature - i.e. SUBSTRing.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Thu Dec 16, 2010 8:52 am    Post subject:
Reply with quote

Ronald - I never thought of that, as I knew "substr" was not the COBOL syntax.

I don't have a hardcopy anymore, but searching the manuals at the top - all 3 COBOL language refs - none has "substr" at the top-level (table of contents), but the Enterprise one does at least have "reference modification".

Its index, however, has "reference-modification" (with hyphen).

So, not particularly user friendly for this language element.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Thu Dec 16, 2010 9:12 am    Post subject:
Reply with quote

Phil,
My only reason for posting a response about "reference modification" was to show that "sometimes" alternative search criteria can actually lead to the topic someone is searching for. True, even when using a web search facility.
I myself have been known to do a (PDF) text search of an entire document when I "know" the "context" but not the actual, not so obvious, "tag" that was selected by the document's author for the TOC/index.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us