Knowledge Shared (Beta)


Posted by: Bob Cozzi
IT Researcher
Cozzi Productions, Inc.
North Aurora, IL
Page 1403 has no ratings.
System i FTPSNDFILE CL Command Documentation
Updated: 03 Dec 2009 - 278 days ago
Last viewed on: 07 Sep 2010 (314 views)
System i FTPSNDFILE CL Command Documentation

Send File Using FTP (FTPSNDFILE)

Where allowed to run: All IBM i Environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Send File Using FTP (FTPSNDFILE) command allows you to send a single database member, a generic set of members or all members to a remote OS/400 file. Using this command avoids interactive FTP so users can submit their transfers to batch or run them interactively with less complexity.

Internally, FTPSNDFILE dynamically generates an FTP script and saves the FTP results log in source file members in QTEMP or a user-specified location.

Only the IP address, file name, user profile, and password are required.

Top

Parameters

Keyword Description Choices Notes
RMTSYS Remote IP or FTP server Character value Required, Positional 1
FILE Local file Qualified object name Required, Positional 2
Qualifier 1: Local file Name
Qualifier 2: Library Name, *LIBL
MBR Local member Generic name, name, *FILE, *FIRST, *LAST, *ALL Optional, Positional 3
TOFILE Remote file Qualified object name Optional, Positional 4
Qualifier 1: Remote file Name, *FROMFILE
Qualifier 2: Library Name, *FROMLIB
TOMBR Remote member Name, *FROMMBR, *TOFILE Optional, Positional 5
REPLACE Replace data on remote system *YES, *NO Optional, Positional 6
USER Remote FTP User ID Character value, *CURRENT Optional, Positional 7
PWD Remote FTP Password Character value, *USERID Optional, Positional 8
MODE Transfer mode *BINARY, *TEXT, BINARY, ASCII, TEXT Optional, Positional 9
SRCFILE Src file to receive FTP script Qualified object name Optional, Positional 10
Qualifier 1: Src file to receive FTP script Name, QFTPSRC
Qualifier 2: Library Name, QTEMP, *LIBL
SRCMBR Script source member Name, *FROMMBR, *GEN Optional, Positional 11
LOG FTP log file Single values: *STDOUT, *STDIO, *SRCFILE, *NONE
Other values: Qualified object name
Optional, Positional 12
Qualifier 1: FTP log file Name, QFTPLOG
Qualifier 2: Library Name, QTEMP, *LIBL
LOGMBR Log member Name, *FROMMBR, *SRCMBR, *SCRIPT Optional, Positional 13
DSPLOG Display FTP transfer log *YES, *NO Optional, Positional 14
Top

Remote IP or FTP server (RMTSYS)

Specify the IP address or domain name of the system that will receive the file you are sending.

Top

Local file (FILE)

Specify the qualified name of the file that you want to send using FTP. A value of *LIBL may be specified for the file's library. However, the FTPSNDFILE command's processing program will convert *LIBL into the actual library name at runtime. It uses the QUSROBJD (Retrieve Object Description) API to accomplish this.

Top

Local member (MBR)

Specify the name (generic*, full, or *ALL) of the member(s) you want to transfer.

The following special values are also supported:

*FIRST
The first member in the local file is transferred. This value must be specified when a generic local member name or when *ALL is specified for the local member name (MBR) parameter.
*LAST
The last member in the local file is transferred.
*FILE
The member whose name is the same as the local file name is transferred.
*ALL
All members in the local file are transferred. When *ALL is specified, the FTP command MPUT (multiple-PUT) is used instead of PUT. When *ALL is specified, the REPLACE parameter is ignored. Any existing members in the remote file whose names match that of a member in the local file are replaced with the new data, (i.e., REPLACE(*YES) is implied.)
Mmmm*
All members beginning with the Mmmm pattern are transferred. At least one character followed by an asterisk (*) must be specified to be considered a valid generic member name. Example: AP* All members beginning with the letters 'AP' are transferred.
Top

Remote file (TOFILE)

Specify the name of the file that receives the data from the local file. The file should already exist on the remote system so that the external definition is preserved. If the file does not exist, the FTP server will create the file for you, but you won't like the results as it will be a so called "flat file" (i.e., no external description will be associated with the new file). If it already exists, this issue does not apply.

Top

Remote member (TOMBR)

Specify the name of the member into which the data is stored. You may specify either a member name or one of the following special values:

