> user_host = ******************* /* Sorry! */ > source_file = ******************* For the user_host, I used my userid@host-name For the source_file, is it a USS file? or can it be a zOS file?
> 'open (source_file)' O_RDONLY reads the file but where is it used? > map.1 = 1 > map.2 = 2 shouldn't these two parameters be pointing to STDOUT and STDERR recpectively? > 'spawn /bin/ssh 3 map. arg. env.' > say RC RETVAL wouldn't this just give me the PID in RETVAL? A "-1" would mean that it did not spawn. I would expect ERRNO to contain the actual return code. Or I may have to use: 'waitpid (spid) waitpid. 0' xrc = waitpid.W_EXITSTATUS To get the actual return code for the spawn child. ________________________________________ From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Paul Gilmartin [paulgboul...@aim.com] Sent: Wednesday, July 25, 2012 8:10 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Using SSH or SCP in REXX under TSO On Wed, 25 Jul 2012 22:12:01 +0000, Uriel Carrasquilla wrote: > >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. > Crudely (error recovery is left as an exercise for the student), but it works: /* Rexx */ signal on novalue; /* Doc: Using ssh from a Rexx EXEC. run on ******** or ???????? */ trace R user_host = ******************* /* Sorry! */ source_file = ******************* parse source . RC = SYSCALLS( 'ON' ) address 'SYSCALL' 'open /dev/null' O_RDWR /* busy out stdin, stdout, stderr. */ 'open /dev/null' O_RDWR 'open /dev/null' O_RDWR say RC RETVAL 'open (source_file)' O_RDONLY stdin = RETVAL map.0 = stdin map.1 = 1 map.2 = 2 arg.1 = 'ssh' arg.2 = user_host arg.3 = 'set -x; cat >foo-sshtest; echo done' arg.0 = 3 env.1 = 'PATH=/bin:/usr/sbin' env.0 = 1 'spawn /bin/ssh 3 map. arg. env.' say RC RETVAL 'close' stdin say RC RETVAL exit( RC ) -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN