Troubleshooting
Problem
This document provides a sample CL code for passing a variable file name to the TOSTMF parameter of the CPYTOIMPF command.
Resolving The Problem
Example
The following is an example, written in CL, for using a variable in the TOSTMF path name for the CPYTOIMPF command:
*************** Beginning of data *******************************************************
PGM PARM(&PATH)
DCL VAR(&PATH) TYPE(*CHAR) LEN(10)
DCL VAR(&TARGET) TYPE(*CHAR) LEN(256)
CHGVAR VAR(&TARGET) VALUE('/dir1/dir2/' || &PATH)
CPYTOIMPF FROMFILE(library/DBfile) TOSTMF(&TARGET) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF)
MONMSG MSGID(CPF0000)
ENDPGM
****************** End of data **********************************************************
To pass the parameter of the TOSTMF file name on the CALL statement, on the IBM® OS/400® or IBM® i5/OS™ command line type the following:
CALL clpgm PARM(file1.csv)
Note: Any further assistance in coding programs to pass variables to the CPYTOIMPF command can require a consulting agreement.
Historical Number
357537331
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1015833