OOPS. My bad. At the beginning of the REXX exec, you need something like:

if syscalls('ON')>3 then
        do
        say 'Unable to establish the SYSCALL environment'
        return
        end

I keep forgetting that.

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group
HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[email protected]] On Behalf Of Uriel Carrasquilla
> Sent: Thursday, July 26, 2012 11:27 AM
> To: [email protected]
> Subject: Re: Using SSH or SCP in REXX under TSO
> 
> Hi John.
> is "bpxunix" something available?
> I am getting a "label" not found when the call to bpxunix is executed.
> Thanks.
> 
> ________________________________________
> From: IBM Mainframe Discussion List 
> [[email protected]] on behalf of McKown, John 
> [[email protected]]
> Sent: Thursday, July 26, 2012 10:55 AM
> To: [email protected]
> Subject: Re: Using SSH or SCP in REXX under TSO
> 
> Ah. I hadn't realized that you worked for a financial 
> institution. I know they are very regulated. We are not as 
> regulated, but HIPAA regs have made things a bit more 
> difficult for us too. Have you looked at the bpxunix 
> function? It allows you to run z/OS UNIX commands, 
> redirecting stdin, stdout, and stderr from REXX. It is 
> documented here:
> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPX
> ZB6A0/5.2
> 
> You might be able to do something like:
> 
> /* REXX */
> stdin.1='cd /unix/subdirectory'
> stdin.2='ls -la'
> stdin.3='scp unix.file user@UNIX:/tmp'
> stdin.4='ls -l /tmp/unix.file'
> stdin.0=4
> stdout.0=0
> stderr.0=0
> call bpxunix '/bin/sh -L',stdin.,stdout.,stderr.
> do i=1 to stdout.0
> say "stdout:"stdout.i
> done
> do i=1 to stderr.0
> say "stderr:"stderr.i
> done
> /* alternate:
> call bpxunix '/bin/sh -L','DD:STDIN','DD:STDOUT','DD:STDERR'
> and create
>  //STDOUT DD SYSOUT=*
>  //STDERR DD SYSOUT=*
>  //STDIN  DD *
>   scp.unix.fil user@UNIX:/tmp
>  /*
> 
> */
> 
> //RUNIT EXEC PGM=IKJEFT01,PARM='%DOUNIX'
> //SYSTSPRT DD SYSOUT=*
> //SYSEXEC DD DISP=SHR,DSN=pds.containing.rexx.above
> 
> Remember! that scp on z/OS does an EBCDIC to ASCII 
> translation. If you need a binary transfer,
> you'll need to use sftp.
> 
> --
> John McKown
> Systems Engineer IV
> IT
> 
> Administrative Services Group
> 
> HealthMarkets(r)
> 
> 9151 Boulevard 26 * N. Richland Hills * TX 76010
> (817) 255-3225 phone *
> [email protected] * www.HealthMarkets.com
> 
> Confidentiality Notice: This e-mail message may contain 
> confidential or proprietary information. If you are not the 
> intended recipient, please contact the sender by reply e-mail 
> and destroy all copies of the original message. 
> HealthMarkets(r) is the brand name for products underwritten 
> and issued by the insurance subsidiaries of HealthMarkets, 
> Inc. -The Chesapeake Life Insurance Company(r), Mid-West 
> National Life Insurance Company of TennesseeSM and The MEGA 
> Life and Health Insurance Company.SM
> 
> <snip>
> > > -----Original Message-----
> > > From: IBM Mainframe Discussion List
> > > [mailto:[email protected]] On Behalf Of Uriel Carrasquilla
> > > Sent: Wednesday, July 25, 2012 5:12 PM
> > > To: [email protected]
> > > Subject: Re: Using SSH or SCP in REXX under TSO
> > >
> > > I need to copy files from zOS 1.11 to a Unix machine on a
> > > regular basis (not to USS or Linux under zVM).
> > > I came across a sample REXX under the IBM web site to execute
> > > USS shell commands (not a JCL solution but Rexx).
> > > The /bin directory has ssh and scp.
> > > I set up the id_rsa.pub so I can now ssh into my zOS/USS and
> > > from there I can "scp" files to my Unix machine.
> > > Once I ssh into zOS/USS, I can also ssh from zOS/USS to the
> > > same Unix machine with the id_rsa.pub set up.
> > > The above ssh and scp can be accomplished without a password
> > > because of the id_rsa.pub that was set up on remote Unix machine.
> > > Known hosts was properly set up the first time I went from
> > > zOS to Unix machine.
> > > But my task is not to sign on from remote machine via SSH to
> > > zOS/USS.
> > > My work needs to be originated from zOS and in some cases 
> from TSO.
> > > The problem is that when I try to use my REXX from TSO, I
> > > cannot scp or ssh into my remote Unix machine.
> > > (yes, the one that when I used ssh to get to zOS/USS, I can
> > > go from there to my Unix machine - I hope I am not confusing
> > > everybody here).
> > > The REXX is using "BPXBATSL PGM /bin/scp uss-file
> > [email protected]:/tmp"
> > > I tried "BPXBATSL PGM /bin/ssh [email protected] 'ls" to no avail.
> > > I keep on getting a return code of 2 without anything in
> > > STDOUT or STDERR.
> > >
> > > Does anybody have a sample REXX that can be shared to either
> > > scp or ssh to remote Unix from TSO?
> > > I have seen JCL to that effect using BPXBATCH but I have not
> > > tried it since I need the REXX.
> > >
> > > ps/ I am able to get "BPXBATSL PGM /bin/ls" to work by going
> > > to USS and pulling the "ls" listing.
> > >
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 
> 
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to