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

REXX program to FTP a dataset from mainframe to pc


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

New User


Joined: 13 Jul 2007
Posts: 24
Location: chennai

PostPosted: Fri Jul 13, 2007 7:16 pm
Reply with quote

Hi,

My requirement is to ftp few datasets from mainframes to PC.
I have the list of datasets to be ftp in a sequential file.
Is there any rexx command or program to transfer a file from mainframes to desktop.

I dont want to do ftp manual!!!!!!!

Cheers!!
Vijay
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 13, 2007 7:51 pm
Reply with quote

This, or a similar topic has been discussed quite recently.

Please use the search facility.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Fri Jul 13, 2007 7:54 pm
Reply with quote

I may not be getting the question entirely, but it seems like a relatively trivial task to open the dataset list, build an ftp "put" command for each dataset, and then run FTP using the generated "put" list.

Or, am I missing something here?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Sat Jul 14, 2007 1:19 am
Reply with quote

This is a simple exec that I use. It's designed to run as an ISPF EDIT macro, bit you can use any portions of it you might wish to:

Code:

/* REXX FTPIT */                                               
"ISREDIT MACRO"                                                 
"ISREDIT (currdsn) = DATASET"                                   
"ISREDIT (currmem) = MEMBER"                                   
Parse Upper Source . . execname . execdsn . . execenv .         
"ALLOC DD(SYSPRINT) DUMMY REU"                                 
"ALLOC DD(OUTPUT)   DUMMY REU"                                 
ddnftp = '#'Right(Time(S),7,'0')                               
If Length(currmem) <> 0 Then                                   
  Do                                                           
    "ALLOC DD("ddnftp") DA('"currdsn"("currmem")') SHR REU"     
  End                                                           
Else                                                           
  Do                                                           
    "ALLOC DD("ddnftp") DA('"currdsn"') SHR REU"               
  End                                                           
/* Process inline panel and message definitions */             
ddname = '$'Right(Time(S),7,'0')                               
memname = 'ZZ'                                                 
"ALLOC DD("ddname") NEW REU RECF(F B) LRECL(80) DIR(2) SP(1) TR"
"ISPEXEC LMINIT DATAID(did) DDNAME("ddname") ENQ(EXCLU)"       
"ISPEXEC LMOPEN DATAID("did") OPTION(OUTPUT)"                         
Do 1                                                                   
  Do a = 1 To 999 Until Substr(line,1,8) = '/*MEMBER'                 
    line = Sourceline(a)                                               
  End                                                                 
  Parse Var line . memname .                                           
  Do a = (a + 1) To 999 While Substr(line,1,2) <> '*/'                 
    line = sourceline(a)                                               
    "ISPEXEC LMPUT DATAID("did") MODE(INVAR) DATALOC(line) DATALEN(80)"
  End                                                                 
  "ISPEXEC LMMADD DATAID("did") MEMBER("memname")"                     
End                                                                   
"ISPEXEC LMFREE DATAID("did")"                                         
"ISPEXEC LIBDEF ISPPLIB LIBRARY ID("ddname") STACK"                   
"ISPEXEC DISPLAY PANEL(FTPIT)"                                         
If rc = 0 Then                                                         
  Do                                                                   
    Queue "sendsite"                                                   
    Queue "ascii"                                                     
    Queue "cd temp"                                                   
    Queue "put //dd:"ddnftp" "filename                                 
    Queue "qui"                                                       
    x = Outtrap(x.)                                                     
    "FTP "server" 21 (Exit=8"                                           
    retcode = rc                                                       
    x = Outtrap(Off)                                                   
    If retcode = 0 Then zedlmsg = 'Success'                             
    Else                zedlmsg = 'Failed'                             
    zedlmsg = Time('L') execname zedlmsg 'RC='retcode                   
    "ISPEXEC SETMSG MSG(ISRZ000)"                                       
  End                                                                   
Exit 0                                                                 
                                                                       
/*MEMBER FTPIT                                                         
)Attr Default(%+_)                                                             
  $ Type(Input) Intens(Low) Pad(_) Caps(Off)                                   
  _ Type(Input) Intens(Low) Pad(_) Caps(On)                                     
  ! Type(Input) Intens(Low) Pad(' ') Caps(Off)                                 
  ` Type(Output) Intens(HIGH)                                                   
)Body Expand(//) Width(80) Cmd()                                               
%/-/ FTP Processing Facility /-/+                                               
%Command ==>!zcmd                                                              +
+                                                                               
+Enter FTP Server Address%=>_z                                                 +
+Enter Target Filename   %=>_z                                                 +
+                                                                               
+                                                                               
+                                                                               
+                                                                               
+Enter%Enter+to continue or%End+to Exit.                                       
)Init                                                                           
  .zvars = '(server filename)'                                                 
)Proc                                                                           
)End                                                                           
*/
Back to top
View user's profile Send private message
arnth01

New User


Joined: 15 Jan 2008
Posts: 2
Location: Evanston, IL

PostPosted: Wed Jan 16, 2008 8:48 pm
Reply with quote

Hey superk,
This is a pretty slick exec if I could get it to work. I am not an FTP expert so I could use so help what to fill in here.

1) Is the "FTP Server Address" the IP address or URL of the mainframe?
2) Is the "Target Filename" the filename on my PC?

I was getting these errors:
IKJ56500I COMMAND CD NOT FOUND
IKJ56500I COMMAND PUT NOT FOUND
IKJ56500I COMMAND QUI NOT FOUND

