×
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.
As you already figured out, using different constants depending on the CCSID of the current job is not a good idea. Here is a demo that shows, how to use Unicode literals. It produces the following output:
Job running with CCSID 273:
¬hex-constants|
[unicode-constants]
Job running with CCSID 37:
[hex-constants]
[unicode-constants]
You see, the Unicode constants work for both CCSIDs.
Please refer to my posting from Tuesday to get a copy of the UNICODE command.
// Initialize special characters
E_BrktL = %char(U_BrktL);
E_BrktR = %char(U_BrktR);
// Open IFS file
fd = open('/home/raddatz/ccsidDemo.txt':
O_CREAT + O_WRONLY + O_TRUNC + O_CCSID + O_TEXT_CREAT + O_TEXTDATA:
S_IRWXU + S_IRWXO: 1252: 0); // Convert data from job CCSID to 1252
// when appending data to the file
// Write some data to the file
buffer = X_BrktL + 'hex-constants' + X_BrktR + CRLF;
len = write(fd: %addr(buffer: *data): %len(buffer));
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von John Allen
Gesendet: Dienstag, 21. Februar 2017 17:21
An: 'RPG programming on the IBM i (AS/400 and iSeries)'
Betreff: RE: Question about Code pages and writing file directly to IFS with RPG program
Thanks for the info.
The program is always compiled using CCSID 37 I do not use constant character [ and ] instead I use variable fields where I load their values based on the CCSID of the system where the program is running
EVAL W$BrktL = X'BA'
EVAL W$BrktR = X'BB'
Then I tried (without success) using different variations of this:
C WHEN W$CdPage = 284
C EVAL W$BrktL = X'4A'
C EVAL W$BrktR = X'5A'
Then I figured this was not the correct/best solution for this. There has to be a simpler/better way As I still need to get all of the Spanish characters in the spool file to map correctly as well
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
As an Amazon Associate we earn from qualifying purchases.
This thread ...
Re: Question about Code pages and writing file directly to IFS with RPG program, (continued)
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.