Just saw this. I was/am less interested in the Windows handling of this since I could already see it was incorrect on the i side. (Incorrect may be a matter of perspective here. I think the output is dead wrong, but this is an unsupported release so I simply seek a workaround.)

The clincher was when "head -3 myfile" returned thousands of "lines" from myfile, where I wanted (obviously, I think) only 3. The separators between those lines was not the LF that the 'head' command expected. (Me neither!)

"Jason Abreu" <jason.abreu@xxxxxxxxxxxxxxxxxxxx> wrote:

I was using ASCII control characters as an example. Windows text
editors typically look for the combination of CR and LF characters to
break a new line, whereas many Unix environments will recognize just
the
LF character.
Try to insert both characters into your print stream and see how the
Windows text editor handles it.

Jason Abreu
Abreu Innovations, Inc.
jason.abreu@xxxxxxxxxxxxxxxxxxxx
http://www.abreuinnovations.com/

On 3/9/2011 3:41 PM, Mark S. Waterbury wrote:
Oh, wow ... I thought this was going to be about Logical Files ...
*:-/*

> On 3/9/2011 3:32 PM, Dennis wrote:
I thought I had solved this problem ages ago... Here goes.

I have an ILE C program that I run from QSH via soft-link created a
la:
ln -fs /qsys.lib/mylib.lib/mypgm.pgm /home/thisguy/bin/myprogram

Program looks like this:
#include<stdio.h>
int main(int argc, char **argv) {
printf("Hello, world.\n") ;
printf("Hello, world.\n") ;
printf("You still here?\n!) ;
return 0 ;
}

(Exciting, I know.)

I can run this, and the output looks fine. I can also pipe my output
to a file (myprogram> /tmp/myfile.txt) and when I cat
/tmp/myfile.txt,
everything looks fine.

But it is not. The "new line" character has been translated to 0x85
(or x'85' if you prefer). Job CCSID is 37. Shell created the file as
CCSID 819. WRKENVVAR shows QIBM_CCSID = 819.

The reason I noticed this is that I sent a file like this to a
Windows
system using ASCII mode, and the Windows system shows no LF (of
course), and instead views it as one streamed line.

What would be the appropriate CCSID for me to use for such an
operation? Following on to that, should I (not) be able to specify
one
CCSID for most purposes and be done with it (assuming I'm only using
IBM i, Windows and Linux systems in US English)? Or is CCSID even
the
problem?!?! Maybe I should be using something other than "...\n" in
my
printf() ?

--
Sent from my Galaxy tablet phone with with K-9 Mail. Please excuse
my
brevity.
--
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.

--
Sent from my Galaxy tablet phone with with K-9 Mail. Please excuse my brevity.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.