¿ªÔÆÌåÓý

gcc fopen question


 

I am trying to open a file using fopen:
fopen("tmp.dat","r+")

I need to open it for read & write.? However the compiler
complains with an error stating invalid option? "r+".
Can you on vm370 gcc open a file for both read and write?

Thank You
Tom c


 

Hi Tom

The version of GCCLIB on Six Pack 6 Beta 3 does not support read/right files because CMS does not support r/w files.

The updated version of GCCLIB has re-implemented the IO functions (done by myself). This supports r+ modes etc. via emulation (it reopens the file as needed).

Hope this helps

Adrian


 

What do you mean by "CMS does not support r/w files"??

Where did you get that information?

I wrote code circa 1981 that allowed for safely updating a large file on a CMS minidisk that could be shared "read-only" by multiple users, and simultaneously accessed in write-mode by using the "multi-write" feature of CP, by one "writer" (at a time), and eventually we got it all working just fine.


 

Ah ... I mean CMS does not support opening a file for reading and writing

Cheers

Adrian


 

Thank you for the response.? I will download and hopefully update with the "new" GCCLIB.

I have two projects that I am working on that need this type of access:

Conversion of the MUMPS programming interpreter to VM370 CMS.? It compiles and
links, but does not execute properly, yet......
and? conversion of the package apl_11 from linux gcc to VM370 CMS.? OF the 22
modules, 20 are compiling great, two still have compile time errors.? working on
them.

It is another step in the process and again, thank you.

Cheers
Tom c


On Wed, Jan 13, 2021 at 1:31 PM adriansutherland67 <adrian@...> wrote:
Hi Tom

The version of GCCLIB on Six Pack 6 Beta 3 does not support read/right files because CMS does not support r/w files.

The updated version of GCCLIB has re-implemented the IO functions (done by myself). This supports r+ modes etc. via emulation (it reopens the file as needed).

Hope this helps

Adrian


 

Adrian,

I am not trying to pick on you ...

See:
??

and page down to the section on OPENTYP= where it says:



OPENTYP=
is the type of open to be performed on the file. Acceptable values are:
READ
indicates that the file exists and will only be read.
WRITE
indicates that the file may be written to or read from. All changed and added records are written. Other records remain unchanged. If the file does not exist, it is created.
NEW
indicates that the file does not exist and is then created. It may then be written to or read from. If the file already exists, it is an error and the file is not opened.
REPLACE
indicates that the file is replaced with only the subsequently written records. If the file does not exist, it is created.
NONE
indicates that the file is not actually opened. The file is implicitly opened when the first FSREAD, FSWRITE, or FSPOINT is issued to the file. Use of FSOPEN with OPENTYP=NONE is essentially equivalent to an FSSTATE, and differs from an FSSTATE in that it may be used to create an FSCB for the file. The CACHE parameter is ignored if OPENTYPE=NONE.
You can specify OPENTYP=WRITE or OPENTYP=NONE.? Then just issue FSREADs mixed with FSWRITEs.

Hope that helps,

Mark


 

¿ªÔÆÌåÓý

Thats a shed load newer than the VM/370 we have¡­

?

Dave

G4UGM

?

From: [email protected] <[email protected]> On Behalf Of Mark Waterbury
Sent: 13 January 2021 22:44
To: [email protected]
Subject: Re: [h390-vm] gcc fopen question

?

Adrian,

I am not trying to pick on you ...

See:
??

and page down to the section on OPENTYP= where it says:


OPENTYP=

is the type of open to be performed on the file. Acceptable values are:

READ

indicates that the file exists and will only be read.

WRITE

indicates that the file may be written to or read from. All changed and added records are written. Other records remain unchanged. If the file does not exist, it is created.

NEW

indicates that the file does not exist and is then created. It may then be written to or read from. If the file already exists, it is an error and the file is not opened.

REPLACE

indicates that the file is replaced with only the subsequently written records. If the file does not exist, it is created.

NONE

indicates that the file is not actually opened. The file is implicitly opened when the first FSREAD, FSWRITE, or FSPOINT is issued to the file. Use of FSOPEN with OPENTYP=NONE is essentially equivalent to an FSSTATE, and differs from an FSSTATE in that it may be used to create an FSCB for the file. The CACHE parameter is ignored if OPENTYPE=NONE.

You can specify OPENTYP=WRITE or OPENTYP=NONE.? Then just issue FSREADs mixed with FSWRITEs.

Hope that helps,

Mark


 

Mark - Don't worry about picking on me - I am only a CMS Level 1 Hobbit, and do need guidance!

But I think (and hope) Dave is right - in VM/370, from reading old old manuals, my understanding was that you had to reopen files to move from write to read and back. If not I kind of wasted some time coding this in GCCLIB!

Tom - please note that you are user #2 - I did create rather extensive automation tests for the IO part however issues will be there for sure. Also documentation is sparse :-(? However it is actively supported, so just raise issues on GITHUB. Projects sound interesting ...

Cheers

Adrian


 

Mark,

That functionality does not ?exist in VM/370s filesystem. Remember, it is NOT the shared filesystem, but rather the predecessor ?(800-byte block, IIRC) CMS filesystem.

Joe

On Wed, Jan 13, 2021 at 4:44 PM Mark Waterbury <mark.s.waterbury@...> wrote:
Adrian,

I am not trying to pick on you ...

See:
??

and page down to the section on OPENTYP= where it says:



OPENTYP=
is the type of open to be performed on the file. Acceptable values are:
READ
indicates that the file exists and will only be read.
WRITE
indicates that the file may be written to or read from. All changed and added records are written. Other records remain unchanged. If the file does not exist, it is created.
NEW
indicates that the file does not exist and is then created. It may then be written to or read from. If the file already exists, it is an error and the file is not opened.
REPLACE
indicates that the file is replaced with only the subsequently written records. If the file does not exist, it is created.
NONE
indicates that the file is not actually opened. The file is implicitly opened when the first FSREAD, FSWRITE, or FSPOINT is issued to the file. Use of FSOPEN with OPENTYP=NONE is essentially equivalent to an FSSTATE, and differs from an FSSTATE in that it may be used to create an FSCB for the file. The CACHE parameter is ignored if OPENTYPE=NONE.
You can specify OPENTYP=WRITE or OPENTYP=NONE.? Then just issue FSREADs mixed with FSWRITEs.

Hope that helps,

Mark