Troubleshooting
Problem
This document provides an example for a batch SFTP script.
Resolving The Problem
The two pieces for a batch SFTP script are as follows:
1. A CL program
2. An input file
The following is an example of a simple CL program that does an SFTP based on the commands in the input file:
PGM
QSH CMD('/QOpenSys/bin/sftp -b/Command_File_Path_name serverUserID@server')
ENDPGM
The parameters that must be customized to the environment follow:
/QOpenSys/bin/sftp -b - The IFS path is case sensitive. Within the CL program editor, use the F13 key to change the session defaults. Uppercase input only should be set to N.
Command_File_Path_name - The full path of the input file, for example (assuming a home directory of Test), /home/test/sftpcmd.txt. The IFS path for the
input file is also case sensitive.
serverUserID@server - This is the user ID the server admin has provided at the TCP/IP address or host name of the server.
PGM
QSH CMD('/QOpenSys/bin/sftp -b/Command_File_Path_name serverUserID@server')
ENDPGM
Input file (/home/test/sftpcmd.txt):
put filename (or get)
QUIT
Batch SFTP does not provide any indication of success or failure.
Note: The input file must be created with an ASCII text editor, in other words, Notepad. The input file needs to be placed somewhere in the IFS. FTP in binary mode can be used to transfer the file. Drag and drop with iSeries Navigator can also be used.
1. A CL program
2. An input file
The following is an example of a simple CL program that does an SFTP based on the commands in the input file:
PGM
QSH CMD('/QOpenSys/bin/sftp -b/Command_File_Path_name serverUserID@server')
ENDPGM
The parameters that must be customized to the environment follow:
/QOpenSys/bin/sftp -b - The IFS path is case sensitive. Within the CL program editor, use the F13 key to change the session defaults. Uppercase input only should be set to N.
Command_File_Path_name - The full path of the input file, for example (assuming a home directory of Test), /home/test/sftpcmd.txt. The IFS path for the
input file is also case sensitive.
serverUserID@server - This is the user ID the server admin has provided at the TCP/IP address or host name of the server.
PGM
QSH CMD('/QOpenSys/bin/sftp -b/Command_File_Path_name serverUserID@server')
ENDPGM
Input file (/home/test/sftpcmd.txt):
put filename (or get)
QUIT
Batch SFTP does not provide any indication of success or failure.
Note: The input file must be created with an ASCII text editor, in other words, Notepad. The input file needs to be placed somewhere in the IFS. FTP in binary mode can be used to transfer the file. Drag and drop with iSeries Navigator can also be used.
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]
Historical Number
463844526
Was this topic helpful?
Document Information
Modified date:
10 June 2020
UID
nas8N1014104