Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Remote Commands

Status
Not open for further replies.

shelts

Programmer
Feb 12, 2004
20
GB
I have a requirement to call a program on a Remote AS400, immediately after sending a file via FTP.
I have been told I need to use the FTP 'QUOTE RCMD' command, but 'QUOTE' does not seem to be supported by Mercator.
I can call a Unix script to do this, but this does not seem ideal. Any ideas?
 
You might check out the "-SITE" FTP adapter command; the problem may be that I think the command on the remote server executes before the FTP.

Steve
 
Thanks. I did look into -SITE, but you couldn't do a 'QUOTE' command from there. Interestingly Mercator actually uses 'QUOTE SITE...' when you use this command, but you can't use 'QUOTE' itself!
 
I don't like using the -SITE option because it is always ran
before sending the files. What I usually do is within the map do a call to a .bat or unix executable file whose only purpose
is to run an ftp client. here's an example of the .bat file

 
I don't like using the -SITE option because it is always ran
before sending the files. What I usually do is within the map do a call to a .bat or unix executable file whose only purpose
is to run an ftp client. here's an example of the .bat file

AS400FTP.bat
----------------------------------------------------
@echo Please wait transfer in progress.........
ftp -n -s:C:\FTP\MYFTP\Ftpfile.txt AS4001E1 > C:\FTP\MYFTP\FtpOut.log
notepad C:\FTP\MYFTP\FtpOut.log
----------------------------------------------------

Ftpfile.txt contains the following
-----------------------------------------------------
user USERID
Password
ascii

put c:\data\file1.txt MYLIB/srcfile.file1
put c:\data\file2.txt MYLIB/srcfile.file2
quote RCMD SBMJOB CMD(MYLIB/MYCRTOBJ DLTMOD(*YES) RMVOBS(*YES) DEBUG(*YES) ) JOB(MYCRTOBJ) CURLIB(MYLIB) HOLD(*NO)
quit
------------------------------------------------------------
 
Thanks. I basically have ended up doing exactly that.
The only difficulty with using this approach is getting errors back from the ftp within the script.
 
That is why I don't rely on Mercator when it comes to FTP. Here's the setup information we did between applications in
AS400 and sun Solaris:

In AS400:

1 We have a program that always run waiting for a certain file name(s) to appear and then trigger to run certain jobs depending on what filename appeared.
2. We also created a job that ftp files to the Sun server and
capture/parse all ftp return codes. If there is an error during
transmission we either resend it or send an email to me or operators depending on the error type. There would always be a job log of all activities.

In Sun:

The setup is the same as AS400 except I used mercator to map
the data for all inbound and outbound transmission.

note: This has been running perfectly for us for 2 years now
and never found a bug in it. We have used this type of
setting for almost any kind of transmission such as
EDI. Lately I added a PGP(GPG) functionality to comply
with HIPPA.
 
The program you have running on your AS400 waiting for the files is exactly how I wanted to do it. Unfortunately the AS400 people didn't want to do this (long story), as it involved them doing some work.
I assume this program is constantly polling a certain library?
 
Yes these programs be it on AS400 or other platforms is like a daemon program which scan certain libraries listed in a setup file. The setup file holds the name of libraries to be scanned and the corresponding triggers and jobs it will process. This daemon has the ability to sleep and wakes up every number of minutes or seconds depending on its own properties.

I don't know why your AS400 does not want to do this. This is a very challenging project. It simply involves some type of socket programming. A daemon program just listen to a certain tcp port then wakes up another daemon if there is an activity. The other daemon then scans all the listed libraries for the presence of a named file. One good thing about this is that you can have another copy of these daemons to listen to another port hence you are not limited to just a single thread operation. As you can see all of these activities are contained in its own subsystem which is very easy to manage for maintenance purposes. We do have 4 AS400
and only one acts as the central ftp site. All other files
coming from the other as400 simply send files using DDM facility to the central location.

With this kind of setup, I was able to implement the same scenario with the unix servers. However, in the unix environment I do have to use a combination of perl, java and
unix scripting to accomplish the task.

If I was able to do this, I don't see any reason why your
people cannot.
 
I agree. Unfortunately company politics got involved.

Thanks for your help, it may aid me to push them in the future.
 
Shelts,

Please forgive me in my last reply to you. The last paragraph
do sound as if I'm downgrading your people. I don't have that
mean intention to your people rather, it is my way of challenging programmers to do the best of their ability whenever an opportunity such as this comes. I came from the old
school and I'm used to working in a one-man-shop environment. I
should at least be informed of your capability to do such a task. I now realized I might be just one of those kind. As you can see I started with IBM360 to mainframes, from S/3 to s/36
and from S/38 to AS400. Besides, I can also write program in 12
different kind of languages(fortran, assembler,cobol,c, c++
RPG, java, perl, etc)
 
jmanj,

No offence taken. My team are seperate from the AS400 development people, hence making it difficult to get them to do things. Plus, in a big company, these things sometimes take time.
I don't doubt they have the expertise, just the will to do it.
 
Problem with ssl support ?

Hi, I am trying to connect to a proftpd server with ssl support without success.

I've been able to use a BSD client (ftps), a windows client (cute-ftp) but no luck with mercator.

Since I am a newbie with this software I'd like to know what's the correct setup/syntax so I can correct what I am doing wrong...
 
Are you using the -SPROTO command in your syntax? This will only work if the security options are installed.

Are you specifying a Private Key?
 
I am trying to do PGP, GPG, GNU encryption on my AS400 (iSeries). Has anyone done this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top