Hello all.
(Newbie to sFTP and COZBATCH.)
We have a situation using current FTP (communicating between Z/OS mainframe and Windows server) in which an Assembler program invokes FTP, issues a directory command, retrieves the directory and does some processing based on the directory retrieved. There is a corporate mandate to convert all FTP to sFTP. We have sucessfully done this with file transfers via COZBATCH which is invoked from within standard Z/OS jobs. Is this doable using COZBATCH invoked from within a program? Is the format of the directory different than that returned by standard FTP?
Thanks for any insights.
Steve
Invoke SFTP or COZBATCH from Z/OS program
Re: Invoke SFTP or COZBATCH from Z/OS program
You can invoke COZBATCH to invoke a z/OS Unix shell script which runs cozsftp.
To do it, you will want to allocate the COZBATCH DDs that you want and then invoke COZBATCH using ATTACH (as a subtask). If you use LINK then it will probably work for one invocation but it will fail the second time since the IBM C/LE runtime environment will fail to initialize.
Also, note that running z/OS Unix programs will often result in other OMVS address spaces being created.
Take for example your assembler program. Here would be the address space and task structure:
AS#1
Your assembler PGM
COZBATCH
/bin/sh
cozsftp
AS#2
/bin/ssh (forked by cozsftp, but is not eligible to run in same AS)
One idea is that you use a shell script that front-ends our sample batch "sftp_connect.sh" script. In your script you can build up the commands from input from a DD and invoke sftp_connect.sh to do the rest. Then all you have to do is to execute COZBATCH with PARM='/ /your/script'
We would be happy to help you with your application since your company has an enterprise support agreement. I will contact your support contact and let them know.
To do it, you will want to allocate the COZBATCH DDs that you want and then invoke COZBATCH using ATTACH (as a subtask). If you use LINK then it will probably work for one invocation but it will fail the second time since the IBM C/LE runtime environment will fail to initialize.
Also, note that running z/OS Unix programs will often result in other OMVS address spaces being created.
Take for example your assembler program. Here would be the address space and task structure:
AS#1
Your assembler PGM
COZBATCH
/bin/sh
cozsftp
AS#2
/bin/ssh (forked by cozsftp, but is not eligible to run in same AS)
One idea is that you use a shell script that front-ends our sample batch "sftp_connect.sh" script. In your script you can build up the commands from input from a DD and invoke sftp_connect.sh to do the rest. Then all you have to do is to execute COZBATCH with PARM='/ /your/script'
We would be happy to help you with your application since your company has an enterprise support agreement. I will contact your support contact and let them know.
-
- Posts: 3
- Joined: Thu Feb 27, 2014 4:51 pm
Re: Invoke SFTP or COZBATCH from Z/OS program
I have it basically working using ATTACH/DETACH, but all this // BIN/SH and UNIX stuff is Greek to me. Where can I find out what that's all about?
Re: Invoke SFTP or COZBATCH from Z/OS program
COZBATCH is a utility that runs z/OS Unix programs.
If you want to run cozsftp, you will need to wrap it in a shell script.
See the COZBATCH documentation for PARM and DD reference info:
https://dovetail.com/docs/cozbatch/index.html
If you want to run cozsftp, you will need to wrap it in a shell script.
See the COZBATCH documentation for PARM and DD reference info:
https://dovetail.com/docs/cozbatch/index.html