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



Hiya Michael,

Wow, I can't believe I'm posting on Midrange.com. Last time I was here seems like a million years ago. My life has changed so much since then -- well, I digress.

Anyway, my apologies for the lack of clarity in some points of my old IFS book you were reading. It's a bit out of date, as it was written for V4R5, and at that time, CCSIDs were not available in the IFS (only code pages.) CCSIDs were added in V5R1. O_TEXT_CREAT support was added in V5R2. These are important features, and you should be using them today.

I think it bears emphasizing that the code point (often called "hex value") of a character only matters within context. You might say "The letter A is x'41'", for example -- and you might be right or wrong. Totally on, or totally off... We don't know, because you haven't given any context. The idea here is that there are tables that tell which letter/character/etc corresponds to which underlying "hex code" (or 'code point') and if you don't say which table you're looking at, you simply haven't given enough context!

So these tables, if you like, are called "code pages". And it's possible to have a collection of one or more code pages that fit together (possibly with ways of switching between them) to create a much more sophisticated way of encoding text called a CCSID. In the western world, we often use simple CCSIDs where there's really only one matching code page -- so we just use the same number for the CCSID or the code page. But, in richer alphabets, like those in Asia, they often need something more complex.

I'm probably getting too long winded here -- but hopefully some of this background info is useful to get you thinking the right way.

So. When you say "my data is 3C", what does that mean, exactly? It's 3C in which code page (or CCSID) in your program? And what is the destination CCSID that you're looking for? These are important to know.

Now, as for the open() API. Stop using O_CODEPAGE -- again, that's outdated. Use O_CCSID instead. With O_CCSID you tell the system that you want to use CCSID support (not code page, which is the default) when working with the IFS.

Also, make sure you use O_TEXTDATA when you want the API to perform translation. O_TEXTDATA means that your data is text (i.e. the bytes you write correspond to letters in a code page somewhere -- they're not just arbitrary bytes) and O_TEXT_CREAT, which means you want to enable translation even if the file does not exist. (Otherwise, it assumes the file should match what's in your program, since you're creating it from your program.)

f = open( '/path/to/file.txt'
: O_CREAT + O_TEXT_CREAT + O_CCSID




On 1/23/2013 7:33 AM, Michael Schutte wrote:
Thanks for the suggestion Jan. The file did create as 1252. However it
didn't resolve the issue with weird symbol and the truncation of another
symbol.

Talked with my boss and said that since the Bill Of Lading Prints with a
blank " ", then I can put in code to do the same thing. Anybody have a
suggestion? I was thinking that maybe using %XLATE rather than reading
each character in the string.

D nonDisplayChars...
D C
x'0001020304050607080910111213..39'
D replacewith C x'4040404040404040404040404...40'

mystring = %xLate(nonDisplayChars:replacewith:mystring);


Thoughts?


On Wed, Jan 23, 2013 at 2:39 AM, Jan Grove Vejlstrup <jgv@xxxxxxxx> wrote:

Hi Michael

Try to use this:

if unlink(ifsPathName) < 0;
// handle error here
endif;

fd = open(ifsPathName
: O_TEXT_CREAT+O_WRONLY+O_CCSID+O_CREAT+O_TEXTDATA
: S_IWUSR+S_IRUSR+S_IRGRP+S_IROTH
: 1252
: 0);
if fd < 0;
// handle error here
endif;

This will create a file tagged with CCSID 1252 (MS Windows, Latin-1).
Please note, that the CCSID for this code page with euro is 5348.
Details here:
http://www-01.ibm.com/software/globalization/ccsid/ccsid1252.html

If you convert an existing file, please check the CCSID of the file
(dspfd, dspffd) and the CCSID of your job (dspjob option(*dfna)).

Best regards

Jan

Am 22.01.2013 23:04, schrieb Booth Martin:
c eval fd = open('/ifstest/somefile.txt':
c O_CREAT+O_WRONLY+O_CODEPAGE:
c mode: 819)

I don't intend to accidentally mislead. The above is a copy & paste
from Scott Klement's web page I referenced earlier. My assumption is
that Scott got "mode:" where he wanted it. However I am not expert in
any way and can not make the case for or against. I am only reporting.

On 1/22/2013 3:33 PM, Michael Schutte wrote:
Quick question though...

I've seen twice now before the CCSID there's this parm that you are
passing
called mode What is this value?

On Tue, Jan 22, 2013 at 4:10 PM, Booth Martin <booth@xxxxxxxxxxxx>
wrote:

open(FileName:O_CREAT+O_TRUNC+O_WRONLY:
S_IRUSR + S_IWUSR + S_IRGRP+O_CODEPAGE: mode: 1252);


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.