Try

CHGVAR VAR(&QSHDOIT) VALUE('echo' *BCAT &MYSTR *CAT '; echo $?')


On 8/18/2020 5:30 PM, Patrik Schindler wrote:
Hello,

I'm trying to dynamically assemble a string to be forwarded to QSH for execution, but I'm most likely falling over the multiple apostrophes.

Actual CL program:

PGM
DCL VAR(&MYSTR) TYPE(*CHAR) LEN(5) VALUE('Hello')
DCL VAR(&QSHDOIT) TYPE(*CHAR) LEN(80)
CHGVAR VAR(&QSHDOIT) VALUE('echo'' *BCAT &MYSTR *CAT ''; echo $?')
QSH CMD(&QSHDOIT)
ENDPGM

Expected content of &QSHDOIT:
echo Hello; echo $?

Expected console output of qsh:
Hello
0

Instead, I get an error message stating, that there's no such command echo *BCAT &MYSTR *CAT.

What am I doing wrong here? I remember there was a discussion about a similar topic not too long ago, but I can't find it.

I hope, my mail client doesn't mess with the formatting.

Thanks!

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc




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.