Home | Gallery | Forum | Services | Webmail | Archive | Links | Contact Us | About Us
OS2 World.Com Forum
OS2 World.Com Online Discussion Forum.
Index / OS/2 - General / Networking
author message
how do you get return codes from os/2 ftp like m/f (exit?
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
dljone9
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 93
since: 13 Jan, 2003
1. how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
We're trying to get return code information from an os/2 ftp session.
A parm like (exit on the mainframe or (exit on unix is desired.
We are using a netrc file with a command line script like:

ftp destination.server.com < ftpcmds >ftplog.txt

Is there a way to get the ftp return code information?
If not what information/word-list could be searched for in the ftp log
to catch all possible errors? So far the log has shown the following:

error ### from DosOpen
Invalid command

Thanks in advance for your help.
(if possible please copy Zac@caltech.cjb.net )

Date: 13 Sep, 2005 on 20:57
warpcafe
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 350
since: 26 Nov, 2002
2. Re:how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
Hi,

not sure if I understand correctly... what are you trying to do? Is the FTP client an OS/2 machine? What OS is the FTP server on?

I did a quick try on my os/2 machine here:
- I set up the ftp server on the same machine (ip 192.168.144.123) and allow access to a directory for a user named "myid" with the password of "mypw"
- I ran FTPD in a separate session to start the server
- I created a netrc file in the dir that "set etc=" points to (by default that's \mptn\etc on the os/2 drive)
- this file contains one line:
machine 192.168.144.123 login myid password mypw
- I created a file named "ftpcmds" which contains the following 4 lines:
bin
hash
dir
quit
- then I run
FTP -v -d 192.168.144.123 < ftpcmds > ftplog.txt
from the directory where "ftpcmds" lies. And that worked.
Maybe you were missing the "-v" (verbose) option from the ftp command? The -d stands for "debug" and gives more feedback.
Note that my stuff is both ftp client and -server on OS/2...

If you want a "return code" from the ftp session, I can't tell you better than the following...:
Shell the ftp command from a rexx script and check the RC variable upon return. 0=okay, 1=error
The sample script:
/* start of rexx script */
/* test ftp cmd */
cmd = 'FTP -v -d 192.168.144.123 < ftpcmds > ftplog.txt'
cmd
say "return code is" rc
exit
/* end of rexx script */

Cheers
Thomas

Date: 14 Sep, 2005 on 12:06
warpcafe
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 350
since: 26 Nov, 2002
3. Re:how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
Oh, BTW... I forgot:

"Error xxx from DosOpen" to me most probably means that one of the two files you're "piping" cannot be found... thus the ftpcmds or the ftplog.txt...
...or you're not allowed to create files in the current dir...?
Anyway - sounds like a "file error".

...you might tell us what your "ftpcmds" contains?

Greetings
Thomas

Date: 14 Sep, 2005 on 12:11
phaelonimaire
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 31
since: 03 Feb, 2004
4. Re:how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
If I remember correctly, you have to use the batch ERRORLEVEL thing to get the programs' return. It may be easier (this is assuming you're using OS/2 for the client) to use the REXX FTP API. I use it to post files to an FTP site upon connection to the internet via In-Joy. I did this a number of years ago because I could not get redirection of input to work properly with the ftp client.
It also may be worth noting that FTP may use stderr for some of its messages, so you'll have to redirect like 2>>&1 >file.name so that stderr gets merged with stdout. It is yet also possible that FTP is evil like some VIO apps and you just can't redirect the output. In any case, I think if you have the REXX API available, it would be far easier to script and control. The put, get, and like commands all are functions and return errors. ..This is much easier to deal with than parsing a text file, in my opinion. I could provide what I have if anyone's interested.
Date: 14 Sep, 2005 on 18:51
dljone9
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 93
since: 13 Jan, 2003
5. Re:how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
Thanks so much for your suggestions;

And thanks to Daniel for letting me use this forum
to post the question. We had to move the current state
of our code to acceptance testing, & just now revisiting
this issue. I'll get back to you soon. The client is an
OS/2 server sending data to a mainframe server. We
need to control this thru a rexx driver program using:

"ftp target.com < ftpcmds > ftplogs"
ftpstat=rc

Where ftpstat contains non-zero in the event of failure.
Currently it returns zero even when the ftp fails. Again,
I'll get back to you soon regarding my results with your
suggestions. Thanks again, Zac (zac@caltech.cjb.net).

Date: 15 Sep, 2005 on 18:04
warpcafe
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 350
since: 26 Nov, 2002
6. Re:how do you get return codes from os/2 ftp like m/f (exit?
Reply to this topic with quote Modify your message
Hi Zac,

dljone9 (15 Sep, 2005 18:04):
We need to control this thru a rexx driver program using:

"ftp target.com < ftpcmds > ftplogs"
ftpstat=rc


...well, that's almost what I suggested... but it doesn't work?
FWIW - give a try with the sample script of mine. One never knows...
If you feel comfortable with rexx programming, why not go for phaelonimaire's suggestion? With the rexx ftp sockets library, you're able to code yourself a "custom-tailored" ftp program to your very needs... or maybe check hobbes for alternate FTP clients which might behave better (for your requirements). I'm sorry but can't tell any better one as I never had to deal with that stuff. I know that Ken Kinoshita made "jasmin" which is used for automated uploads of web pages... might possibly do what you need...?

Keeping fingers crossed...
Thomas

Date: 15 Sep, 2005 on 18:41
how do you get return codes from os/2 ftp like m/f (exit?
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
All times are CET+1. < Prev. | P. 1 | Next >
Go to:
 

Powered by UltraBoard 2000 Standard Edition,
Copyright © UltraScripts.com, Inc. 1999-2000.
Home | Gallery | Forums | Services | Webmail | Archive | Links | Contact Us | About Us
© OS2 World.Com 2000-2004