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



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




-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Henrik Rützou
Sent: Monday, February 20, 2017 8:50 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Question about Code pages and writing file directly to IFS with RPG program

Hi Jan,

this is probably a 'classic' - what CCSid are your source code in, if you just has copied it from a CCSid 37 machine it is CCSid 37.

This means (and you can't probably see it in a editor) that the hex representation in the source file is:

[ = x'BA' where it should be x'4A'
] = x'BB' where it should be x'5A'
# = x'7B' where it should be x'69'

So if you compile the programs the first is the binary representation still has and if the receiving program thinks that it is CCSid 284 things go wrong since compilers don't compile characters but their binary representation that is beneath them.

That is why most international distributions starts with creating empty source files in the system's CCSid and copy the original source using CPYSRCF that converts the binary repesentation from the characters in the original source file to the new source file's CCSid.

So that is the first thing you have to check otherwise the problem will follow you around when you pass data from one program compiled from one CCSid to another program compiled from source code in a source file in another CCSid.

On Mon, Feb 20, 2017 at 1:48 PM, Jan Grove Vejlstrup <jgv@xxxxxxxx> wrote:

Hello Thomas,

I'm interested in your code, that converts EBCDIC to Unicode and would
be happy to receive a copy.

Thank you very much and best regards

Jan



Am 17.02.2017 um 22:54 schrieb Tools/400:

John,

I had similar problems with WSDL2RPG. I solved these problems by
using
%char() and unicode constants like this:

D QUOTE C u'0022'
D OPEN_ANGLE C u'003C'
D CLOSE_ANGLE C u'003E'

io_msgCtx.header.contentType.start =
%char(OPEN_ANGLE) + i_partID + %char(CLOSE_ANGLE);

Or I use init procedures like this:

*
D isInit S N inz(cFalse) static
D esc_from S 10A Dim(5) varying static
D esc_to S 10A Dim(5) varying static
*
* Constants
D cESC_FROM_1 C U'0026'
D cESC_FROM_2 C U'003E'
D cESC_FROM_3 C U'0022'
D cESC_FROM_4 C U'003C'
D cESC_FROM_5 C U'0027'
*
D cESC_TO_1 C U'00260061006D0070003B'
D cESC_TO_2 C U'002600670074003B'
D cESC_TO_3 C U'002600710075006F0074003B'
D cESC_TO_4 C U'0026006C0074003B'
D cESC_TO_5 C U'002600610070006F0073003B'

if (not isInit);
esc_from(1) = %char(cESC_FROM_1);
esc_from(2) = %char(cESC_FROM_2);
esc_from(3) = %char(cESC_FROM_3);
esc_from(4) = %char(cESC_FROM_4);
esc_from(5) = %char(cESC_FROM_5);
esc_to(1) = %char(cESC_TO_1);
esc_to(2) = %char(cESC_TO_2);
esc_to(3) = %char(cESC_TO_3);
esc_to(4) = %char(cESC_TO_4);
esc_to(5) = %char(cESC_TO_5);
...
isInit = cTrue;
endif;

I also have a "UNICODE" command that translates a given string from
EBCDIC to UNICODE. That makes it easy to create the Unicode constants.
Let me know if you like to get a copy.

Thomas.

Am 17.02.2017 um 21:24 schrieb John Allen:

I have a program that creates PDF files and emails out.

Works great here in the U.S.

QCNTRYID US

QLANGID. ENU
QCCSID . 65535

QCHRID . 00697 00037




Now I have a client in Argentina that is running there system with
Code Page 284


QCNTRYID: AR
QLANGID: ESP (24)
QCCSID: 65535
QCHRID: 697/284 - ID CHAR/CODE PAGE



PDF Specifications require a specific formatting strings
Example: [/PDF /Text]


Because Code page 284 maps differently than 37 I get an invalid PDF
format running with Code Page 284

Example: []# characters are converted to !¢Ñ

Thus resulting in invalid PDF file structure because the [] are not
there


I tested with creating the stream file with code page 1252 and 284

I tested with converting EBCDIC data to ASCII before writing it to
stream file

I tested creating the [] using Hex Values based on which code page
the job is running under

And many combinations of these


After researching, changing program testing about 50 times I am now
totally confused


This program that creates the PDF file is created and compiled on
the system in the US under code page 37

Writes stream file directly to IFS (or File Server) using unlink(),
open(), write(), close()


I need my program to check the code page of the system the program
is running on, then based on that code page

create a PDF file with the correct character mapping so that Adobe
does not crash due to incorrectly formatted data

and it displays the PDF file with the correct characters for the
corresponding country (code page)



1. When the Stream file is created initially – What Code Page
should it be created as? (1252, 37, 284 or some other)



2. Do I need to translate the EBCDIC data to ASCII in my RPG
program before writing to the stream file?
or does the operating system do the translation for me since I
create the Stream file with Code Page 284?
What code page should the ASCII table be?



3. On the System in the US I can display the file in the IFS using
WRKLNK and it displays as if it were EBCDIC should the stream file
created with the system running code 284 display the same way?



Thanks for any help you can offer


John






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




--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>
--
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.