365 pts.
 AS/400 FTP
Hi My name is Devan Maistry and I am working at Smith & Nephew and I want to find out on how to do the following:- I need to automate the order processing from Orderwise. I can FTP onto their server I can retrieve Data onto the AS400 I can convert this data to automatically create the orders. The problem I am having is that because I want to automate this process, the file that they are sending me is called A123456.ord (where A12345 is a variable) I am using GET A12345.ord devan/forders (Devan is a library on the AS400 and FORDERS is the name of the flat file) The A12345.ord can be A12346 or A13389or even 55FEB08(depending on their numbering system) I need to find out what command can be used to retrieve this file.... I would like to rename it first and then use the rename to do my get/Mget Please help Thanx Devan Maistry 0827736496

Software/Hardware used:
ASKED: March 13, 2009  9:15 AM
UPDATED: March 17, 2009  12:19 PM

Answer Wiki:
Hi Devan, Probably your best option is to first retrieve a list of the files that are on the server, then build your FTP script using that information. You should be able to get a list of files using DIR or LS to an output file (DISK. The output file is normally called DIROUTPUT. You can retrieve the DIROUTPUT using get. You can then read the DIROUTPUT file in a program and use the data contained in it to create your FTP script with renames if necessary. Regards, Martin Gilbert. Hi Martin How do i do that ? i am able to write contents to an output file but how can i read this in FTP? or do i read tthis output file in a cl and use the name received in a parameter? don't know how to do. Thanx Devan
Last Wiki Answer Submitted:  March 16, 2009  9:56 am  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi Devan,

You need to create and retrieve the list using FTP. Then you need to read the list using a program and write your FTP script. I don’t think you’ll be able to do this in CL, you’ll need to use something like RPG or COBOL.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi Martin

I’m not sure how to do it.

Here is the processes I am following:-

On the AS400
_________________________________________________________________
File . . . . . . QCLSRC

Library . . . . DEVAN Position to . . . . .

Type options, press Enter.

2=Edit 3=Copy 4=Delete 5=Display 6=Print 7=Rename

8=Display description 9=Save 13=Change text 14=Compile 15=Create module…

Opt Member Type Text

ORDDCLP CLP ORD – FTP the information from orderwise

ORDDFTP TXT ORD – FTP the daily info from orderwise server

ORDDLOG

ORDCLPFTP CLP ORD – FTP the inform from orderwise

ORDFTP TXT ORD – FTP the daily info from orderwise server

ORDLOG

_________________________________________________________

CL PROGRAM – ORDDCLP looks like this

PGM

DCLF FILE(ORDDLOG)

RMVM FILE(DEVAN/QCLSRC) MBR(ORDDLOG)

MONMSG MSGID(CPF0000)

OVRDBF FILE(INPUT) TOFILE(DEVAN/QCLSRC) MBR(ORDDFTP)

OVRDBF FILE(OUTPUT) TOFILE(DEVAN/QCLSRC) MBR(ORDDLOG)

FTP RMTSYS(’196.14.119.10′)

_____________________________________________________

ORDDFTP looks like this

user dmaistry dmaistry

cd orders

dir

QUIT

__________________________________

ORDDLOG

0001.00 Output redirected to a file.

0002.00 Input read from specified override file.

0003.00 Connecting to remote host 196.14.119.10 using port 21.

0004.00 220 FTPSERVER Microsoft FTP Service (Version 5.0). .

0011.00 > user DMAISTRY *******

0012.00 331 Password required for DMAISTRY.

0013.00 230 User DMAISTRY logged in.

0014.00 Windows_NT version 5.0

0015.00 Enter an FTP subcommand.

0016.00 > cd orders

0017.00 250 CWD command successful.

0018.00 Enter an FTP subcommand.

0019.00 > dir

0020.00 227 Entering Passive Mode (196,14,119,10,8,97).

0021.00 125 Data connection already open; Transfer starting.

0022.00 03-13-09 10:03AM 217 5B55FE64.ORD

0023.00 226 Transfer complete.

0024.00 Enter an FTP subcommand.

0025.00 > QUIT

0026.00 221

Now I use ORDCLPFTP

PGM

RMVM FILE(DEVAN/QCLSRC) MBR(ORDLOG)

MONMSG MSGID(CPF0000)

OVRDBF FILE(INPUT) TOFILE(DEVAN/QCLSRC) MBR(ORDFTP)

OVRDBF FILE(OUTPUT) TOFILE(DEVAN/QCLSRC) MBR(ORDLOG)

FTP RMTSYS(’196.14.119.10′)

This looks at ORDFTP

user DMAISTRY dmaistry

cd orders

get ?????????? devan/forders (replac

QUIT

From the above:

Up until now I don’t know what to do next…..

Do I write a RPG program to read from the output file(what is the name of the output file?)

Where do I pick up the file ????????

Please help…

Thanx

 365 pts.