IBM Support

Passing the TOSTMF File Name to a CL Program for Use with the CPYTOIMPF Command

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.

[{"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":"6.1.0"}]

Historical Number

357537331

Document Information

Modified date:
18 December 2019

UID

nas8N1015833