×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Albert York wrote:
Eval FileDesc = open(%ADDR(FullName)
: O_CREAT + O_WRONLY + O_TRUNC +
O_CODEPAGE
: S_IRWXU + S_IROTH
: AsciiCodePage)
First off... the use of %ADDR() is not a good idea here. Use %TRIM() if
you need to remove spaces, but don't use %ADDR(). Unless you need V3R2
compatibility for some reason??
instead, code options(*STRING) on the prototype, and just pass the pathname.
also, please consider using O_CCSID instead of the antiquated
O_CODEPAGE. Unless you need V4 compatibility, that is... O_CCSID is
preferred from V5R1 up, and is much more powerful.
However, it gets created only with *R data authority for *PUBLIC so no one can delete it except the person who created it.
Just to make you understand... the permissions are ONLY assigned to a
file when it's created. The open() API does not assign permissions to
existing files. Use chmod() if you want to change the permissions of a
file.
Your code is specifying read-only for *PUBLIC. That's what S_IROTH
means... If you want *PUBLIC to have write access, specify S_IROTH +
S_IWOTH.
I don't understand why you're giving the file's owner execute access.
Is this a PASE program or shell script that you're creating? If not,
please consider removing execute access. If your goal is to give
everyone read and write access, do this:
S_IRUSR + S_IWUSR + S_IRGRP + S_IWGRP + S_IROTH + S_IWOTH
to understand what these names mean.. What we call "owner" is what
Unix people call the "user". (meaning the user who created the file).
What we call "public", Unix people call "other". Meaning "other people"
or "everyone else".
So when you see S_IRUSR, ignore the 'S_I' part, and you have RUSR --
short for "Read User". likewise, S_IWUSR is write for user (or
"owner"), S_IRGRP is read for group profile, S_IWOTH is write for other
(or "public")
As an Amazon Associate we earn from qualifying purchases.