|
You may use a VARYING field when the called procedure's parameter is OPTIONS(*STRING) The compiler converts it correctly. The problem here is probably as Scott suggested, "/dir1/dir2/file.txt " is not correct, the trailing blanks need to be trimmed. In V5R3 there is OPTIONS(*STRING : *TRIM) available to do the blank trimming on the call itself so you don't have those pesky %TRIMR()'s everywhere. Too bad they didn't give use OPTIONS(*TSTRING) to make it a little easier to code when using *STRING parms. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bartell, Aaron L. (TC) Sent: Tuesday, August 03, 2004 1:04 PM To: RPG programming on the AS400 / iSeries Subject: RE: IFS Open To go along with Scott and Joe's comments I am fairly certain you cannot use a VARYING field as a parm to a C API. This is because the first two chars of the variable contain it's length and since C doesn't support RPG's version of VARYING length fields it thinks those first two bytes are part of the file path/name. I may be wrong, but I struggled with this some time ago and I think that is what I came up with. Aaron Bartell -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Sent: Tuesday, August 03, 2004 12:11 PM To: rpg400-l@xxxxxxxxxxxx Subject: IFS Open When using an IFS open like this (I'm using Scott's prototype): fd = open('/michael/cattest' : flags); all is good. However, when I put the same value in a variable (FileName) and use it like this: D FileName S 1024 Varying fd = open(FileName : flags); I receive an fd of -1 and the message "open() for input: No such path or directory." I've tried a bunch of different combinations and can't make it work. Please help the stoopid guy in the corner. You'll fill your random act of kindness quotient for the day. TIA... -- michaelr_41@xxxxxxxxxxxxxx -- This is the RPG programming on the AS400 / iSeries (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. -- This is the RPG programming on the AS400 / iSeries (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-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.