How to open a file in I-O mode in assembler?
How to open a file in I-O mode in assembler?
Can I open a file in I/O mode in assembler? If yes, how to do that? I have to read and update the same file .
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: How to open a file in I-O mode in assembler?
It is NOT advised to read and write to the same file -- because it becomes impossible to restart the program if needed. And if you are using a sequential file, there is the possibility of making the file unusable.
However, the Assembler OPEN macro supports INOUT (among other options) so you might want to read up on the OPEN options.
However, the Assembler OPEN macro supports INOUT (among other options) so you might want to read up on the OPEN options.
Re: How to open a file in I-O mode in assembler?
Thanks Robert.
Should I read this as a general advice or specifically for Assembler? As there are some programs I've seen using RE-WRITE for QSAM and ESDS in COBOL.Robert Sample wrote:It is NOT advised to read and write to the same file -- because it becomes impossible to restart the program if needed. And if you are using a sequential file, there is the possibility of making the file unusable.
Thanks for the guidance, this helps.However, the Assembler OPEN macro supports INOUT (among other options) so you might want to read up on the OPEN options.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: How to open a file in I-O mode in assembler?
If updating a dataset in place, the dataset must first be backed-up. For a QSAM dataset that would be a bit silly. No reason to update a QSAM dataset in place.
An ESDS is reasonable to update in place, as long as backed-up first.
Without the back-up it becomes a corrupt-in-place.
An ESDS is reasonable to update in place, as long as backed-up first.
Without the back-up it becomes a corrupt-in-place.
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: How to open a file in I-O mode in assembler?
The only times I have ever used REWRITE in COBOL is with a VSAM KSDS file. No matter the language used, using REWRITE on a sequential file in production code is just asking for problems. If the program fails one in a hundred times, and it runs daily, you're looking at 3 to 4 times a year where the process has to be restarted and hence the sequential file has to be restored before the rerun can occur.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute