REXX and FTP 
Author Message
 REXX and FTP

Hi folks!

I'd appreciate any pointers on the following:

I need to do some unattended FTPing using mget and mput. I'm running
with Regina in AIX 2. I've tried queue to put the FTP subcommands in
the stack and then a FTP command addressed to 'COMMAND' to execute.
This works (ie. the REXX command file executes) but nothing happens.
I'm assuming that AIX doesn't do stacks la IBM mainframe.

As an interim measure, I'm FTPing to my OS2 box (using the OS2 REXX
FTP API functions) from host1 and then FTPing from my OS2 box to
host2. I'd like to go host1 to host2 directly and get my OS2 box out
of the loop. Host1 is AIX 2 with Regina. (Also the OS2 REXX FTP API I
have doesn't do mget / mput, only single files. Is there a better one
that does?)

Another thought would be using a .netrc file on host1. Anyone know how
to specifiy a FTP macro within .netrc? All my UNIX/AIX reference texts
hint that it can be done, but no examples or clear statements as to
how.

Thanks for any input!

Bon weekend!

JVB



Tue, 06 Feb 2001 03:00:00 GMT  
 REXX and FTP

Quote:
>I need to do some unattended FTPing using mget and mput. I'm running
>with Regina in AIX 2. I've tried queue to put the FTP subcommands in
>the stack and then a FTP command addressed to 'COMMAND' to execute.

I don't have the documentation for it. And I can't find my examples, but I
know how it is done. When you start an ftp command with something like this:
ftp 000.000.000.000
where 000.000.000.000 is the FTP address you are trying to reach. You can
have one more option, I am sure there are others, which is a command file.
The command file is a plain text file containing the FTP commands you would
type after the FTP command. For instance:
FTP 000.000.000.000 /FTPCMDS.TXT
where file FTPCMDS.TXT contains the commands:

USERID
PASSWORD
CD FILE_DIR
GET FILE1.ZIP
GET FILE2.ZIP

where USERID and PASSWORD are the ID/Password for the site you are trying to
reach. The CD commands simply moves you to the appropriate directpry. The
GET commands retrieve the files you are trying to get.

The only thing specific to REXX would be how you send the FTP command.
Everything else is specific to FTP in whatever environment you are. Whereas
the commands in the FTPCMDS are specific to the site you are connecting to.

How do you monitor this? I don't know.
I am sure someone with more knowledge will explain this further.
I will post my example, written for DOS executed under WIN95. I have
converted the same process for use on a MVS mainframe environment, with
little trouble.



Tue, 06 Feb 2001 03:00:00 GMT  
 REXX and FTP

Quote:

> Hi folks!

> I'd appreciate any pointers on the following:

> I need to do some unattended FTPing using mget and mput. I'm running
> with Regina in AIX 2. I've tried queue to put the FTP subcommands in
> the stack and then a FTP command addressed to 'COMMAND' to execute.
> This works (ie. the REXX command file executes) but nothing happens.
> I'm assuming that AIX doesn't do stacks la IBM mainframe.

> As an interim measure, I'm FTPing to my OS2 box (using the OS2 REXX
> FTP API functions) from host1 and then FTPing from my OS2 box to
> host2. I'd like to go host1 to host2 directly and get my OS2 box out
> of the loop. Host1 is AIX 2 with Regina. (Also the OS2 REXX FTP API I
> have doesn't do mget / mput, only single files. Is there a better one
> that does?)

> Another thought would be using a .netrc file on host1. Anyone know how
> to specifiy a FTP macro within .netrc? All my UNIX/AIX reference texts
> hint that it can be done, but no examples or clear statements as to
> how.

> Thanks for any input!

> Bon weekend!

> JVB

Here's an example I use to FTP from Win95, WinNT to VM (& slightly
modified to MVS). You'll have to tweak it for your environment. I use
IBM Object REXX but this is classic REXX. It also worked under Quercus
REXX (for DOS) with Win95. I've used IBM REXX for AIX, don't know
Regina, but this is simple stuff so it shouldn't matter which REXX you
use.

Basically it creates a temporary FTP script in a file and then runs it.
This example expect the get, put etc. as input args but I have
specialized versions with hardcoded commands.

Hope this is of some use.

[ Ftpsamp.rex 2K ]
/* This REXX program gets FTP commands (separated by commas) from the
   command line arg and embeds them in an FTP script,
   then runs the FTP script.

 SAMPLE ARGS:
   mget UQN*.prepli , mget YYY.pre                    /* VM  */
   get UQN70.prepli   c:\ftp\uqn70.pre                /* VM  */
   get 'hrs.test.contrl(conhm13)'  c:\ftp\m13.txt     /* MVS */
*/

myPassword = linein('c:\ftp\password.txt')
tempFtp = 'c:\ftp\myTmpFtp.ftp'    /* work file */
parse arg myArg                    /* get the FTP command(s) */
if myArg = '' then do
  say
  say '???'
  return 1
end
i = 1                         /* separate the FTP commands by comma */
do while myArg \= ''          /* into a stem variable               */
  parse var myArg ftpCmd ',' myArg
  if ftpCmd \= '' then do              /*in case double commas */
    svCmd.i  = strip(ftpCmd,'b',' ')
    svCmd.0  = i
    i = i + 1
  end
