Showing posts with label mainframe ftp bat file. Show all posts
Showing posts with label mainframe ftp bat file. Show all posts

Thursday, November 22, 2012

Setup FTP from Mainframe to Non-Mainframe Method III

Using Microsoft IIS –FTP (Internet Information Services

As I Promised beginning of this series, here is the third method to transfer files from Mainframe to non Mainframe (Windows) . I have used Windows 7 X64 professional Operating system on my laptop and Internet Information Server 7.5.

You could also read other methods I’ve written about FTP’ing files from IBM Mainframe to Windows. These methods are easy to use and utilizes the free resources available in IBM Mainframe as well as Windows/free wares.

1. Simple FTP with Windows Bat file - http://mainframegeek.me/2012/11/20/setup-ftp-from-mainframe-to-non-mainframe-method-ii-using-bat-file/

2. Setup FTP with Filezilla server.

http://mainframegeek.me/2012/09/12/setup-ftp-from-mainframe-to-personal-computermethod-i-using-filezilla-server-on-windows/

3. Setup FTP with IIS (Internet Information Service) FTP server.

http://http://mainframegeek.me/2012/11/23/setup-ftp-from-mainframe-to-non-mainframe-method-iii/

By default Windows comes with Internet Information services. You just need to turn them on.

1. Turn On FTP server in Internet Information Services.

Navigate to Control Panel>Programs and features/Add or remove programs, and click on Turn windows features on or off. It will take  a while to turn on the service.

clip_image002_thumb[2]

2. Add a directory to our FTP server service

Navigate to Control Panel>Administrative tools and open Internet Information services

image

Right click on the FTP area and select View sites,

image

Now right click on the workspace and select add FTP site

Enter a FTP site name and choose directory where you want your incoming (From Mainframe) files stored to.

 clip_image008_thumb[2]

Click on next, select an IP Address (Copy to a text file for using in JCL) make sure you selected No SSL (you won’t be able to transfer files otherwise) and click on next. remember I said in the first method, FTP always uses port 21, so leave it as it is.

image

Click on Next and Enable anonymous authentication (or you can use a user id and password) and hit finish

clip_image012_thumb[2]

On the sites window, right click the FTP site you just created and select Basic Settings

3. Enable windows security

Click on connect as , then select specific user and click on set and enter your windows user id and password

image

Hit Ok for all the dialog boxes and go back to mainframe and edit your JCL as below

4. Submit FTP job from Mainframe

Copy paste the below JCL to your ISPF editor, make the changes as I mentioned below·

  • //STEP001 EXEC PGM=FTP,PARM='255.255.255.0 ---- Change IP address to the one you copied to text file during FTP server setup  (Step 2)
  • update windows (Same credentials you entered on Basic settings window) userid/pasword and file list on //INPUT DD*
  • Update your Data set names followed by the filename on windows on PUT statement

Complete JCL

//DDS1764J JOB NOTIFY=DDS1764
//STEP001 EXEC PGM=FTP,PARM='255.255.255.0 (EXIT'
//SYSPRINT DD SYSOUT=*
//OUTPUT DD SYSOUT=*
//INPUT DD *
Windows_user_id
Windows_user_password
DIR
PUT 'DDS1764.PGMG.CBL(FLEPGM)' ToIIS.txt
QUIT

Now Submit the JCL (it will complete with MAXCC 000). Due to security issues (I don’t want some spammer to submit random FTP jobs to my PC Winking smile ) I have blurred my ip address.

image 

Then check your shared folder (On your PC) for received file. Did you forget your shared folder? refer back to step 2 to see the folder.

· image

and That’s it now you are familiar with the 3 FTP methods which I know, FTP with IIS as well as Filezilla are same in a way, just the server software on the windows system is changing.

Try these three methods, let me know if you know any other methods (leave a comment on this page or email me @ shibubalakrishnan@live.com). 

If this tutorial helped you, please share the page on facebook, like it and please support me by clicking on the below ads.

Monday, November 19, 2012

Setup FTP from Mainframe to Non-Mainframe –Method II using Bat file

Here is another method with which you can transfer files from Mainframe to a windows Machine. To use this method you need to have a .Bat file and a file with list of files need to be transferred and valid Mainframe credentials.

You could also read other methods I’ve written about FTP’ing files from IBM Mainframe to Windows. These methods are easy to use and utilizes the free resources available in IBM Mainframe as well as Windows/free wares.

1. Simple FTP with Windows Bat file - http://mainframegeek.me/2012/11/20/setup-ftp-from-mainframe-to-non-mainframe-method-ii-using-bat-file/

2. Setup FTP with Filezilla server.

http://mainframegeek.me/2012/09/12/setup-ftp-from-mainframe-to-personal-computermethod-i-using-filezilla-server-on-windows/

3. Setup FTP with IIS (Internet Information Service) FTP server.

http://http://mainframegeek.me/2012/11/23/setup-ftp-from-mainframe-to-non-mainframe-method-iii/

Copy the contents of below table and save it as script.txt. You can save anywhere you want, I saved it on C:\temp1 folder. Change my_mainframe_userid and my_mainframe_password to your mainframe user id and password. By default the your HLQ (High level qualifier) will be your mainframe id, so whatever DD names you mention in the script file will have HLQ (High level Qualifier) padded, e.g HLQ.DDS1764.PGMG.CBL(ASCEBCB1) ,

To avoid this, we issue  cd ..    . Update the DD names with your list of data set names, you can either use PDS member names, a PS or Compressed (xmited) PDS or everything. there is no limit for the number of files, but keep in mind that this could eat a lot of bandwidth, followed by the destination file. Save this file as script.txt in your windows machine.

my_mainframe_userid
my_mainframe_password
cd ..
get "DDS1764.PGMG.CBL(ASCEBCB1)"  "C:\temp101.txt"
get "DDS1764.PGMG.CBL(ASCED)"  "C:\temp102.txt"
get "DDS1764.PGMG.CBL(ASMLNK1)"  "C:\temp103.txt"
get "DDS1764.PGMG.CBL(COB18DIG)"  "C:\temp104.txt"
get "DDS1764.PGMG.CBL(DIVZERO)"  "C:\temp105.txt"
quit

Copy the contents of below table and save it as batchftp.bat .   Before oyu save the file, change my_mainframe_ip  to your mainframe host ip for name. when you save the file from Microsoft notepad, make sure you choose file name: batchftp.bat and Save as type: All Files (*.*) .

echo off
cls
echo Batch FTP From Mainframe to Windows
echo   ***** Created by Shibu Thannikkunnath
echo   ***** mainframegeek@hotmail.com
echo   ***** http://mainframegeek.me
pause
ftp -s:script.txt my_mainframe_ip
exit
pause

 

Make sure you keep both the script.txt as well as the batchftp.bat file in the same folder. Now double click on the batchftp.bat to start download.  Once the script finished you can see all the transferred files in the folder mentioned in script.txt.

image

 

Try the script, let me know if you have any questions. If you think this tutorial helped you, don’t forget to like my facebook page, rate or share.  and support me by watching the below video (Ad)

-Cheers

Shibu