Sorry: problem with the english language:
"the parameters on fopen are just an additional method which must
not be used."
should read
"the parameters on fopen are just an additional method which can
be used or not"
maybe there are better ways to express this ... the original
wording was wrong, IMO.?
I don't have much experience with english speaking;
I am only writing IT-related posts since almost 20 years now.
Hope you don't mind.
Sorry again, kind regards
Bernd
Am 08.06.2022 um 19:01 schrieb Bernd
Oppolzer:
toggle quoted message
Show quoted text
Am 06.06.2022 um 02:30 schrieb Mark
A. Stevens via groups.io:
To be honest, I don't like either, as they both appear to be a
kludge. If I had to pick, I would recommend the first and forget
the second. That and $3 might buy you a cup of coffee ;-) and if
it matters and you have to or want to keep the external
characteristics in the code, I'd recommend, as those extra items
would come after the 'standard' C parameters.
fopen("my.file",w,recfm=v,lrecl=300,blksize=304);
The syntax of the IBM compilers is as follows:
fopen("my.file","w,recfm=v,lrecl=300,blksize=304");
that is, the second parameter which contains the mode and all
the additional options
is a C string (as in the ANSI C function definition for fopen).
BTW: you don't need to use DSN names for the files as in this
case;
you can use DDNames as well, if you use this syntax: DD:DDNAME
(that is: ddnames, prefixed with DD:).
And: for the filenames, there is the common rule from TSO;
if with apostrophes, nothing is added, but if without
apostrophs,
the user assigned to the job or session is added.
I understand the challenge is
dealing with record based I/O rather than stream I/O.
Is this a case of not putting that information in the code and
leaving it to a FILEDEF to handle the external
characteristics? Then your code would be more portable because
you would be externalizing those items which are specific to
IBM.
FILEDEF
MYFILE DISK MY DATA A ( recfm=v lrecl=300 blksize=304
...
fopen(MYFILE,w);?
This is, of course, possible with VM and with MVS;
you can specify all the options on FILEDEF or on DD statements (in
MVS JCL);
the parameters on fopen are just an additional method which must
not be used.
I never use it, just to keep my programs as portable as possible,
so that they run with minimum changes on Linux and Windows etc.
and on the mainframe environments.
HTH
kind regards
Bernd