Hi,
 
you can do that very easily, with pragma convert in z/OS and z/VM:
 
http://www-01.ibm.com/support/knowledgecenter/SSB27U_6.2.0/com.ibm.zos.r12.cbclx01/zos_pragma_convert.htm
 
The compile will convert it at compile time but it remains readable in the 
source.
That would be useful these days in COBOL or PL/I as well.
 
However a sample will look like this (1208 is a Unicode codepage):
#pragma convert(1208)
const char[]=ISO8859-1("This is an ISO8850-1 encoded string");
#pragma convert(pop)
 
I have not tried it with #pragma convert("ISO8859-1"), but according to the C 
compiler docs this should work.

Hope it helps.
Denis.
 
-----Original Message-----
From: Bernd Oppolzer <bernd.oppol...@t-online.de>
To: IBM-MAIN <IBM-MAIN@LISTSERV.UA.EDU>
Sent: Mon, Nov 3, 2014 4:49 pm
Subject: Re: C Language: non-EBCDIC characters in literal strings.


Given the limitations of C and its macro language,
it is hard ... if not impossible ... to do such initializations
with const chars at compile time using the features of the
macro language.

It's of course easy to build macros like the ones I did
for string assignment, which, for example, assign strings
with respect to the length of the target buffer, fill strings with
blanks etc. (if the sending field is shorter) and so on ...
all by using C macro language and clever use of
memcpy et. al.

You can, while assigning strings using such functions,
do any code conversion you want, using simple
table driven translations or other conversion routines
like, for example, iconv ().

HTH,
kind regards

Bernd



Am 03.11.2014 16:09, schrieb John McKown:
> OK, unless I'm really missing something, this is a "no way" proposition.
> What I could really use is a _simple_ way to create non-EBCDIC literal
> strings. So that I could easily do somethng like:
>
> const char[]=ISO8859-1("This is an ISO8850-1 encoded string");
>
> Yes, I could just render that in "escape sequences". But that is _ugly_ and
> not as easily (intuitively) understood. Or I could use iconv() to convert
> it at run time.
>
> And ideas no how to accomplish my goal - easily?
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

 


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to