*FROMMBR
Use this when the remote member name should be the same as the local member name as specified on the MBR parameter. *FROMMBR must be specified when a generic name or *ALL is specified on the local member name (MBR) parameter.
*TOFILE
The member name is the same as the remote file name specified on the TOFILE parameter.
Top

Replace data on remote system (REPLACE)

Replace remote member's data. This parameter controls whether data is added or replaced in the remote member.

*YES
The data in the remote member is replaced with the FTP'd data. If the remote member does not exist, it is added to the remote file. If FROMMBR(*ALL) is specified, this parameter is ignored and REPLACE(*YES) is "forced". Internally, the FTP PUT command is used to send the member when REPLACE(*YES) is specified, unless FROMMBR(*ALL) is also specified, in which case MPUT is used to send the member(s).
*NO
The data is added to any existing remote file member. If the member does not exist, it is added to the file. Internally, the FTP APPEND command is used to send the member. If FROMMBR(*ALL) is specified, REPLACE(*NO) is ignored and REPLACE(*YES) is "forced".
Top

Remote FTP User ID (USER)

Specify the user profile name for the remote system. This user profile is used to sign on to the remote FTP server. You must also specify a password for this user program on the PWD parameter.

Top

Remote FTP Password (PWD)

Specify the password for the remote user. Note that this parameter's value is not recorded in the joblog and must be entered each time you run the FTPSNDFILE command from Command Entry.

From within a CL program, the password may be stored in a CL variable and passed on this parameter.

The following special value may also be specified:

*USER
The user profile specified on the USER parameter is also the password. This is only useful when the user ID and password are identical. Some installations create special FTP User IDs with the User Profile and passwords being the same, but this is not recommended.
Top

Transfer mode (MODE)

Specify the kind of transfer to be performed. The valid choices are as follows:

*BINARY
The transfer mode is IMAGE/BINARY. This is recommended for iSeries objects such as database files.
*ASCII
The transfer mode is plain ASCII text. This transfer mode is valid for non-database files, such as source file members, but typically doesn't add value for iSeries to iSeries transfers.
Top

Source file that receives generated FTP script (SRCFILE)

The name of the source file that receives the generated FTP script. This source file should be as long as possible but at least 152 bytes in length (140 bytes for the source line and the usual 12 bytes for the source sequence and change-date area).

If this source file does not exist, it will be created with a record length of 152 bytes. The default source file name is as follows:

QFTPSRC
The file QFTPSRC in QTEMP is used as the FTP script source file.

The default library name is QTEMP.

Top

Script source member (SRCMBR)

The FTP script source member name. This is the name of the member into which the FTP script is generated. Specify any valid source member name, *FROMMBR, or *GEN. If the member exists, it is cleared; if it does not exist, it is added. The two special values for this parameter are as follows:

*FROMMBR
The name specified on the MBR parameter is used as the member name for the FTP script. This member is added to the source file specified on the SRCFILE parameter.
*GEN
A member name using the following pattern is automatically generated: FSyyyymmdd, where FS is a constant, and YYYYMMDD is today's system date in YMD format.
Top

FTP log file (LOG)

FTP run log file. Specify the name of a source file that will receive the log from the FTP session. Optionally, specify that the messages are to be delivered as they normally are, via the STDOUT (standard output) device.

Unlike the SRCFILE parameter, the file specified on the LOG parameter must exist because the FTPSNDFILE command will not create it. You may, however, use the same file name as the SRCFILE parameter, in which case the file is created due to its being specified on the SRCFILE parameter.

This parameter has the following special values:

*STDOUT
Indicates that the FTP log is written to the standard output device, which scrolls up the 5250 screen, similar to an old teletype interface.
*STDIO
Same as *STDOUT.
*SRCFILE
The source file and library name specified on the SRCFILE parameter are used as FTP LOG file.
*NONE
No FTP log is maintained.
Top

Log member (LOGMBR)

The member name where the FTP log is saved. The following special value is also supported:

*FROMMBR
The name of the member specified on the MBR parameter is used as the FTP log file member name.
*SCRIPT
The name of the member specified on the SRCMBR parameter is used as the FTP log file member name. *SRCMBR may also be specified.
Top

Display FTP transfer log (DSPLOG)

Display the FTP log. If *YES is specified, the FTP log is displayed when the FTP transfer completes; if *NO, the FTP log is not displayed.

Top

Examples

None
Top

Error messages

Unknown
Top
Return to ClassANova.com home page.