Copy a file from a AS400 Server

Luis Gomez

Member
Hi, everyone

I'm trying to do something simple like a copy file from one folder to another one.

I use the B4700230 (DeleteOrCopyFlatFile) with the path in DOS (Client), something like (\\serverfiles\NewFiles\PRB.txt) to the New path (\\serverfiles\NewFiles\NewFolder\PRB.txt) with a "2" to copy and this works fine.

But when I run the Batch in server, I have to use the IFS format for that (AS400), the IFS folder is NEWFILES/PRB.TXT to NEWFILES/NEWFOLDER/PRB.TXT with the same "2" to copy but this doesn't work.

I read in this same forum that I have to use the "Execute External Program" BSFN to do that, but I donn't know how I have to do the sentence to execute the command right. I try with "CMD CPY OBJ('NEWFILES/PRB.TX') TODIR('NEWFILES/NEWFOLDER/PRB.TXT')" like the command line, but nothing happens
frown.gif


Someone knows how I have to do that?

Thanks for your help!
 
Hi,

I think you're missing the initial '/' character
-> cpy obj('/newfiles/prb.txt') todir ('/newfiles/
newfolder/prb.txt')

I'm also not sure if the todir parameter requires
the complete file name or just the destination folder,
in that case it would be todir('/newfiles/newfolder')

Have a nice evening
 
Hi,

Try the following command...

For IFS:

'CPYTOSTMF FROMMBR("NEWFILES/PRB.MBR") TOSTMF("NEWFILES/NEWFOLDER/PRB.MBR")("STMFOPT(*REPLACE))'

Just pass this command to the 'Execute External Program' fuction.
Let me know if this works for you.... <font color="black"> </font>

Prakash
 
[ QUOTE ]
Hi,

I think you're missing the initial '/' character
-> cpy obj('/newfiles/prb.txt') todir ('/newfiles/
newfolder/prb.txt')

I'm also not sure if the todir parameter requires
the complete file name or just the destination folder,
in that case it would be todir('/newfiles/newfolder')

Have a nice evening

[/ QUOTE ]

Hi, I tried that one too, with CMD and without in the start sentence, but doesn't work. I have the initial '/' to
frown.gif


[ QUOTE ]
Hi,

Try the following command...

For IFS:

'CPYTOSTMF FROMMBR("NEWFILES/PRB.MBR") TOSTMF("NEWFILES/NEWFOLDER/PRB.MBR")("STMFOPT(*REPLACE))'

Just pass this command to the 'Execute External Program' fuction.
Let me know if this works for you.... <font color="black"> </font>

Prakash

[/ QUOTE ]

Hi Prakash, this command is for members in the library, this works too with the txt files?, I don't know about AS400 commands.

I'll try this one anyway, but changing the '.MBR' to '.TXT',

Thanks for your help!
 
No works the command, in AS400 this command return a error:

The Object is not a QSYS.LIB object.

The iseries page shows:

[ QUOTE ]
CPYTOSTMF (Copy To Stream File) Command Desription
CPYTOSTMF Command syntax diagram

Purpose

The Copy to Stream File (CPYTOSTMF) command copies either a database file member or a save file to a stream file.

[/ QUOTE ]

Anyone have another solution?
 
Back
Top