× 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.



Jeff,

Do the following lines work for you?

D O_RDWR C 4
D O_CREAT C 8
D O_CCSID C 32
D O_TRUNC C 64
D O_CODEPAGE C 8388608
D O_TEXTDATA C 16777216
D O_TEXT_CREAT C 33554432

// owner authority
D S_IRUSR C 256
D S_IWUSR C 128
D S_IXUSR C 64
D S_IRWXU C 448

// Group authority
D S_IRGRP C 32
D S_IWGRP C 16
D S_IXGRP C 8
D S_IRWXG C 56

// *PUBLIC authority
D S_IROTH C 4
D S_IWOTH C 2
D S_IXOTH C 1
D S_IRWXO C 7

/free
.
.
.
openFlags = O_RDWR + O_CREAT + O_TRUNC + O_TEXTDATA + O_CCSID + O_TEXT_CREAT;
mode = S_IRUSR + S_IWUSR + S_IXUSR + S_IRWXU + S_IROTH;

fd = open(%trimR(fullFileName):openFlags:mode:codepage:37);
.
.
.
/end-free

If you need to add group and/or *PUBLIC authority add them into mode.

Gary Monnier

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Monday, June 18, 2012 10:53 AM
To: RPG programming on the IBM i / System i
Subject: Re: Help creating file on IFS

Dennis,
Public has all authority to the directory.
I have other files that I created using CPYTOIMPF that I can open from the network drive with no problem.

Any suggestions will be appreciated.

Thanks,

On Mon, Jun 18, 2012 at 1:03 PM, Dennis <iseries@xxxxxxxxxxxx<mailto:iseries@xxxxxxxxxxxx>> wrote:

What are the permissions from WRKLNK option 9 or from wrkaut? What are
the permissions in the directories along the path? Can you "read"
other files on the same directory?

++
Dennis
++
"When I was crossing the border into Canada, they asked if I had any
firearms with me. I said, 'Well, what do you need?'"
-- Steven Wright




Sent from my Galaxy tablet phone. Please excuse my brevity.
For any grammatic/spelling errors, there is no excuse.
++


Jeff Young <jyoung0950@xxxxxxxxx<mailto:jyoung0950@xxxxxxxxx>> wrote:

I finally checked the IBM Manual for the Open file (Open) API for the
O_TEXT_CREAT and found this interesting info:
The call to open has a fifth argument (*text file creation conversion
ID*), which is to be interpreted as either a code page or CCSID,
depending on whether the O_CODEPAGE or O_CCSID was set.

If the O_TEXT_CREAT flag is specified, all of the following flags must
also be specified: O_CREAT, O_TEXTDATA, and either O_CODEPAGE or
O_CCSID. If all of these prerequisite flags are not specified when
O_TEXT_CREAT is specified, then the call to open will fail with error condition [EINVAL].

This flag indicates that the textual data read from or written to this
file will be converted between the CCSID specified or derived from the
*text file creation conversion ID* and the CCSID of the file. When
data is read from the file, it is converted from the CCSID of the file
to the CCSID specified or derived from the *text file creation
conversion ID*. When data is written to the file, it is converted to
the CCSID of the file from the CCSID specified or derived from the *text file creation conversion ID*.
The prototype that I had for the Open API did not have the fifth parm.
I added it and the file was created with no problems.

However, I now have a different issue:
After creating the file, I wrote 2 records using the Write API and
then closed the file.
When using the WRKLNK command on the i to view the file, I can see the
data.
The file attributes indicate the following:
Coded character set ID . . . . . . . . : 1252 Size of object data in
bytes . . . . . : 100 Allocated size of object . . . . . . . : 8192
File format . . . . . . . . . . . . . : *TYPE2

When I map a network drive from my PC (XP Pro), I see the file, but
can not open it.
When I look at the properties for the file, it shows 0 bytes for the
file size.
The file name is I123456_0.csv.

Any suggestions anyone?



On Mon, Jun 18, 2012 at 12:09 PM, Dennis <iseries@xxxxxxxxxxxx<mailto:iseries@xxxxxxxxxxxx>> wrote:

If O_TEXT_CREAT happens to be the sum of O_TEXT and O_CREAT, then
your flags field will contain invalid (or at least incorrect) information.

It's usually best to avoid addition of flags, in favor of bit-logic ("or"
in this case). But I'm guessing here. I can say that the flags look
a lot like flags I use for similar function, with the exception that
I don't
have
O_TEXT_CREAT in my header.


++
Dennis
++
"Experience is not what happens to a man; it is what a man does with
what happens to him."
-- Aldous Huxley




Sent from my Galaxy tablet phone. Please excuse my brevity.
For any grammatic/spelling errors, there is no excuse.
++


Jeff Young <jyoung0950@xxxxxxxxx<mailto:jyoung0950@xxxxxxxxx>> wrote:

The value for FileDs is -1
The value for errno is 3021
The value for sterrno is The value specified for the argument is not
correct.


I am sure that one of the values in the Open statement is not
correct,
but
can not determine which one it is.


On Mon, Jun 18, 2012 at 10:15 AM, Dennis <iseries@xxxxxxxxxxxx<mailto:iseries@xxxxxxxxxxxx>> wrote:

No strerror valu returned? That is strange.

May we see the test that tells you that open() failed?
++
Dennis
++


Sent from my Galaxy tablet phone. Please excuse my brevity.
For any grammatic/spelling errors, there is no excuse.
++


Jeff Young <jyoung0950@xxxxxxxxx<mailto:jyoung0950@xxxxxxxxx>> wrote:

All,
I have a program that is attempting to create a file on the IFS.
I am using the IFSIO_H copybook from Scotts IFS book for the
prototypes.
The snippet of code below is failing on the open.
<snip>

D IFS_File_Name S 50A

D FileDs S 10I 0

D RC S 10I 0

D Bytes_Loaded S 10I 0

D Msg S 256A Based(p_Msg)

D Test_Data S 1350A

D

// Prototypes for IFS Processing

/Copy QCopyBks,IFSIO_H

/copy QCopyBks,ERRNO_H

/Free

Test_Data = '123456179 THIS IS A TEST ITEM,213123434 THIS IS
ANOTHER';

// Create file on IFS

IFS_File_Name = '/excel/xml/I' +

'12456' +

'_' +

'0' +

'.csv';

FileDs = Open(IFS_File_Name // Path & File Nmae

: O_CREAT + // Create File

O_WRONLY + // Write Only

O_CCSID + // Use Code Page

O_TEXTDATA + // Text Data

O_TEXT_CREAT // Create File

: S_IRWXU // Owner has ALL Auth

: 1252 // PC Code Page

);

p_ErrNo = sys_errno;

p_Msg = strerror (errno);
</snip>
The value received for the error message text is

--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please
take a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please
take a moment to review the archives at
http://archive.midrange.com/rpg400-l.




--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.




--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx> Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.




--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxx> To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.