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

How to download multiple files from FTP server to mainframe?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Wed Jul 15, 2009 11:21 pm
Reply with quote

Hi All,

I have 22 files in SAS server. I want to download all the 22 files from FTP server to mainframe as a single file.

I have tried APPE and MGET comand. but not getting the actual result.

can any one help me how to append the files in mainframe from server?
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 Jul 15, 2009 11:29 pm
Reply with quote

What would I do in this case?

Run the FTP the first time and do a member list (LS) command and pull that information back into a dataset. Read that datatset, and dynamically build 22 seperate GET commands, all pointing to the one single DD for my local dataset. That DD would, of course, be specified in the allocation with DISP=MOD.

Run the FTP a second time, using the 22 dynamically built GET commands.
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 Jul 15, 2009 11:31 pm
Reply with quote

Do these filenames conform to normal MVS dataset naming conventions? If so, I have other ideas as well.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Wed Jul 15, 2009 11:35 pm
Reply with quote

Code:

//FTP1     EXEC PGM=FTP,                                   
//            REGION=2M,                                   
//            PARM='/(EXIT'                               
//SYSPRINT DD SYSOUT=*                                     
//SYSDEBUG DD SYSOUT=*                                     
//OUTPUT   DD SYSOUT=*                                     
//INPUT    DD *                                           
3.182.39.29                                               
userid                                                     
password                                                   
CD folder name in server                                   
GET Amx_PLCC_final.txt  +                                 
          'X1GPTLH.RCF.CLOSE08.CLI.ACCTS.JUL15' (replace   
QUIT                                                       
/*                                                         


That is my code to download a single file from server.
want to know how can we download multiple files from server to the same file name in mainframe?
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 Jul 15, 2009 11:40 pm
Reply with quote

22 GET's or 22 APPEND's. I don't see any other options that don't involve using something like PKZIP. Maybe someone else does?
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Wed Jul 15, 2009 11:46 pm
Reply with quote

Do u know, how to give append command for this issue?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jul 16, 2009 12:02 am
Reply with quote

The APPEND FTP command is used like a PUT command -- not a GET command. AFAIK, there is no way to accomplish the requested task except the procedure Kevin outlined -- get the names, generate a sequence of GET commands, then run them through another FTP session. FTP is oriented around transfer of one (or more) files -- it wasn't designed to transfer multiple files to one file.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 12:11 am
Reply with quote

is that possible to use MGET command?

If so, just give me the syntax?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jul 16, 2009 12:20 am
Reply with quote

You can use the MGET command, but be aware that you will not get one file on the receiving end -- you will get one file per sending file, or 22 files per the original post.

Depending upon the default settings, you may need to use PROMPT (which toggles the prompting to download each individual file). The FTP command is MGET * to retrieve all files from the current working directory on the remote server. MGET file1 file2 file3 would retrieve from the remote server file1, then file2, then file3 -- storing them as three separate files on the local machine.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 12:24 am
Reply with quote

Thanks for your quick reply.

Can you please give me the code with syntax for MGET?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jul 16, 2009 12:34 am
Reply with quote

Robert, you're right. My bad about the APPEND command. icon_redface.gif

Unfortunately, from what the OP has shown, unless those filenames are changed to conform to normal MVS dataset naming conventions, I don't see using the MGET command.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 12:41 am
Reply with quote

Yes, you are right.

I have used the MGET *.txt local file name.

but got the error as ' No such file or directory.'

EZA1685W Invalid local file identifier

can you tell me what is MVS naming conventions?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jul 16, 2009 12:55 am
Reply with quote

This is from your example:

'X1GPTLH.RCF.CLOSE08.CLI.ACCTS.JUL15'

Multiple nodes, each seperated by a period. A node may be 1-8 alphanumeric characters, but must start with a national character (A-Z, #, or $). No blanks or underscores or other characters.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 12:57 am
Reply with quote

Thats what i have given as the file name rt

then why is not accepting?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jul 16, 2009 1:05 am
Reply with quote

raj12vel wrote:
I have used the MGET *.txt local file name.


I presume you meant just MGET *.txt as per the protocol standard:

5.41 MGet subcommand--Copy multiple files.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jul 16, 2009 1:17 am
Reply with quote

You can't provide a local file name with the MGET command -- all operands on the MGET are remote server file names.

Should you need more assistance, could you post your FTP commands as you have them (we don't need the IP address, user id, or password) in the output of the FTP job so we can see exactly what you've got?
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Jul 16, 2009 1:26 am
Reply with quote

My job, as I originally mentioned, would look something like this:

Code:

//STEP0001 EXEC PGM=FTP,PARM='server.address (Exit=8'         
//SYSFTPD  DD   DISP=SHR,DSN=MY.FTP.DATA                     
//FILE1    DD   DSN=X1GPTLH.RCF.CLOSE08.CLI.ACCTS.JUL15,     
//         DISP=MOD                                           
//OUTPUT   DD   SYSOUT=*                                     
//INPUT    DD   *                                             
sendsite                                                     
ascii                                                         
cd ...                                                       
get Amx_PLCC_final.txt     //dd:file1                         
get second_file.txt        //dd:file1                         
...                                                           
get twenty_second_file.txt //dd:file1                         
qui                                                           
/*                                                           
//*                                                           
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 1:46 am
Reply with quote

Can you please be more specific on the aforementioned code?

1. do i have to give the ip address in the field?
Code:
PARM='server.address (Exit=8'


2. what are the details whould i need to give in this file?
Code:
//SYSFTPD  DD   DISP=SHR,DSN=MY.FTP.DATA


3. where should i give the user id and password?
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Thu Jul 16, 2009 1:55 am
Reply with quote

I got it.

It works fine.

thanks alot for your timed help.

please let me know if we have alternatives for this.

I would like to thank you al icon_biggrin.gif
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
Search our Forums:

Back to Top