As others have said, you need to feed the list-o-commands into the interpreting shell.

Another tool that should be recommended is 'sudo'. But I'll defer commentary on that just now for sake of brevity.

Don't fear "scripting".
The input to 'sh' or to 'su' can be from a USS file, but it can alternatively be a traditional sequential data set or a member of a PDS. The only lack when using data sets is they can't be marked as executable and turn "run" or "executed". But they can be fed to the shell, no problem! and that's a script, nothing more to it. Yeah, you can also embed it in the job, sure!

You attempted stacking commands. That doesn't always work because of context. You need for the interpreting shell to "see" the whole stack or queue, and it often only gets one at a time. (And I confess to not knowing the full nature of 'oshell'. Maybe that syntax is supposed to work?)

Variable length is much better than fixed length for feeding into the shell. But if all of the commands are shorter than your LRECL then you can often get away with fixed length.

-- R; <><


On 6/13/23 15:07, Radoslaw Skorupka wrote:
I need to issue several commands in batch, that means JCL job.
I know some ways to do it, but... but before I have to issue su command to get root authorities.
I put 'su' command before others, but it doesn't work.
Example:
//K EXEC PGM=IKJEFT01
//SYSTSIN DD *
 oshell su;mkdir a;mkdir b;other commands...

The stream works OK, but second and remaining commands failed due to lack of root authority.

Any clue how to use su and the commands?
I would like to avoid putting all the commands to the shell script, as that require puting the script into filesystem. Less portable.
Or maybe there is a method to run the script embedded in the jobstream?


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to