The FTP2 (Start TCP/IP File Transfer) command allows the use of FTP
without entering the FTP subcommands. The subcommands are generated
internally and used to send a file to a remote system. A log of FTP
subcommands, errors, and information is kept to allow error
reporting.
FTP2 is restricted to the English language because error conditions
from FTP must be found by scanning text.
FTP requires the proper TCP/IP connections and configuration.
A separate command SBMFTP2 should be used to submit the FTP2 command
to batch (see the later discussion).
Some FTP connections may hang if either or both of the user ID or
password exceeds the maximum size supported by the FTP server.
For a simple front end to FTP2, see the SAVSNDL TAA tool. SAVSNDL
allows you to to send an entire library as a save file to a remote
system. The companion command RSTSNDL restores the library. Using
SAVSNDL avoids you having to consider the myriad of options and
subcommands that are supported by FTP.
The system supports a similar function to SAVSNDL with the SAVRSTLIB
command. SAVRSTLIB uses APPN. FTP2 uses TCP/IP.
For V6R1, the system does not support the EPSV sub command. This can
cause an error which can be avoided with OTHERCMDS('sendespv 0)'.
A typical FTP2 command would be:
FTP2 RMTSYS(xxx) RMTUSER(uuu) RMTPWD(ppp)
ACTION(*PUT) LCLFILE(xxx) RMTFILE(yyy)
This would transfer the file identified in the LCLFILE parameter to
the file identified in the RMTFILE parameter. When the FTP function
is complete, the internal log would be displayed of the FTP
operations. You should review this to ensure the correct function
occurred.
In V6R1, the system supported a standard that required a change to
prevent an escape message 'Subcommand 500 EPSV not valid' which
occurred when sending to a system prior to V6R1.
Remote secured server
---------------------
FTP2 can access secured FTP servers if they are using SSL(Secured
Sockets Layer) and the FTP server's digital certificate has been
properly imported to your system's certificate store. This requires:
** Digital Certificate Manager (DCM) Option 34 feature of
5761-SS1
** IBM HTTP Server Powered by Apache of i5/OS (5761-DG1)
** TCP/IP Connectivity Utilities for i5/OS (5761-TC1)
** IBM Developer Kit for Java (5761-JV1)
** If running prior to V5R4, IBM Cryptographic Access Provider
(5761-AC3 - 128 bit)
If the FTP server is using the ftps utility from SSH (Secure Shell
Network Utility) you must use IBM Portable Utilities for i5/OS
(5733-SC1).
If the remote site's FTP server is secured by SSL, FTP and FTP2 can
access its files specifying PORT(*SECURE) which causes port 990 to be
used. SECCNN(*DFT) and DTAPROT(*DFT) should also be used.
SBMFTP2 command
---------------
The command SBMFTP2 is intended for use when you want to submit the
FTP2 command.
SBMJOB can be used to submit the FTP2 command, but the value of the
RMTPWD parameter is left in the job log of the user that did SBMJOB.
To avoid leaving the password in the clear, you should use SBMFTP2.
All the parameters of FTP2 exist on the SBMFTP2 command plus the JOB,
JOBD, and JOBQ parameters. The additional parameters all have
default values.
The password value does not appear in the job log of the current user
if FTP2 is used interactively or SBMFTP2 is used. If FTP2 is
submitted to batch by either SBMJOB or SBMFTP2, the password value
does not appear in the job log of the submitted job.
Using FTP2 with a job scheduler
-------------------------------
If you use FTP, you must include a password with the command. The
FTP2 and SBMFTP2 commands prevent the password from existing in the
job log.
However, if you use a job scheduler, the command must be entered as
data and the password would exist as data.
To prevent the display of the password, you can do the following:
** Place the FTP2 command in a CL program and enter the CALL
command instead of FTP2 in a job scheduler.
** After the program is tested, recreate the program:
-- Specify LOG(*NO) and ALWRTVSRC(*NO) on CRTCLPGM.
-- Use CHGPGM RMVOBS(*ALL) to prevent a dump of the
program and its variable contents.
-- Change the source so your password does not exist
within the source.
Another alternative is the RTVMSKPWD tool. It will allow you to
retrieve the real password from a secure file in TAASECURE.
Log file
--------
A data base file is kept to log messages associated with FTP. The
default is FTPOUT in QTEMP with a member name of FTPOUT. The file is
a single field physical that is created by copying the model file
TAAFTPAP.
It would be possible to have a single log file for all uses of FTP2
and have unique member names. You could duplicate the TAAFTPAP file
and change it to allow multiple members.
FTP2 escape messages you can monitor for
----------------------------------------
TAA9877 FTP failed - see the log
Escape messages from based on functions will be re-sent.
FTP2 Command parameters *CMD
-----------------------
RMTSYS The name of the remote system. Up to 255 characters
may be entered. *NETADR may not be used. The
proper TCP/IP connections and configuration must
exist.
In some situations the name must be in the same case
as its host table entry.
RMTUSER The remote user name to be used to run a job on the
remote system. The user name must exist as a valid
profile on the remote system. A mixed case value of
up to 100 bytes may be entered.
RMTPWD The password for the remote user. A mixed case
value of up to 100 bytes may be entered.
If FTP2 is entered interactively, the password will
not appear in the job log of the current job.
If FTP2 is entered using SBMJOB, the password will
not appear in the job log of the batch job, but will
appear in the job log of the current job. Use the
SBMFTP2 command to avoid retaining the password in
the current job log.
See the previous section for how to prevent the
password from being seen if you submit the function
using a job scheduler.
ACTION The action to be performed. The following are
supported:
*OTHERCMDS. Allows no action to be performed other
than the commands entered in the OTHERCMDS parameter
to be run.
*OTHERCMD2. Allows no action to be performed other
than the commands entered in the OTHERCMD2 parameter
to be run.
*GET. Get a single file from the remote system.
*MGET. Get a file(s) from the remote system using a
generic name.
*PUT. Put a single file to the remote system.
*MPUT. Put a file(s) to the remote system using a
generic name.
*APPEND. Append a file on the remote system.
*DEL. Delete a single file on the remote system.
*MDEL. Delete a file(s) on the the remote system
using a generic name.
NAMEFMT Sets the local and remote naming format. The remote
format is only set for an i5 System. The default is
*LIB to use the library naming convention. '0' may
also be entered to mean use the library naming
convention.
For example,
Change remote directory:
cd libname
Get file member from current remote directory:
get filename.mbrname
Get file member specifying the library:
get libname/filename.mbrname
*IFS may be specified to use the IFS naming
convention. '1' may also be entered to mean use the
IFS naming convention.
For example,
Change remote directory:
cd /qsys.lib/libname.lib
Get file member from current remote directory:
- qsys.lib/libname.lib file system
get filename.file/mbrname.mbr
- root file system
get filename.extension
Get file from named remote directory:
- qsys.lib/libname.lib file system
get /qsys.lib/mylib.lib/myfile.file/+
mymbr.mbr
- IFS file system
get /dirname/filename.extension
TFRTYPE The file transfer type. The default is *BINARY
which means to transfer the file without
translation. This is required for save files and
image files.
*BIN may also be entered to mean *BINARY.
If the system you are communicating to is another
System i (AS/400), use the default.
*ASCII or *ASC may be entered to assume the remote
system does not support EBCDIC. This translates the
data from EBCDIC to ASCII when sending and from
ASCII to EBCDIC when receiving.
*EBCDIC or *EBC may be entered to assume the remote
system has EBCDIC. The data is not translated.
LCLDIR A character 2048 byte field that describes the local
directory. The default is *CURRENT to use the job's
current library (*CURLIB) if NAMEFMT(*LIB) is used.
If NAMEFMT(*IFS) is used the default becomes
*CURDIR.
*HOMDIR may be entered to use the user's home
directory if if NAMEFMT(*IFS) is used. *HOMEDIR may
also be entered to equate to *HOMDIR.
*CURLIB may be entered to use the job's current
library (*CURLIB) if NAMEFMT(*LIB) is used.
*CURDIR may be entered to use the job's current
directory if NAMEFMT(*IFS) is used.
*RMTDIR may be entered to use the name specified in
the RMTDIR parameter.
RMTDIR A character 2048 byte field that describes the
remote directory. The default is *RMTDFT which
means to use the directory as set by the remote
system.
The special value *LCLDIR may be used to mean the
name specified for the LCLDIR parameter.
LCLFILE A character 1024 byte field that describes the file
name to be used on the local system. The default is
*NONE meaning that no file is transferred. This
parameter is used by all actions except *DEL, *MDEL,
*OTHERCMDS, and *OTHERCMD2.
*RMTFILE may be specified to mean use the name as
specified in the RMTFILE parameter.
If ACTION(*MPUT) is used, LCLFILE(*) may be
specified to mean all files.
RMTFILE A character 1024 byte field that describes the file
name to be used on the remote system. The default
is *NONE meaning that no file is involved. This
parameter is used by all actions except *OTHERCMDS
and *OTHERCMD2.
*LCLFILE may be specified to mean use the name as
specified in the LCLFILE parameter.
If ACTION(*MGET) is used, RMTFILE(*) may be
specified to mean all files.
REPLACE A *YES/*NO parameter for whether to replace the
existing local file(s). *NO is the default meaning
do not replace.
*YES may be specified to replace the existing
file(s).
OTHERCMDS A 255 byte character field may be used to enter
other commands that will be executed on the remote
system. Up to 20 commands may be entered. *NONE is
the default meaning no other commands are to be
executed.
If commands are specified, the sequence of execution
is 1) all generated subcommands except for the one
specified by the ACTION parameter 2) OTHERCMDS and
3) the subcommand specified by the ACTION parameter.
This parameter is most useful for completed control
of the FTP session.
Note that subcommands are always generated from the
LCLDIR and RMTDIR parameters even when
ACTION(*OTHERCMDS) is specified.
OTHERCMDS2 A 950 byte character field may be used to enter
other commands that will be executed on the remote
system. Up to 20 commands may be entered. *NONE is
the default meaning no other commands are to be
executed.
If commands are specified, the sequence of execution
is 1) all generated subcommands except for the one
specified by the ACTION parameter 2) OTHERCMDS2 and
3) the subcommand specified by the ACTION parameter.
This parameter is most useful for completed control
of the FTP session.
Note that subcommands are always generated from the
LCLDIR and RMTDIR parameters even when
ACTION(*OTHERCMD2) is specified.
LOGFILE The qualified file and member to receive the log
generated by subcommands, errors, and feedback. The
default is the FTPOUT file in QTEMP using member
*FILE (the name of the file). The file and member
are created if they do not exist.
If a unique member name is required, consider the
use of the ADDUNQMBR command.
DSPLOGFILE A *YES/*NO parameter for whether to display the log
file that is created. *YES is the default to allow
you to review the results.
*NO may be specified to prevent the display of the
file. The file will still exist.
CLRLOGFILE A *YES/*NO parameter for whether to clear the log
file member when the command completes. The member
is automatically cleared when the command starts.
*NO is the default to not clear the member when the
command completes. The log may then be reviewed
with DSPPFM.
*YES may be specified to clear the member when the
command completes.
CCSID The ASCII coded character set identifier to be used
for single byte character set (SBCS) ASCII file
transfers when TYPE(*ASCII) is used. The default is
*DFT which causes the 00819 CCSID to be used.
The value is passed thru to the FTP command. See
the FTP command for additional information.
TBLFTPOUT The qualified name of the table to be used to map
all outgoing data. Outgoing data is mapped from
EBCDIC to ASCII. The default is *CCSID meaning to
use the CCSID value for mapping. If a table is
entered, the table is used for mapping.
*DFT may also be specified which has the same effect
as *CCSID.
The value is passed thru to the FTP command. See
the FTP command for additional information.
TBLFTPIN The qualified name of the table to be used to map
all incoming data. Incoming data is mapped from
ASCII to EBCDIC. The default is *CCSID meaning to
use the CCSID value for mapping. If a table is
entered, the table is used for mapping.
*DFT may also be specified which has the same effect
as *CCSID.
The value is passed thru to the FTP command. See
the FTP command for additional information.
PORT The decimal value that specifies the port number
that is used for connecting to the FTP server. *DFT
is the default to use the 'well known' port 00021.
*SECURE may be entered to use use port 00990 for
secure operations.
The value is passed thru to the FTP command. See
the FTP command for additional information.
SECCNN The secure connection to be used. *DFT is the
default to mean use *IMPLICIT if PORT(*SECURE) or
PORT(990) is specified. Otherwise *NONE is used.
*IMPLICIT may be entered if the FTP client attempts
to use TLS/SSL.
*SSL may be entered for requesting a protected
TLS/SSL session.
The value is passed thru to the FTP command. See
the FTP command for additional information.
DTAPROT Determines the type of data protection to be used.
*DFT is the default meaning if the SECCNN parameter
specifies a protected control connection, *PRIVATE
is used. Otherwise *CLEAR is used.
*PRIVATE may be specified to mean the information
that is sent is encrypted.
*CLEAR may be specified to mean the information that
is sent is not encrypted.
OUTQ The name of the output queue to be used for the log
file. The default is *JOB meaning the output queue
of the current job. *DEV may also be entered.
The value is only used if FTP2 is running in a batch
job not initiated by SBMFTP2. When FTP2 is running
as the result of SBMFTP2, the value is used on an
OVRPRTF command.
The OUTQ parameter is intended for use in CL
programs that run the FTP2 command synchronously.
SBMFTP2 command parameters *CMD
--------------------------
RMTSYS The name of the remote system or its IP address. Up
to 255 characters may be entered. *NETADR may not
be used. The proper TCP/IP connections and
configuration must exist.
In some situations the name must be in the same case as its host
table entry.
RMTUSER The remote user name to be used to run a job on the
remote system. The user name must exist on the
remote system. A mixed case value of up to 100
bytes may be entered.
RMTPWD The password for the remote user. A mixed case
value of up to 100 bytes may be entered.
If FTP2 is entered interactively, the password will
not appear in the command prompt nor the job log.
FTP2 is entered using SBMJOB, the password will
appear in the command prompt, but not in the job
log.
See the previous section for how to prevent the
password from being seen if you submit the function
using a job scheduler.
ACTION The action to be performed. The following are
supported:
*OTHERCMDS. Allows no action to be performed other
than the commands entered in the OTHERCMDS parameter
to be run.
*OTHERCMD2. Allows no action to be performed other
than the commands entered in the OTHERCMDS2
parameter to be run.
*GET. Get a single file from the remote system.
*MGET. Get a file(s) from the remote system using a
generic name.
*PUT. Put a single file to the remote system.
*MPUT. Put a file(s) to the remote system using a
generic name.
*APPEND. Append a file on the remote system.
*DEL. Delete a single file on the remote system.
*MDEL. Delete a file(s) on the the remote system
using a generic name.
NAMEFMT Sets the local and remote naming format. The remote
format is only set for i5 System. The default is
*LIB to use the library naming convention. '0' may
also be entered to mean use the library naming
convention.
For example,
Change remote directory:
cd libname
Get file member from current remote directory:
get filename.mbrname
Get file member specifying the library:
get libname/filename.mbrname
*IFS may be specified to use the IFS naming
convention. '1' may also be entered to mean use the
IFS naming convention.
For example,
Change remote directory:
cd /qsys.lib/libname.lib
Get file member from current remote directory:
- qsys.lib/libname.lib file system
get filename.file/mbrname.mbr
- root file system
get filename.extension
Get file from named remote directory:
- qsys.lib/libname.lib file system
get /qsys.lib/mylib.lib/myfile.file/+
mymbr.mbr
- IFS file system
get /dirname/filename.extension
TFRTYPE The file transfer type. The default is *DFT which
means to use the remote system's default which is
normally ASCII.
*ASCII or *ASC may be entered to assume the remote
system does not support EBCDIC. This translates the
data from EBCDIC to ASCII when sending and from
ASCII to EBCDIC when receiving.
*EBCDIC or *EBC may be entered to assume the remote
system has EBCDIC. No translation is performed.
*BIN or *BINARY may be entered to transfer data
without translation. This is required for save
files and image files.
LCLDIR A character 2048 byte field that describes the local
directory. The default is *CURRENT to use the job's
current library (*CURLIB) if NAMEFMT(*LIB) is used.
If NAMEFMT(*IFS) is used the default becomes
*CURDIR.
*HOMDIR may be entered to use the user's home
directory if if NAMEFMT(*IFS) is used. *HOMEDIR may
also be entered to equate to *HOMDIR.
*CURLIB may be entered to use the job's current
library (*CURLIB) if NAMEFMT(*LIB) is used.
*CURDIR may be entered to use the job's current
directory if NAMEFMT(*IFS) is used.
*RMTDIR may be entered to use the name specified in
the RMTDIR parameter.
RMTDIR A character 2048 byte field that describes the
remote directory. The default is *RMTDFT which
means to use the directory as set by the remote
system.
The special value *LCLDIR may be used to mean the
name specified for the LCLDIR parameter.
LCLFILE A character 1024 byte field that describes the file
name to be used on the local system. The default is
*NONE meaning that no file is transferred. This
parameter is used by all actions except *DEL, *MDEL,
*OTHERCMDS and *OTHERCMD2.
*RMTFILE may be specified to mean use the name as
specified in the RMTFILE parameter.
If ACTION(*MPUT) is used, LCLFILE(*) may be
specified to mean all files.
RMTFILE A character 1024 byte field that describes the file
name to be used on the remote system. The default
is *NONE meaning that no file is involved. This
parameter is used by all actions except *OTHERCMDS
and *OTHERCMD2.
*LCLFILE may be specified to mean use the name as
specified in the LCLFILE parameter.
If ACTION(*MGET) is used, RMTFILE(*) may be
specified to mean all files.
REPLACE A *YES/*NO parameter for whether to replace the
existing local file(s). *NO is the default meaning
do not replace.
*YES may be specified to replace the existing
file(s).
OTHERCMDS A 255 byte character field may be used to enter
other commands that will be executed on the remote
system. Up to 20 commands may be entered. *NONE is
the default meaning no other commands are to be
executed.
If commands are specified, the sequence of execution
is 1) all generated subcommands except for the one
specified by the ACTION parameter 2) OTHERCMDS and
3) the subcommand specified by the ACTION parameter.
This parameter is most useful for completed control
of the FTP session.
Note that subcommands are always generated from the
LCLDIR and RMTDIR parameters even when
ACTION(*OTHERCMDS) is specified.
OTHERCMDS2 A 950 byte character field may be used to enter
other commands that will be executed on the remote
system. Up to 20 commands may be entered. *NONE is
the default meaning no other commands are to be
executed.
If commands are specified, the sequence of execution
is 1) all generated subcommands except for the one
specified by the ACTION parameter 2) OTHERCMDS2 and
3) the subcommand specified by the ACTION parameter.
This parameter is most useful for completed control
of the FTP session.
Note that subcommands are always generated from the
LCLDIR and RMTDIR parameters even when
ACTION(*OTHERCMD2) is specified.
LOGFILE The qualified file and member to receive the log
generated by subcommands, errors, and feedback. The
default is the FTPOUT file in QTEMP using member
*FILE (the name of the file). The file and member
are created if they do not exist.
DSPLOGFILE A *YES/*NO parameter for whether to display the log
file that is created. This is the same parameter as
on FTP2, but is ignored because a batch job cannot
display the log file.
CLRLOGFILE A *YES/*NO parameter for whether to clear the log
file member when the command completes. The member
is automatically cleared when the command starts.
*NO is the default to not clear the member when the
command completes. The log may then be reviewed
with DSPPFM.
*YES may be specified to clear the member when the
command completes.
CCSID The ASCII coded character set identifier to be used
for single byte character set (SBCS) ASCII file
transfers when TYPE(*ASCII) is used. The default is
*DFT which causes the 00819 CCSID to be used.
The value is passed thru to the FTP command. See
the FTP command for additional information.
TBLFTPOUT The qualified name of the table to be used to map
all outgoing data. Outgoing data is mapped from
EBCDIC to ASCII. The default is *CCSID meaning to
use the CCSID value for mapping. If a table is
entered, the table is used for mapping.
*DFT may also be specified which has the same effect
as *CCSID.
The value is passed thru to the FTP command. See
the FTP command for additional information.
TBLFTPIN The qualified name of the table to be used to map
all incoming data. Incoming data is mapped from
ASCII to EBCDIC. The default is *CCSID meaning to
use the CCSID value for mapping. If a table is
entered, the table is used for mapping.
*DFT may also be specified which has the same effect
as *CCSID.
The value is passed thru to the FTP command. See
the FTP command for additional information.
PORT The decimal value that specifies the port number
that is used for connecting to the FTP server. *DFT
is the default to use the 'well known' port 00021.
*SECURE may be entered to use use port 00990 for
secure operations.
The value is passed thru to the FTP command. See
the FTP command for additional information.
SECCNN The secure connection to be used. *DFT is the
default to mean use *IMPLICIT if PORT(*SECURE) or
PORT(990) is specified. Otherwise *NONE is used.
*IMPLICIT may be entered if the FTP client attempts
to use TLS/SSL.
*SSL may be entered for requesting a protected
TLS/SSL session.
The value is passed thru to the FTP command. See
the FTP command for additional information.
DTAPROT Determines the type of data protection to be used.
*DFT is the default meaning if the SECCNN parameter
specifies a protected control connection, *PRIVATE
is used. Otherwise *CLEAR is used.
*PRIVATE may be specified to mean the information
that is sent is encrypted.
*CLEAR may be specified to mean the information that
is sent is not encrypted.
JOB The job name assigned to the batch job. The default
is FTP2. *JOBD may be entered to mean the name of
the job description.
JOBD The qualified name of the job description. The
default is *USRPRF meaning the job description
assigned to the current user profile.
If a specific job description is entered, a library
qualifier may be entered or the special values *LIBL
or *CURLIB.
JOBQ The qualified name of the job queue to be used. The
default is *JOBD meaning the job queue defined for
the job description specified for the JOBD
parameter.
OUTQ The qualified name of the output queue to be used
for the log file. The default is *CURRENT meaning
the output queue of the remote job.
A specific output queue and library may be named.
Restrictions
------------
The command is restricted to the English language because error
conditions from FTP must be found by scanning text.
The proper TCP/IP connections and configuration must exist.
Some FTP connections may hang if either or both of the user ID or
password exceeds the maximum size supported by the FTP server.
Prerequisites
-------------
The following TAA Tools must be on your system:
CHKIFSE Check IFS entry
DUPTAADBF Duplicate TAA data base file
RTVHOMDIR Retrieve home directory
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
FTP2 *CMD TAAFTPA QATTCMD
SBMFTP2 *CMD TAAFTPA2 QATTCMD
TAAFTPAC *PGM CLP TAAFTPAC QATTCL
TAAFTPAC2 *PGM CLP TAAFTPAC2 QATTCL
TAAFTPAC3 *PGM CLP TAAFTPAC3 QATTCL
TAAFTPAR *PGM RPGLE TAAFTPAR QATTRPG
TAAFTPAR *PGM RPGLE TAAFTPAR QATTRPG
TAAFTPAR2 *PGM RPGLE TAAFTPAR2 QATTRPG
TAAFTPAP *PF PF TAAFTPAP QATTDDS
Structure
---------
FTP2 Cmd
TAAFTPAC CL pgm
TAAFTPAR RPGLE pgm
TAAFTPAR2 RPGLE pgm
SBMFTP2 Cmd
TAAFTPAC2 CL pgm
TAAFTPAC3 is the validity checking program used by both commands.
|