|
On Fri, 20 Dec 2002, Karl Keller wrote: > > I have developed/cloned the following manual process: > > 1. Copy the file to my IFS directory. > > 2. From a command prompt type in STRQSH and press enter > > 3. Use Qshell's stream editor, sed, to convert the tilde characters to > line-feed characters: [SNIP] What are you going to do with the resulting data? Presumably, process it with a program that you're writing? Why not just read the stream file directly in that program, and deal with the tilde's as record delimiters? That just seems like it would be more efficient... tho, maybe more work. [SNIP] > Question 1: I would like to run the STRQSH in a CL. Is there a way to use > the the hex value for a carriage return in a Qshell command? Actually, you want the hex value for a line feed (LF), not carriage return. This works on my system: PGM DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(100) DCL VAR(&LF) TYPE(*CHAR) LEN(1) VALUE(X'25') CHGVAR VAR(&QSHCMD) VALUE('cd /home/kkeller && + sed ''s/~/\' *CAT &LF *CAT '/g'' + <infile >outfile') STRQSH CMD(&QSHCMD) ENDPGM > > Question 2: Can I use CL variables for STDIN and STOUT? > I don't understand what you mean by that. If you mean you want to use variables for "infile" and "outfile", you can use variables and just concatenate them to make the string before you send it to Qshell... similar to the way I did the &LF, above. If you mean you want to store the data that will be read on sed's stdin in a variable, and put the stdout that it sends back into another variable, then... well, I guess it's possible, but not really practical. At that point, it would be easier to just process the file in your RPGIV or C or whatever language program in the first place.
As an Amazon Associate we earn from qualifying purchases.
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.