0

I have batch file which is being used to FTP from desktop to mainframe. After getting the file by FTP, I run a rexx module to do some activities.

Now I want to run the rexx module automatically after the FTP step from bat file. Also from the batch file (.bat ) I want to pass some parameters like program name,date.

So is it possible to trigger the rexx from windows batch ?

Please suggest me how to proceed.

Need ur help...pls

  • If this is Production, talk to your Production Control/Scheduler people. They'll do it the way they want which fits in with the standards at your site. If this is not Production, do it manually. If you *need* to automate, talk to your Production Control/Scheduler people for how they would do it in Production, then base your solution on what they would use. Remember you'll directly or indirectly have to involve the Security group as well. No-one is going to like it if you attempt uncontrolled automated access to the machine with stuff you've picked-up off the internet. – Bill Woodger Sep 18 '14 at 06:52

2 Answers2

0

Okay, you're running a batch file executing an FTP script, let's say like:

ftp -s:bunchOfFtpCommands.txt

After that you want to invoke the REXX module, which I'd assume would be done with something like (I use Regina):

regina scriptname.rex parameters

If your regina.exe is in e.g. C:\Apps\Utils\Rexx then you'd use

C:\Apps\Utils\Rexx\regina\scriptname.rex parameters

or whatever matches your environment.

All you need to do unless I'm misunderstanding what's needed here, is to invoke FTP, then next line invoke REXX [regina] with the desired parameters.

If in fact you're planning to execute the FTP script and then dependent on the contents of the transferred file, pass some parameters from that file into the REXX command, we're talking about a different problem than you describe.

Torqane
  • 136
  • 5
  • Trouble is, OP wants to run the rexx on the machine which *receives* the file. Probably. Probably also unaware that rexx can run everywhere, not just under TSO on z/OS. – Bill Woodger Sep 18 '14 at 06:47
0

Yes!

You could submit a JCL BATCH job with FTP to the host...that BATCH could then run your REXX. There's a great talk by SoliderOfFortan were he explains that jobs can be submitted via FTP directly to JES.

JCL job example:

//MYJOB    JOB (Bxxx,Bxxx,1,999),'PROGRAMMER PIMP',NOTIFY=&SYSUID,
//             TIME=(99),MSGCLASS=X,REGION=100M                
//DFLT   OUTPUT JESDS=ALL,DEFAULT=Y,DEST=LOCAL                 
//*                                                            
//*-------------------------------------------------------------
//REXX EXEC PGM=IKJEFT01 
//SYSECEC DD DISP=SHR,DSN=PDS.containing.REXX.pgm 
//SYSTSPRT DD SYSOUT=* 
//SYSTSIN DD * 
  %rexxpgm 
/* 
//* Where "rexxpgm" is the PDS member name in the PDS. 

Here's the BATCH to submit the JCL job:

::: -- Submit JCL/REXX Job ---
echo.
echo  " ------------------------- "
echo  " SUBMIT AND RUN BATCH FILE " 
echo  " ------------------------- "
IF EXIST ftptemp.txt del ftptemp.txt
echo user %FTPUserID%>> ftptemp.txt
echo %FTPPwd%>> ftptemp.txt
echo cd ..>> ftptemp.txt
echo del %filename%>> ftptemp.txt
echo quote site file=jes>> ftptemp.txt
echo put myjob.jcl>> ftptemp.txt
echo quote site file=seq
echo quit>> ftptemp.txt
ftp -n -s:ftptemp.txt %host%

pause
paulywill
  • 629
  • 10
  • 29