Command reference / ifs

CPYFRMSTMF

Copy From Stream File

Copies stream file data into a database file member or save file. A database member copy can convert the character encoding and reformat the data into records.

Allowed environments: *ALL. Positional parameters: 2.

Parameters

FROMSTMF From stream file

Sets the path name of the stream file from which data is copied. This command can operate on files of type *STMF and on the /dev/null character special file.

Type
*CHAR
Required
Yes
Length
5000
Case
Mixed case

TOMBR To file member or save file

Sets the path name of the database file member or save file to which data is copied. All directories in the path name must exist.

Type
*CHAR
Required
Yes
Length
5000
Case
Mixed case

MBROPT Member option

Controls whether the copy operation replaces, adds, or fails to copy the records if the object specified on the To file member or save file (TOMBR) parameter already exists. If the object does not exist, it is created.

Type
*CHAR
Required
No
Default
*NONE
Length
8
Case
Uppercase

Allowed values: *NONE, *ADD, *REPLACE

*NONE
No records are copied and the operation will fail if the object exists.
*ADD
The copied records are added to the end of the existing records.
*REPLACE
The copied records replace the existing records.

CVTDTA Data conversion options

Sets the process for converting the data from the stream file to the database file member. This parameter is ignored when copying to a save file.

Type
*CHAR
Required
No
Default
*AUTO
Length
5
Case
Uppercase

Allowed values: *AUTO, *TBL, *NONE

*AUTO
The data is converted during the copy operation using the coded character set identifier (CCSID) of the stream file and the database file CCSID.
*TBL
The data is converted using a conversion table. Only single-byte character sets are supported. The conversion table must be specified on the Conversion table (TBL) parameter.
*NONE
Only insertion of the sequence numbers and date stamp to source physical files and the optional removal of specified line-formatting characters from the stream file are performed.

STMFCCSID Stream file CCSID

Sets the method of obtaining the stream file coded character set identifier (CCSID) used for data conversion. This parameter is ignored when copying to a save file, or when CVTDTA(*TBL) or CVTDTA(*NONE) is specified.

Type
*DEC
Required
No
Default
*STMF
Length
5
Range
1 to 65533
Case
Uppercase

Suggested / special values: *STMF, *PCASCII

*STMF
The CCSID associated with the stream file specified on the From stream file (FROMSTMF) parameter is used for data conversion.
*PCASCII
Use the CCSID associated with the stream file specified on the From stream file (FROMSTMF) parameter to compute a CCSID in the Microsoft Windows encoding scheme (x4105). This CCSID is used if data conversion is requested.
1-65533
Enter the stream file CCSID to be used for data conversion.

DBFCCSID Database file CCSID

Sets the method of obtaining the database file CCSID used for data conversion. This parameter is ignored when copying to a save file.

Type
*DEC
Required
No
Default
*FILE
Length
5
Range
1 to 65533
Case
Uppercase

Suggested / special values: *FILE

*FILE
The database file CCSID is used, unless it is 65535. If the database file CCSID is 65535, and the file is not a program-described file, the operation will fail.
1-65533
Enter the database file coded character set identifier (CCSID). This option is valid only if the database file CCSID is 65535 or is the same as the CCSID specified. Otherwise, the operation will fail.

TBL Conversion table

Sets the path name of the conversion table to be used to convert data from the stream file to the database file member. Note: This parameter is required and valid only if CVTDTA(*TBL) is specified. This parameter is ignored when copying to a save file.

Type
*CHAR
Required
No
Length
5000
Case
Mixed case

ENDLINFMT End of line characters

Sets the end-of-line characters which are recognized in the stream file during copying of records. This parameter is ignored when copying to a save file.

Type
*CHAR
Required
No
Default
*ALL
Length
6
Case
Uppercase

Allowed values: *ALL, *CRLF, *LF, *CR, *LFCR, *FIXED

*ALL
Any single or double character combination of carriage-return and line-feed is appended to the end of each line.
*CRLF
Carriage-return followed by line-feed is appended to the end of each line.
*LF
Line-feed is appended to the end of each line.
*CR
Carriage-return is appended to the end of each line.
*LFCR
Line-feed followed by carriage-return is appended to the end of each line.
*FIXED
Text lines in the stream file are considered fixed-length records of the same length as the database file records to which they are to be copied. Any encountered CR, LF, or EOF characters are not stripped from the stream file.

TABEXPN Tab character expansion

Controls whether embedded tab characters are expanded to blanks up to the next eight-character tab position. This parameter is ignored when copying to a save file.

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *YES, *NO

*YES
Tab characters are not copied to the database file member. Any encountered tab character is expanded with blanks up to the next tab position. Note: If ENDLINFMT(*FIXED) is specified, *YES is not a valid value for this parameter.
*NO
Tab characters are copied to the database file member. No tab expansion occurs.

STMFCODPAG Stream file code page

Sets a code page value to be used when determining the stream file coded character set identifier (CCSID) to be used for data conversion. This parameter is ignored when copying to a save file.

Type
*DEC
Required
No
Default
*STMF
Length
5
Range
1 to 32767
Case
Uppercase

Suggested / special values: *STMF, *PCASCII

*STMF
If this value is specified, no code page processing is performed. The CCSID of the stream file specified on the From stream file (FROMSTMF) parameter is used for data conversion.
*PCASCII
Use the CCSID associated with the stream file specified on the From stream file (FROMSTMF) parameter to compute a CCSID in the Microsoft Windows encoding scheme (x4105). This CCSID is used if data conversion is requested.
1-32767
Enter the stream file code page. This value is then used to compute a stream file CCSID used for data conversion.

Examples

CPYFRMSTMF FROMSTMF('STMF.TXT') TOMBR('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYMBR.MBR')

Copies the data contained in stream file STMF.TXT in the current working directory to database file member /QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYMBR.MBR.

CPYFRMSTMF FROMSTMF('FINANCE.NEW') TOMBR('/QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR') CVTDTA(*TBL) STMFCCSID(437) TBL('/QSYS.LIB/QUSRSYS.LIB/TBL1.TBL') ENDLINFMT(*CRLF) TABEXPN(*NO)

Copies the data in stream file FINANCE.NEW in the current working directory to the database file member /QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR.

CPYFRMSTMF FROMSTMF('FINANCE.NEW') TOMBR('/QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR') CVTDTA(*NONE) ENDLINFMT(*FIXED)

Copies the data in stream file 'FINANCE.NEW' in the current working directory to the database file member /QSYS.LIB/FINANCE.LIB/STAFF.FILE/MNGR.MBR without data conversion.

CPYFRMSTMF FROMSTMF('/MYDIR/SOFTWARE') TOMBR('/QSYS.LIB/PACKAGE.LIB/SOFTWARE.FILE')

Copies the data contained in stream file /MYDIR/SOFTWARE to the save file /QSYS.LIB/PACKAGE.LIB/SOFTWARE.FILE. The stream file data is copied as fixed-length records with length of 528.

IBM command documentation

Generated from os/cl/catalog/CPYFRMSTMF.json and os/cl/help/CPYFRMSTMF.json.