On 31-Oct-2011 12:09 , James Lampert wrote:
Is there some quick and easy way, under V6R1, to take EBCDIC text
passed as a parameter to a CL program, and make an ASCII stream file
from it?
A CLP as an example that might fit:
<code>
pgm parm(&inpstr)
dcl &inpstr *char 30
dcl &qshrqs *char 2000
dcl &outnam *char 30 'output.txt'
chgvar &qshrqs 'touch -C 819 '
chgvar &qshrqs (&qshrqs *bcat &outnam *tcat ';')
chgvar &qshrqs (&qshrqs *tcat 'echo "')
chgvar &qshrqs (&qshrqs *tcat &inpstr )
chgvar &qshrqs (&qshrqs *tcat '" > ' *bcat &outnam)
sndpgmmsg msg(&qshrqs) topgmq(*ext) tomsgq(*topgmq)
qsh cmd(&qshrqs)
endpgm
/* invocation example, input, final string, and outputs; */
/* final string on QSH shows how the ASCII stream file */
/* is created and how the parm data is output to an STMF */
CHGJOB CCSID(37) /* CCSID of input string is 37 */
CALL PGM(abovepgm) PARM('This is echoed.')
1000 - SNDPGMMSG MSG('touch -C 819 output.txt;echo "This is
echoed." > output.txt') TOPGMQ(*EXT) TOMSGQ(*TOPGMQ)
touch -C 819 output.txt;echo "This is echoed." > output.txt
1100 - QSH CMD('touch -C 819 output.txt;echo "This is echoed." >
output.txt')
DSPF output.txt /* F10=show hex: */
- - - - + - - - - * - - - - + - - - - * ----+----*----+----*
54686973 20697320 6563686F 65642E0A This is echoed.
</code>
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.