Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Any Rexx program to ftp a dataset from mainframe to pc

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
reachcyrus

New User


Joined: 13 Jul 2007
Posts: 24
Location: chennai

PostPosted: Fri Jul 13, 2007 7:16 pm    Post subject: Any Rexx program to ftp a dataset from mainframe to pc
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
References
PostPosted: Fri Jul 13, 2007 7:16 pm    Post subject: Re: Any Rexx program to ftp a dataset from mainframe to pc Reply with quote

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 2435
Location: Brussels once more ...

PostPosted: Fri Jul 13, 2007 7:51 pm    Post subject:
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

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3001
Location: Charlotte,NC USA

PostPosted: Fri Jul 13, 2007 7:54 pm    Post subject: Re: Any Rexx program to ftp a dataset from mainframe to pc
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

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3001
Location: Charlotte,NC USA

PostPosted: Sat Jul 14, 2007 1:19 am    Post subject: Re: Any Rexx program to ftp a dataset from mainframe to pc
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    Post subject: Reply to: Any Rexx program to ftp a dataset from mainframe
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

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3001
Location: Charlotte,NC USA

PostPosted: Wed Jan 16, 2008 9:08 pm    Post subject: Re: Reply to: Any Rexx program to ftp a dataset from mainfr
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

New User


Joined: 11 Jul 2007
Posts: 35
Location: hyderabad

PostPosted: Fri Apr 25, 2008 2:58 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 2292
Location: italy

PostPosted: Fri Apr 25, 2008 3:22 pm    Post subject: Reply to: Any Rexx program to ftp a dataset from mainframe
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1