Enter FTP Server Address => ____________________________
Enter Target Filename => ____________________________

Thanks,
Tom
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Jan 16, 2008 9:08 pm
Reply with quote

arnth01 wrote:

1) Is the "FTP Server Address" the IP address or URL of the mainframe?
2) Is the "Target Filename" the filename on my PC?


1. The "FTP Server Address" is the TCP/IP address, or domain name, of the REMOTE FTP Server you're connecting to.

2. Yes. It's the target filename on the remote FTP server. It's an optional field.
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Fri Apr 25, 2008 2:58 pm
Reply with quote

Hi SuperK,

When i tried to use the code given by you, i am getting following error.

Code:
    25 +++   line = Sourceline(a)                               
IRX0040I Error running REXFTP, line 25: Incorrect call to routine
***


Could you please guide me whats going wrong??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 25, 2008 3:22 pm
Reply with quote

the most common issue with sourceline and invalid call message
is that You are trying to sourceline after the end of file

the best way to avoid it is to find the number of lines in the rexx script with
Code:
lines = sourceline()


to test it
Code:
EDIT       USER.CLIST(Z) - 01.02                           Columns 00001 00072
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 lines = sourceline()
000006 do l = 1 to lines
000007    say l sourceline(l)
000008 end
000009 exit
****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Fri Aug 22, 2008 12:04 pm
Reply with quote

hello,

Thanks a lot for providing a very professional and sophisticated code. When i entered the i/p address of the host after the prompt, im getting an error message that the required input field is missing.

For example


Enter FTP Server Address%=> 111.111.11.11

Please guide me how to proceed.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Aug 22, 2008 9:36 pm
Reply with quote

Are you using the FPTIP panel provided by Superk? Because it does not verify the fields. You should not be getting that message.
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat Aug 23, 2008 12:40 am
Reply with quote

Great to see quick responses from you all.....iam using the same code created by superk. I am totally new to REXX. All i did was, removed the _z variable and entered the IP address of the host. Could you please provide a screen shot of the inputs that you provide in this case. Sorry if its a trivial question, but nevertheless, its a chance for me to learn..
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: Sat Aug 23, 2008 2:47 am
Reply with quote

Hello,

People should usually not post actual ip addresses. . .
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Sat Aug 23, 2008 7:35 am
Reply with quote

What happens when you use the example without changing it?

You seemed to have removed the 'z' after the prompt in the panel definition, but you probably did not realize that it works in conjunction with the .zvars statement.

This code:
Code:
)Body
+Enter FTP Server Address%=>_z                                                 +
+Enter Target Filename   %=>_z                                                 +
)Init                                                                           
  .zvars = '(server filename)'

is more or less equivalent to:
Code:
)Body
+Enter FTP Server Address%=>_server                                        +
+Enter Target Filename   %=>_fileame                                     +


The underscore character in the example means that an input field follows and also that a variable name follows. If you want to set an initial value, set it in the )INIT section. Something like this:
Code:
 server = '999.999.999.999'
Back to top
View user's profile Send private message
samedesh
Currently Banned

New User


Joined: 22 May 2007
Posts: 46
Location: India

PostPosted: Fri Aug 20, 2010 10:08 am
Reply with quote

Hi Superk,

I want to call ispf panel from Rexx code. I have seen the rexx code you pasted and I tried referring that but was unable to proceed. Please help. I am getting the panel not found error after allocating the pds name.

Please help icon_sad.gif
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Fri Aug 20, 2010 10:12 am
Reply with quote

Did you edit the ISPPLIB PDS and see if it contains a member that's the same name as the one you're calling for?

Other than that, you're going to have to give us some details, traces, whatever.
Back to top
View user's profile Send private message
samedesh
Currently Banned

New User


Joined: 22 May 2007
Posts: 46
Location: India

PostPosted: Fri Aug 20, 2010 12:35 pm
Reply with quote

Hi superk,

I used LIBDEF function as specified in your code.

"ALLOC FI(OUTDD) DA('"DDN"("MEM")') SHR REUSE"
"ISPEXEC LIBDEF ISPPLIB LIBRARY ID("OUTDD") STACK"
"ISPEXEC DISPLAY PANEL(HEXFMT1)"

But now it is giving me error as below.

IEC141I 013-18,IGG0191B,S08800,IKJSTD,OUTDD,9159,BAT372,DCAE1.PDS.SOURCE(HEXFMT
1)
System abend code
01300

CMG999 Invalid message ID - First character of message ID is blank or
binary zeros
***

First time it went successfull but after that it gave above error
Please Help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Aug 20, 2010 1:09 pm
Reply with quote

S013-18 From the manual that YOU should already have looked at.
And as you didn't post the IEC141I message
Quote:
Explanation: The error occurred during processing of an OPEN macro instruction. This system completion code is accompanied by message IEC141I. Refer to the explanation of message IEC141I for complete information about the task that was ended and for an explanation of the return code in register 15 (which is provided in the IEC141I message text).

Application Programmer Response: Respond as indicated for message IEC141I.

System Programmer Response: If the error recurs and the program is not in error, look at the messages in the job log for more information. Search problem reporting data bases for a fix for the problem. If no fix exists, contact the IBM Support Center. Provide the JCL and the program listing for the job.
Some assitance.
You allocate the library NOT the library and membername to ISPPLIB.
The way that you have coded your LIBDEF the system is looking for member XYX in your definition of Data_Set_Name(XYZ).
Also, why do you bother to do an ALLOC as well - not needed.
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Using API Gateway from CICS program CICS 0
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