AW: Re: IKJ56500I COMMAND OPUTX NOT FOUND

2014-12-17 Thread Peter Hunkeler
Forget all those Irish commands (OGET, OPUT, etc.) and start unsing UNIX 
commands. Here are two JCL's I'm using to run UNIX commands in batch:
//  EXPORT SYMLIST=*//  SET  DIR='newdir'//UNIXCMDS   EXEC 
PGM=BPXBATCH
//STDINDD  DUMMY
//STDOUT   DD  SYSOUT=*
//STDERR   DD  SYSOUT=*
//SYMRESDD DD  SYSOUT=*
//STDPARM  DD  *,SYMBOLS=(JCLONLY)
SH
  cd /some/directory ;
  ls -l ;  mkdir -m 700  DIR./*

Note that STDPARM is the BPXBATCH vatiant of PARMDD, and don't confuse them. 
You start with the usual SH to tell BPXBATCH to run a shell. All the rest of 
STDPARM is input to that shell, so you need to adhere to shell command line 
syntax. Chain multiple commands with the ;. Note also that you must not try 
to insert comment, because the first # will start a comment that goes to the 
end of STDPARM.
Advantage: You can user JCL symbols (and if your jobclass allows it, also 
system symbols) in the UNIX commands.


The second job is solving the problem of running commands via su in batch. 
Its not perfect, but mostly does the trick for me. First, there is a JCL 
procedure:


//BPXSU   PROC SOUT='*',TMP='tmp-command-file-for-BPXSU-job'
//INPUT   EXEC PGM=IEBGENER
//SYSPRINT  DD DUMMY
//SYSIN DD DUMMY
//SYSUT1DD DDNAME=COMMANDS
//SYSUT2DD PATH='/tmp/SYSUID-TMP',
// PATHDISP=(KEEP,DELETE),
// PATHOPTS=(OWRONLY,OCREAT,OEXCL),
// PATHMODE=(SIRUSR,SIWUSR)
//EXECUSS EXEC PGM=BPXBATCH,PARM='SH su'
//STDOUTDD SYSOUT=SOUT.
//STDERRDD SYSOUT=SOUT.
//STDIN DD PATH='/tmp/SYSUID-TMP',
// PATHDISP=(DELETE,DELETE)
//STDPARM   DD DUMMY

Second, here is how to use it:
//  EXPORT SYMLIST=*//  SET FILE='somefile'//UNIXCMDS 
EXEC BPXSU//COMMANDS DD *,SYMBOLS=(JCLONLY) ls -l ; chown foo:bar FILE./*

The rules for COMMANDS are similar to the above. Note that this is STDIN, not 
STDPARM, so the SH is not need.
Also, fi system symbols are allowed, the you can make the temp file name more 
unique using date, time or other system symbols.

--
Peter Hunkeler



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: AW: Re: IKJ56500I COMMAND OPUTX NOT FOUND

2014-12-17 Thread Paul Gilmartin
On Wed, 17 Dec 2014 09:48:45 +0100, Peter Hunkeler wrote:

Forget all those Irish commands (OGET, OPUT, etc.) and start unsing UNIX 
commands.  ...

Note that STDPARM is the BPXBATCH vatiant of PARMDD, and don't confuse them.  
You start with the usual SH to tell BPXBATCH to run a shell. All the rest of 
STDPARM is input to that shell, so you need to adhere to shell command line 
syntax. Chain multiple commands with the ;. Note also that you must not try 
to insert comment, because the first # will start a comment that goes to the 
end of STDPARM.

You might bootleg a comment in with such as:

: ' -
This serves as a comment.
I have not tested it on z/OS BPXBATCH.
It must contain no apostrophes.
- '

Advantage: You can user JCL symbols (and if your jobclass allows it, also 
system symbols) in the UNIX commands.

With z/OS 2.1 and higher.
Jobclass?  Are system symbols considered secret/sensitive?

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


AW: Re: IKJ56500I COMMAND OPUTX NOT FOUND

2014-12-17 Thread Peter Hunkeler
 THAT IS AWESOME! Wow! Thanks,

You're welcome.




I recognize from seeming my onw post that it has been reformatted in a bad way. 
A couple of line feeds have been dropped. Hope you can decifer the samples 
anyway. If not, tell me and I will try reposting them.


--


Peter Hunkeler



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: AW: Re: AW: Re: IKJ56500I COMMAND OPUTX NOT FOUND

2014-12-17 Thread Paul Gilmartin
On Wed, 17 Dec 2014 16:32:33 +0100, Peter Hunkeler  wrote:

 Advantage: You can user JCL symbols (and if your jobclass allows it, also 
 system symbols) in the UNIX commands.

 With z/OS 2.1 and higher.
 Jobclass?
 Are system symbols considered secret/sensitive?

I guess, no. I imagine this is more to be able to selectively switch this 
feature on to protect from side effects in existing JCL.
 
Dammit!  As I said before, ab ovo an apparent reference to an undefined symbol
such as:

//SYSUT2  DD  DISP=(,PASS),DSN=SYSUT2

... should have been treated as a syntax error.

(Shmuel has pointed out that the behavior can't be introduced now;
it would break vast amounts of existing JCL.)

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


AW: Re: IKJ56500I COMMAND OPUTX NOT FOUND

2014-12-17 Thread Peter Hunkeler

 Yeah but that's only as of z/OS 2.1 ?.as a ISV we support backlevel versions 
 also ?so one has to come up with two solutions ?

If you need the symbol substitution, then yes, this requires z/OS V2.1. The 
STDPARM has been there at least in V1.13.


--


Peter Hunkeler



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN