× 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.



Thomas

your method only solves half of the problem because the same problem exists
in
naming fields.

On a CCSid 37 systems field names like ##NO @@NO, $$NO are allowed but
on a CCSid 277 system (danish) they are NOT and but must be renamed to
ÆÆNO, ØØNO and ÅÅNO in order for one to be able to compile the program.

On Wed, Feb 22, 2017 at 9:06 AM, Thomas Raddatz <thomas.raddatz@xxxxxx>
wrote:

John,

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.

Regards,

Thomas.

**free
// ============================================================
=======
// STRPREPRC Compile Options:
// >>PRE-COMPILER<<
// >>CRTCMD<< CRTBNDRPG PGM(&LI/&OB) +
// SRCFILE(&SL/&SF) SRCMBR(&SM);
// >>IMPORTANT<<
// >>PARM<< TRUNCNBR(*NO);
// >>PARM<< DBGVIEW(*LIST);
// >>PARM<< OPTION(*EVENTF);
// >>END-IMPORTANT<<
// >>EXECUTE<<
// >>END-PRE-COMPILER<<
// ============================================================
=======

ctl-opt main(ccsiddemo) bnddir('QC2LE');
ctl-opt debug(*yes);
/if defined(CRTBNDRPG)
ctl-opt dftactgrp(*no) actgrp(*new);
/endif

// fd/-1 = open()--Open File ==> include <fcntl.h>
dcl-pr open int(10) extproc('open');
i_path pointer options(*string) value;
i_opnFlag int(10) value;
i_mode uns(10) options(*nopass) value;
i_codePage uns(10) options(*nopass) value;
i_crtCodePage uns(10) options(*nopass) value;
end-pr;

dcl-c O_WRONLY 2;
dcl-c O_CREAT 8;
dcl-c O_CCSID 32;
dcl-c O_TRUNC 64;
dcl-c O_TEXTDATA 16777216;
dcl-c O_CODEPAGE 8388608;
dcl-c O_TEXT_CREAT 33554432;

dcl-c S_IRWXU 448;
dcl-c S_IRWXO 7;

// value/-1 = write()--Write to Descriptor ==> include <unistd.h>
dcl-pr write int(10) extproc('write');
i_fd int(10) value;
i_pBuffer pointer value;
i_bufLen uns(10) value;
end-pr;

// 0/-1 = close()--Close File or Socket Descriptor ==> include
<unistd.h>
dcl-pr close int(10) extproc('close');
i_fd int(10) value;
end-pr;

dcl-proc ccsiddemo;
dcl-pi *n end-pi;

dcl-s fd int(10);
dcl-s len int(10);

dcl-c X_BrktL X'BA';
dcl-c X_BrktR X'BB';
dcl-c U_BrktL u'005B';
dcl-c U_BrktR u'005D';
dcl-c CRLF x'0D25';

dcl-s E_BrktL char(1);
dcl-s E_BrktR char(1);

dcl-s buffer varchar(100);

// 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));

buffer = E_BrktL + 'unicode-constants' + E_BrktR + CRLF;
len = write(fd: %addr(buffer: *data): %len(buffer));

// Close the file
callp close(fd);

end-proc;


-----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.
--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.