× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Jerry,

I wanted a shell script driver CL (EXESHLSCR) so I could simplify my
running of shell scripts. Parm one would be the shell script. I made
the var 12 *char to to exactly match the size of the incoming parm to
eliminate any trailing blanks issue.

You can pass a variable if you want, but it needs to be null-terminated. (i.e. it needs to end with x'00').

Something like this (this is off the top of my head, untested, but I believe it'll work)

PGM PARM(&SHLSCR)

DCL VAR(&SHLSCR) TYPE(*CHAR) LEN(32)
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')
DCL VAR(&SHELL) TYPE(*CHAR) LEN(50)
DCL VAR(&CMD) TYPE(*CHAR) LEN(83)

CHGVAR VAR(&SHELL) VALUE('/qopensys/usr/bin/sh' *TCAT &NULL)
CHGVAR VAR(&CMD) VALUE(&SHLSCR *TCAT &NULL)

CALL QP2SHELL PARM(&SHELL '-c' &CMD)
ENDPGM


The preceding example uses the Bourne shell. You can replace the 'sh' (at the end of /qopensys/usr/bin/sh) with ksh for Korn shell, csh for c-shell, etc. Depending on which PASE shell you want to use... (I'm assuming the Bourne shell since your script name ends in '.sh')

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.