Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CL Program for FTP

1,594 views
Skip to first unread message

Jim Thedorf

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
Is it possible to create a CL program that can FTP to another AS400 and
then perform downloads/uploads without user intervention?

Jim Thedorf (jthe...@mcc-net.com)

JeanMichel

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
Jim,

To do that you just need 2 source file members.
Name the first member INPUT and put into your "ftp scrip", name the second
OUTPUT : it will receive the log of the ftp session.
In your CLP, before starting FTP, add 2 ovrdbf, because "Batch" ftp uses
files named INPUT and OUTPUT.
Example :
(My FTP source file is called FTP)
Attention : The first line contains the remote user profile followed by the
password. If you can't use anonymous access it can be a security issue. I
don't know how to hide password, if someone knows...

CLP :
----------------------------------------------------------------------------
------------------
OVRDBF FILE(INPUT) TOFILE(QGPL/FTP) MBR(INPUT)
OVRDBF FILE(OUTPUT) TOFILE(QGPL/FTP) MBR(OUTPUT)
CLRPFM QGPL/FTP OUTPUT
FTP RMTSYS(IpAddress or name)
----------------------------------------------------------------------------
------------------

Exemple of member INPUT :
----------------------------------------------------------------------------
------------------
0001.00 USERPRF PASSWORD
0002.00 BIN
0003.00 PUT FROMLIB/FROMFILE TOLIB/TOFILE
0004.00 QUIT
----------------------------------------------------------------------------
------------------

Jean-Michel Penasse
EXPERIA Europe
jmpe...@experia.com
_____________________________________________
Jim Thedorf wrote :

Jim Thedorf

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
Thanks for the help.... it works perfect.


Jim Thedorf

Steven Kendall

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
On Thu, 21 Oct 1999 11:29:24 -0400, Jim Thedorf <jthe...@mcc-net.com>
wrote:

>Is it possible to create a CL program that can FTP to another AS400 and
>then perform downloads/uploads without user intervention?
>
>
>
>Jim Thedorf (jthe...@mcc-net.com)
>
>
>
>

In short, yes.

The actual process is not quite so simple. To perform an
unattended/batch FTP file transfer, the following steps need to take
place:

1. Create a script in a source physical file of the commands to be
run in the FTP session. If you want to perform the same transfer each
time, then this is a one-off manual task, but if you will be
transferring different files each time, then a program will need to be
written (not in CL, unless someone can come up with a method of
writing records to a physical file in a CL program) to dynamically
create this script each time.

Another factor to bear in mind is that this script will contain an
unencrypted user name and password that the local AS/400 will use to
sign on to the remote system.

2. Override file INPUT to the script member created.

3. Override file OUTPUT to an empty source physical file member.
When the transfer is performed, STRTCPFTP will write the output that
would normally be displayed on screen into this member.

4. Run the transfer using STRTCPFTP.

5. Check the output member created to ensure that the transfer
completed. This can be done by searching for the "Transfer complete"
messages.

More information about performing FTP file transfers in batch is
contained in the "TCP/IP Configuration & Reference" manual.


Regards,

Steven Kendall

Thomas

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
Steven:

Just in case it's useful to someone someday, CL can write (or more
accurately, cause to write) records to files in a couple of ways. One
way that I very rarely see used is via the Sort APIs.

CL can call the APIs and provide record data in an input buffer (which
can be a *CHAR variable). The APIs do the writes. I have a couple
command shells for these APIs that make reading/writing possible in CL
without needing to DCLF the file(s). Not a pretty solution when packed
numerics are involved, etc., but it's better than nothing when needed.

Tom Liotta

In article <380f71a1...@news.xtra.co.nz>,

--
Tom Liotta
AS/400 systems programmer


Sent via Deja.com http://www.deja.com/
Before you buy.

Joe Chiasson

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
Jim I was just over to www.tnt.com follow the link to the code samples.
They have a section with a zip file with a number of utilities for ftp
batch stuff.

s18...@my-deja.com

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to

"JeanMichel" <jmpe...@experia.com> wrote:
<SNIP>


I don't know how to hide password, if someone knows...

<SNIP>

Jean-Michel -

Somewhere on this NG, there is a thread regarding SEU colors and
displays which tells which hex value to insert into an SEU line to
cause it to be non-displayed. This would hide the password (and the
user profile) in the SEU member. Unfortunately, it would not encrypt
the password (either on the /400 or on the network) but it's a start.

HTH,

Steve

JeanMichel

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to

s18...@my-deja.com wrote :

>Somewhere on this NG, there is a thread regarding SEU colors and
>displays which tells which hex value to insert into an SEU line to
>cause it to be non-displayed. This would hide the password (and the
>user profile) in the SEU member. Unfortunately, it would not encrypt
>the password (either on the /400 or on the network) but it's a start.
>
>HTH,
>
>Steve


Steve,

I've tried with non display attribute (X'27') and it works obviously in SEU.
The password becomes "hidden"
But, unfortunatly, FTP uses this character as part of either usrprf or
password and fails !

jeanmichel

dat...@yahoo.com

unread,
Oct 25, 1999, 3:00:00 AM10/25/99
to
In article <380FB5E3...@ns.sympatico.ca>,

Joe Chiasson <jd.ch...@ns.sympatico.ca> wrote:
> Jim I was just over to www.tnt.com follow the link to the code samples.
> They have a section with a zip file with a number of utilities for ftp
> batch stuff.
>
> Jim Thedorf wrote:

I tried it, and haven't been able to get it to work. When I execute the
command, it references programs I don't see as a part of the zip file.

Then again, I'm not an RPG wonk. I just loaded each src file into a
*SRC member, and tried compiling. The compiles worked.
=== Al

Jan van Rossum

unread,
Nov 4, 1999, 3:00:00 AM11/4/99
to
Yes, it is .. yo need a file where you store the userid and password and
next the FTP commands. Note: is not secure.
Bye
0 new messages