end
/*this is the fixed prefix part of the FTP script which will be built*/
svA.1  = 'open cpvma.sr.chevron.com'         /* VM  */
/*svA.1  = 'open sysatcp.sr.chevron.com'*/   /* MVS */
svA.2  = 'tjoep'
svA.3  = myPassword
svA.4  = 'ascii'                                     /* default? */
svA.5  = 'quote cwd tjoep.101'                       /* VM       */
svA.0  = 5                             /*number of stem var entries */
svA.6  = 'lcd c:\chev\pep'
/*this is the fixed suffix part of the FTP script which will be built */
svB.1  = 'close'
svB.2  = 'bye'
svB.0  = 2                             /*number of stem var entries */
'del' tempFtp                          /*get rid of any old work file*/
do i = 1 to svA.0                   /*copy prefix script to work file*/
  call lineout tempFtp, svA.i
end
do i = 1 to svCmd.0                 /*copy FTP cmd(s) to work file*/
  call lineout tempFtp, svCmd.i
end
do i = 1 to svB.0                   /*copy suffix script to work file*/
  call lineout tempFtp, svB.i
end
call lineout tempFtp                /* close the work file */
'ftp  -i  -s:'tempFtp               /*execute the FTP script */
                                    /* leaving the work file for */
                                    /* possible review */
return 0



Tue, 06 Feb 2001 03:00:00 GMT  
 REXX and FTP

Quote:

> Hi folks!

> I'd appreciate any pointers on the following:

> I need to do some unattended FTPing using mget and mput. I'm running
> with Regina in AIX 2. I've tried queue to put the FTP subcommands in
> the stack and then a FTP command addressed to 'COMMAND' to execute.
> This works (ie. the REXX command file executes) but nothing happens.
> I'm assuming that AIX doesn't do stacks la IBM mainframe.

> As an interim measure, I'm FTPing to my OS2 box (using the OS2 REXX
> FTP API functions) from host1 and then FTPing from my OS2 box to
> host2. I'd like to go host1 to host2 directly and get my OS2 box out
> of the loop. Host1 is AIX 2 with Regina. (Also the OS2 REXX FTP API I
> have doesn't do mget / mput, only single files. Is there a better one
> that does?)

> Another thought would be using a .netrc file on host1. Anyone know how
> to specifiy a FTP macro within .netrc? All my UNIX/AIX reference texts
> hint that it can be done, but no examples or clear statements as to
> how.

> Thanks for any input!

> Bon weekend!

> JVB

AIX (and Unix in general) has no stack. The stack in Regina is internal to
Regina, so the trick of stacking subcommands (which originated in VM/CMS)
won't work. As others have told you, you can put subcommands in a file and
then ftp <file. There is no way to handle a problem detected by one of the
subcommands -- all the subcommands in the file will be executed, and if
one gets an error the others probably will, too. You can break it up into
pieces: FTP to the site, do a dir, then quit, process the output of ftp to
see what's there, then ftp to the site again and get the files you want,
etc. Very inefficient. I don't know if anyone has put a REXX subcommand
interface on any version of ftp besides VMFTP in VM/CMS. The problem isn't
REXX, but the ftp command. (Of course this applies to all other commands
in Unix, as well.) OS2, CMS, Amiga, and MVS are the only environments I
know of that have instrumented commands to work with REXX via subcom
interfaces.

--



Wed, 07 Feb 2001 03:00:00 GMT  
 REXX and FTP

Quote:

>  I don't know if anyone has put a REXX subcommand
> interface on any version of ftp besides VMFTP in VM/CMS.

RxFTP exists for OS/2 and has recently been released for Object REXX under
Windows.

 --------------------------------------------------------------
 Dick Goran             author, REXX Reference Summary Handbook
 C F S Nevada, Inc.     Contrib. Ed., Personal Systems Magazine
 953 E. Sahara Ave, Suite 9B                     [OS/2 Advisor]
 Las Vegas, NV 89104-3012

 702-732-3847 FAX                                    (remove ?)
                    http://www.cfsrexx.com



Fri, 09 Feb 2001 03:00:00 GMT  
 REXX and FTP
This program does somethig similar to what you need

/*  This piece of a program may give you an idea for an option to call
FTP from REXX  */

    call SysFileTree 'c:\correo\*', 'carta', 'OF'       /*  get the list of
files to send  */

    say 'Hay 'carta.0' cartas'

    if carta.0 > 0 then do                              /* If there is at least
 one, send it */
       say   'Conectando al servidor'
       call FtpSetUser '192.168.1.9', 'MailDeliver', passw    /*  begin
a session  */
       if result \= 1 then say No pudo conectar
       call FtpSetBinary "Binary"                               /* Use binary
 transfer  */

       do i = 1 to carta.0
          say 'Enviando ' carta.i                       /* be nice to the user
 */
          call FtpPut  carta.i                          /* send the file */
          say 'Fin envio, Resultado' result
       end i /* do */

       call FtpLogOff                           /* We are donne */

     End

Quote:



> > Hi folks!

> > I'd appreciate any pointers on the following:

> > I need to do some unattended FTPing using mget and mput. I'm <snip>

--
Hasta Pronto, Raul.

Asuncisn - Paraguay



Fri, 09 Feb 2001 03:00:00 GMT  
 REXX and FTP
Quote:

> RxFTP exists for OS/2 and has recently been released for Object REXX under
> Windows.

Is there a version for MVS or OS/390 available ?

Peter



Sat, 10 Feb 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Rexx and FTP

2. IBM Object Rexx and FTP

3. rexx and FTP

4. REXX and FTP API's

5. rexx and ftp

6. Can Rexx issue ftp commands in OS/2?

7. using REXX with FTP under OS2

8. REXX and FTP

9. Squeak FTP site established: ftp://ftp.create.ucsb.edu/pub/Smalltalk/Squeak

10. My ftp site (ftp://ftp.iag.net/pub/clipper)

11. Rexx ftp problem

12. FTP in OS/390 MVS REXX

 

 
Powered by phpBB® Forum Software