I'm using the following code (free-format):
----------------------------- w_wrfile = '/QSYS.LIB/MYTEST.LIB/FTAR.FILE/L550010.MBR'; flags = O_WRONLY + O_CREAT + O_TRUNC; mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IWGRP; fdw = ifs_open(%trimr(w_wrfile):flags:mode); if fdw < 0; z_msg = 'error : ' + %editc(errno:'X'); else; z_msg = 'filed opened well'; ifs_close(fdw); endif; -----------------------------
Can you please tell me what I'm doing wrong? I think it has something to do with mode-parameter passed to the open-API.
"For all other file systems, the group ID (GID) of the file is set to the GID of the directory in which the file is created. File permission bits are set according to mode, except for those set in the file mode creation mask of the job. The S_ISUID (set-user-ID) and S_ISGID (set-group-ID) bits are also set according to mode. The file type bits in mode are ignored. All other bits in mode must be cleared (not set) or a [EINVAL] error is returned."
So your line (mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IWGRP;)looks wrong -- you are setting bits that should not be set for this filing system. Change this line and try again.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Visit the ITKnowledge Exchange and get answers to your developing questions fast.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on iSeries application development tools
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.