Doug, I empathize with the challenge you face. Can you make the file-level CCSID match the CCSID of the records in the flat file, so the records are not garbage?
I am confident you can get your RPG to de-garbage via a readable CCSID but I am not familiar with the API or business function to do so.
Ask IBM technical support.
IBMi on Power System Value QCCSID is typically 00037, and by default applies to stream files (flat files) on Integrated File System (IFS).
Press F1 in WRKSYSVAL to read more.
IFS stream files (flat files) are always encoded with a CCSID BUT the file-level CCSID May be Different from the CCSID of the records in the flat file.
If these CCSIDs differ from each other, the data will appear as gibberish in tools like Notepad, Notepad++, WRKLNK.
I believe that ALL external flat files arriving inbound to IFS arrive as CCSID 819, not as 1252.
Open a file with WRKLNK to identify CCSID.
Then compare that file to Notepad++. the lower right corner of Notepad++ frame may display as "Windows (CR LF) UTF-8 on some flat files, or as Unix (LF) UTF-8 on others.
Good discussion of IFS stream file CCSIDs 1252, 437 and 819 at this page:
https://www.ibm.com/support/pages/ifs-stmf-ccsids-1252-437-and-819
Try also
https://www.ibm.com/docs/en/rdfi/9.6.0?topic=reference-ccsid-values
Much CCSID documentation can be found at
https://www.ibm.com/docs/en/search/CCSID?scope=ssw_ibm_i_75
Oracle's EnterpriseOne several releases ago chose to represent all data with Unicode. Unicode can support all written languages, and enable multiple languages to co-exist in a single instance of software.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of DEnglander--- via RPG400-L
Sent: Wednesday, November 30, 2022 4:52 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Cc: DEnglander@xxxxxxxxxxxxxxx
Subject: [External] RPG + IFS
[WARNING]: External Email
I have an RPG program that needs to read an IFS file. The IFS file is created using the PASE touch command, and no CCSID number is specified.
When I go into WRKLNK to the file and use option #8, it shows CCSID of 819. However, when I enter option #2 on the file then take F15, it shows a CCSID of 500. When I display the file in WRKLNK using option 5, the data looks fine and I can read it.
When I look at the file in ACS, it shows as "garbage" whether or not I view as a UTF-8 file.
When I run a SQL statement using qsys2.ifs_read, I also see garbage.
When I attempt to read it in with RPG, I still see garbage. In the RPG program, I use the _C_IFS_FGETS procedure to read the IFS file. The field that is defined to receive the data is defined with CCSID(819). It still shows as garbage.
What do I need to do to have RPG be able to "see" the data in this IFS file in the same format as WRKLNK option #5?
I have a feeling this has something to do with the file being created by TOUCH, but am not sure.
Any ideas?
Thank you,
Doug
As an Amazon Associate we earn from qualifying purchases.