|
You put a value in CCSID, but pass TXTCREATID? This is what a call in
one of my programs looks like.
FD = open( Filename
:O_CREAT+O_TRUNC+O_WRONLY + O_CCSID + O_TEXTDATA + O_TEXT_CREAT
: S_IRWXU + S_IRWXG + S_IROTH
: 819
: 0 );
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Tuesday, March 27, 2012 9:58 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Problem creating file in IFS
All,
I am attempting to create a new file on the IFS using Scott Klements
prototypes in the IFSIO_H source member from his e-book.
The following is a part of the code showing the defines and the open:
* Copy prototypes for IFS processing
/Copy QCopyBks,IFSIO_H
/Copy QCopyBks,IFSTEXT_H
* Copy API Error constants and prototypes
/Copy QCopyBks,ErrNo_H
D Path_Name S 256A Varying
D File_Name S 128A Varying
D openflags S 10I 0
D mode S 10U 0
D ccsid S 10U 0
D txtcreatid S 10U 0
// Pointer to file name
D File S 10I 0
// Pointer to buffer for IFS Write
D p_writeBuf S * Inz(%Addr(WriteBuf))
// Buffer area for IFS Write
D Writebuf S 80A
D ErrMsg S 80A
D Rc S 10I 0
/Free
*InLr = *On;
Path_Name = '/home/vaijy';
File_Name = 'TEST.CSV';
// Create file, Write Only, Convert Text to Code Page, Open in TEXT
mode,
// Create only
OpenFlags = O_CREAT + O_WRONLY + O_CODEPAGE + O_TEXTDATA
+ O_TEXT_CREAT;
// Authority - Owner All, Group All, Others All
Mode = S_IRWXU + S_IRWXG + S_IRWXO;
// Convert to Code Page 1252 (Windows AscII)
CCsId = 1252;
// Get file handle and open file for write only
File = Open(%TrimR(Path_Name) + '/' + %TrimR(File_Name)
: OpenFlags
: Mode
: TxtCreatId
);
If File < *Zero; // Error on file
p_ErrNo = Sys_ErrNo(); // Get Error number
ErrMsg = %Str(StrError(ErrNo)); // Load Error Message Text
Return;
EndIf;
I am receiving the following error from the open:
*The value specified for the argument is not correct.
*
What am I doing wrong?
Thanks,
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
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: 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
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 mailing list archive is Copyright 1997-2025 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.