IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

FTP from Windows to Mainframe in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abhishek Saurabh

New User


Joined: 25 Aug 2010
Posts: 23
Location: Pune, India

PostPosted: Sun Sep 16, 2012 6:56 pm
Reply with quote

Hi..

I have been going through earlier posts regarding FTP in REXX. All of them discussed about sending files from Mainframe to Windows, which made me wonder whether the opposite (Windows to Mainframe) is possible or not, because that is what I need to do.

To tell about my requirement, I am creating a REXX application that, based on the input data from a PS file, performs a series of logic. However this data in the input PS file is actually coming from a .txt file (windows). I am using a separate tool to transfer txt file data to PS. What I require is that before REXX application starts performing its business logic (which it is doing fine), it should first perform the FTP to get data into the PS file.
I am assuming this is possible, but I am not sure what exactly I should do.
Also, if I am able to do this my REXX application, it would first FTP the file from Windows to Mainframe and only after a successful transfer, continue with the further logic. Is this a good idea??

Any pointers/examples would be helpful.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Sep 16, 2012 7:22 pm
Reply with quote

Quote:
Is this a good idea??


not at all, it is already difficult to synchronize events on the same platform,
figure doing it across different platforms ....

whatever <tool> You are using to transfer the file from windoze to the mainframe
the most appropriate way is to use Your scheduler facilities....
all the schedulers have the possibility to schedule a job when a file has been created on the <mainframe>

no reason to invent Your own <scheduling> system.

so ...
do all what has to be done on the windoze side
transfer the file
let the <mainframe> scheduling software take care of the rest
( submit/schedule the appropriate job )

no reason to bother the king
Back to top
View user's profile Send private message
Abhishek Saurabh

New User


Joined: 25 Aug 2010
Posts: 23
Location: Pune, India

PostPosted: Sun Sep 16, 2012 7:42 pm
Reply with quote

Hi Enrico,

Thanks for you response.
First of all, the tool which I am currently using for FTP is just a simple windows based tool which allows to transfer files from Windows to Mainframe and vice-versa. Well, that's not the important issue here. This can be achieved through a JCL also.
My intention (as required by the team for whom I creating the REXX application) was only to combine the file transfer logic in the REXX program itself. However, I was not sure myself if that was a good idea, that's why I wanted some expert opinions.
You had suggested about schedulers. However, I was thinking of a simple approach. Writing a JCL in which the first step performs the FTP part, and if the first step is successful, the second step invokes the REXX program. It's just that the REXX program would be executing in the background mode rather than the normal foreground mode.
Is this approach ok? Does running a REXX program in foreground or background mode make any kind of difference to the performance??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Sep 16, 2012 8:33 pm
Reply with quote

Quote:
My intention (as required by the team for whom I creating the REXX application) was only to combine the file transfer logic in the REXX program itself. However, I was not sure myself if that was a good idea, that's why I wanted some expert opinions.


the requirement is <stupid>
why put a dependency on an unstable platform ...

the MF job will be probably scheduled by a, the name tells, <a scheduler>
when ... the heck who knows

what if while the job runs
the PC running windoze fails ...
or it is simply powered off

what if,
what if,
what if

I gave Yo the most reasonable and <good practice> advice

if Your organization wants to follow/use a warped/unstable solution
better ask somewhere else

the chances of getting help here to implement it ( the warped solution ) are pretty slim

and using my suggestion will cut drastically on lines of code to be written and maintained


= the definitions for the scheduler setup and they might be already there
+ the definition of the trigger for the file transfer ( IIRC 1 line )
= the work to be done on the windoze part
= the FTP statements to be written
- all the rexx coding
- extra steps in the jcl

evaluate Yourself the balance.

and my usual question/comment when somebody asks on how to implement an already chosen solution

why did somebody chose it, when it is necessary to ask around to implement it ??? icon_cool.gif
Back to top
View user's profile Send private message
Abhishek Saurabh

New User


Joined: 25 Aug 2010
Posts: 23
Location: Pune, India

PostPosted: Sun Sep 16, 2012 8:42 pm
Reply with quote

Thanks for your inputs. I will keep these points in mind and try to implement the best possible solution.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Sep 17, 2012 3:10 am
Reply with quote

I work in the Electronic Data Transfer group, and we do this all day, every day, using FTP fpr both puts and gets to and from multiple servers. I'm really not clear what exactly your concern is here.
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Mon Sep 17, 2012 11:34 am
Reply with quote

It is very simple to trigger a file transfer PC to MF from a REXX programm running on z/OS.
Just use the ISPF Workstation Agent and the corresponding ISPF services WSCON, FILEXFER, and WSDISCON.
You might read a smart summary about this astonishing ISPF extension (one of the best kept ISPF secrets) on Gilbert Saint Flour's HomePage. In addition you should study the ISPF Services Guide for the 3 ISPF services I mentioned before.

Here is a very small example of how your program should be coded:
Code:
/* rexx */
/* First connect to the workstation where your ISPF workstation agent runs. */
myip = '111.222.33.44' /* That's the IP address of the workstation. */
'ispexec wscon ip(myip)'
/* Now put both the mainframe dataset name as well as the pc file name into the function pool. */
h = 'my .host.data.set'
w = 'c:\temp\my_pc_file.txt'
'ispexec vput (h w)'
/* Transfer the pc file up to the mainframe by specifying the two variable names and the transfer direction.  */
'ispexec filexfer host(h) ws(w) to(ws) text'
/* That's all. Don't forget to disconnect when you're done. */
'ispexec wsdiscon'
exit

This example is only a rough guideline for an online access. When you want to run it in batch, you should forget about WSCON and WSDISCON. In this case you connect by additional parameters of the ISPSTART command. Read the manuals about this powerful command and the extensions built in for supporting connections to the workstation agent.
Back to top
View user's profile Send private message
Abhishek Saurabh

New User


Joined: 25 Aug 2010
Posts: 23
Location: Pune, India

PostPosted: Mon Sep 17, 2012 8:36 pm
Reply with quote

Hi SuperK,
To simply put my requirement, I need to transfer a txt file from windows to a PS file in MF, using a REXX program. Once the file is transferred, this same REXX program will use the data in the PS file for further processing.

In the previous discussion we have discussed the possibility of using schedulers to start the job (for REXX pgm) once the FTP is done. However, if possible, I would prefer not to involve schedulers or job submission. Basically, I wish to use my REXX exec as an online program.

Hi Stefan,
The solution suggested by you in the previous post looks good, however I have not tried yet. One problem is that currently, I don't have the required set up to access desktop file from Mainframe. I guess I will require it..right??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 17, 2012 9:39 pm
Reply with quote

time to lock the topic... please
even if I appear as super moderator, somehow I cannot do it icon_cool.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 17, 2012 9:49 pm
Reply with quote

Might have to be Mcmillan locking it -- I've lost that function as well.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 17, 2012 10:26 pm
Reply with quote

Hello,

Quote:
currently, I don't have the required set up to access desktop file from Mainframe. I guess I will require it..right??
The easy part is the ftp to get the file from the pc to the mainframe. . .

What will probably not be easy is getting to run your desktop as an ftp server. Most organizations do not permit individual pcs to be configured as an ftp server.

If the data can be loaded to some kind of "data server" the mainframe can be the client and upload the data. If you want this to be an online process (and not scheduled), the online process can check if the file or remote server is "there" and issue a message if there are problems".

I'm not sure why this was locked, but lots of people face issues with transferring files . . .

It Has been re-locked.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
Search our Forums:

Back to Top