Guilty as charged :DDD
the universal way is representing paths via Qlg_Path_Name_T and related functions....
those allows access like i.e. the ACS IFS client without particular charset problems ...









On Tuesday, July 21, 2026 at 06:39:58 PM GMT+2, Niels Liisberg <nli@xxxxxxxxxxxxxxxxx> wrote:





It my fault .. they simply took mine version from my gist .. both of them

tirs. 21. jul. 2026 kl. 18.06 skrev Vern Hamberg via RPG400-L <
rpg400-l@xxxxxxxxxxxxxxxxxx>:

Francesco

You ask why IBM hasn't provided *...full compatibility and
symmetry...* - the examples in SYSTOOLS are just that - examples. They
are there for us to learn from and to expand upon, as you have done

*Regards*

*Vern Hamberg*

IBM Champion 2025 <cid:part1.U6158Ivs.zA17Rz7g@centurylink.net> CAAC
(COMMON Americas Advisory Council) IBM Influencer 2023


On 7/21/2026 10:15 AM, cesco via RPG400-L wrote:
I've fashioned a quick PHP running on the ibmi to let the user interact
with only its own profile home directory fast, to ease some transfer and
for quick automation and avoid opening more complex protocols, all done via
SQL interface (in order to run all operation with the correct user
authority).
I quickly noticed that , while other "IFS" sql functions are in Q* libs,
IFS_UNLINK is meant as example per doc and it is in fact in SYSTOOLS;
the problem that its implementation can bite you when operating with
files in IFS that usually can contain unicode in the names... and compared
to other functions is asymmetric because it forces ccsid job default (while
the other IBM production functions are properly specified as ccsid 1200 in
the parameter)
Also IFS_RENAME seems limited... am I missing something, shouldn't IBM
provide those primitives with full compatibility and symmetry?
In any case, using the same way of C embedding of the stock function,
I've introduced a custom function like below, in case someone hit the
problem (hoping that IBM will promote those to full production in future),
below as reference

ciao, FrancescoT.


CREATE OR REPLACE FUNCTION THELIB.IFS_UNLINK_UTF8 (
PATH_UTF8 VARCHAR(5000) CCSID 1208 )
RETURNS INTEGER
LANGUAGE SQL
SPECIFIC IFSUNLKUTF
NOT DETERMINISTIC
MODIFIES SQL DATA
RETURNS NULL ON NULL INPUT
NOT FENCED
SET OPTION BINDOPT = 'BNDSRVPGM(QSYS/QP0LLIB1)' ,
COMMIT = *NONE ,
DFTRDBCOL = QSYS2 ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
MAIN : BEGIN
--CALL QSYS2.QCMDEXC('CRTSRCPF FILE(QTEMP/QCSRC) RCDLEN(160)
MBR(*NONE)');
--CALL QSYS2.QCMDEXC('ADDPFM FILE(QTEMP/QCSRC) MBR(IFSUNLK8)
SRCTYPE(C)');
--INSERT INTO QTEMP.QCSRC (SRCSEQ, SRCDTA) VALUES
-- ( 1, '{'),
-- ( 2, '#include <qlg.h>'),
-- ( 3, '#include <Qp0lstdi.h>'),
-- ( 4, '#include <errno.h>'),
-- ( 5, '#include <string.h>'),
-- ( 6, 'struct pns_s {'),
-- ( 7, ' Qlg_Path_Name_T hdr;'),
-- ( 8, ' char name[5000];'),
-- ( 9, '};'),
-- (10, 'struct pns_s pns;'),
-- (11, 'unsigned int len;'),
-- (12, 'len = IFS_UNLINK_UTF8.PATH_UTF8.LEN;'),
-- (13, 'if (len > sizeof(pns.name)) len = sizeof(pns.name);'),
-- (14, 'memset(&pns, 0, sizeof(pns));'),
-- (15, 'pns.hdr.CCSID = 1208;'),
-- (16, 'pns.hdr.Path_Type = 0;'),
-- (17, 'pns.hdr.Path_Length = len;'),
-- (18, 'pns.hdr.Path_Name_Delimiter[0] = 0x2F;'),
-- (19, 'memcpy(pns.name, IFS_UNLINK_UTF8.PATH_UTF8.DAT, len);'),
-- (20, 'MAIN.RC = QlgUnlink((Qlg_Path_Name_T *)&pns);'),
-- (21, 'if (MAIN.RC != 0) { MAIN.RC = errno; }'),
-- (22, '}');
DECLARE RC INT DEFAULT 0 ;
INCLUDE QTEMP / QCSRC ( IFSUNLK8 ) ;
RETURN RC ;
END ;
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.