|
Hi Kelly, > My questions are: > (1) Can I set an environmental variable or something > so Qshell defaults to ASCII instead of EBCDIC when it > creates stream files? Each stream file is tagged with it's own CCSID. The Qshell utilities (and in fact, most OS/400 utilities) will automatically translate from & to that CCSID. (Naturally, the CCSID defaults to that of your job, which for most everyone is EBCDIC.) The "touch" utility in QShell can be used to create an empty file and assign it a CCSID. For example: rm outfile.txt (get rid of old copy w/wrong CCSID) touch -C 1252 outfile.txt (create w/windows 1252 CCSID. The -C MUST be captialized) grep "whatever" infile.txt > outfile.txt At this point, outfile.txt will be in CCSID 1252 (which is the most common ASCII used on Windows) > (2) Can I configure something so Qshell puts a CRLF at > the end of lines instead of line feeds or tabs? Because QShell is a unix-like interface, it uses the unix convention for ends of lines, which is "line feed" only (though unix people usually call them 'newlines') Off the top of my head, I can't think of an easy way to write out the extra CR. I can think of some complicated ones, but let's try something else first: One very easy solution to this is to open the file in Wordpad instead of Notepad :) Wordpad understands Unix end-of-line sequences and handles them nicely. > (3) Is there a Qshell utility that would let me find > and replace character sequences in stream files such > that I could replace all line feeds (or tabs) with > CRLF? Uhhh... There's sed, but the syntax is rather ugly. You could do this: rm outfile.txt touch -C 1252 outfile.txt grep "." infile.txt | sed "s/$/$(printf \\\\\\r)/g"> outfile.txt I imagine there's an easier way, but I can't think of what it might be...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.