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




Hi Erik,

Sorry this is so late in the day. I tried this on 6.1, but I got the
expected results. Here is the small program I wrote:

#pragma convert(278)
char *specchar = "ÉÜÅÄÖ";
#pragma convert(0)

int main(void) {
int i;
for (i = 0; i < strlen(specchars); i++) {
printf("%02x", specchars[i]);
}
printf("\n");
}

The output was "e0fc5b7b7c". I tried this with a CCSID 37 source file in a
file member, with a CCSID 819 source file in IFS, and with a CCSID 865 file
in IFS. I also tried this with a job CCSID of 278, and with TGTCCSID of
278. In each case I got the correct output.

Is it possible that the data in your IFS file is incorrect? Use WRKLNK,
navigate to the IFS file and use option 5 for display, then press F10 to
see the Hex values. The string should have the value 0x909A8F8E99 in CCSID
865.

Aaron Albertson


c400-l-bounces+albertaa=us.ibm.com@xxxxxxxxxxxx wrote on 03/04/2011
08:52:27 AM:

From: Erik Olsson <erik.eo.olsson@xxxxxxxxx>
To: "C programming iSeries / AS400" <c400-l@xxxxxxxxxxxx>
Date: 03/04/2011 08:54 AM
Subject: [C400-L] pragma convert of string literal
Sent by: c400-l-bounces+albertaa=us.ibm.com@xxxxxxxxxxxx

I'm having problems with #pragma convert.

I'm compiling a C module using a source file with CCSID 865 residing
in the IFS. My job CCSID is 278, I'm on 6.1. The CCSID of the module
is 37, regardless of what I'm specifying on the TGTCCSID command.

Even though I have this:
#pragma convert(278)
char *specchars = "ÉÜÅÄÖ";
#pragma convert(0)

... the hex representation of this string is "3542a2075", when it
should read "e0fc5b7b7c", i.e. no conversion to CCSID 278 is taking
place. I don't see any caveats in the manual that could explain this
behaviour.

Suggestions anyone? For now I'm using direct hex comparison instead
but I'd prefer to get the pragma working.

Regards,
Erik
--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.

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.