Showing posts with label JCL. Show all posts
Showing posts with label JCL. 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.

Friday, December 2, 2011

How to Fix “GDG Generation Not Found JCL Error”

Here is the snippet to avoid JCL error due to NO GDG Generations are found on SMS.

You know that the only possible way to avoid DATASET NOT FOUND JCL Error is “Create datasets or use Dummy” here is a method to handle the errors in JCL itself.

You can have IDCAMS to issue LISTCAT LVL to list all the generations for the GDG and the move the out put to an input file, then use SORT utility to Check the resultant file for the .G and V00 characters on the file. If no GDG generations found set Return code of the step to 4 (it can be anything). then setup COND parameter for an IEFBR step in such a way that if the CONDCODE matches 4 (“COND=(4,NE)”), create the versions :)

JCL.

//R0318BMJ  JOB 'GDG VER FINDER',NOTIFY=R0318B               
//IDCAMS   EXEC PGM=IDCAMS                                   
//SYSPRINT DD DSN=&&TEMP,DISP=(,PASS)                        
//SYSIN    DD *                                              
LISTCAT LVL('TSHRCI.PATMAN.REPORT.GROUP') ALL               
/*                                                           
//*                                                          
//GETPOS   EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&&TEMP,DISP=SHR                            
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                              
OPTION    NULLOUT=RC4,VLSCMP                                
SORT      FIELDS=COPY                                       
 INCLUDE   COND=(48,2,CH,EQ,C'.G',AND,54,3,CH,EQ,C'V00')     
/*                                                           
//MODEL    EXEC PGM=IEFBR14,COND=(4,NE,GETPOS)               
//GDGMODEL DD   DSN=TSHRCI.PATMAN.REPORT.GROUP(+1),          
//         DISP=(NEW,CATLG,DELETE),                          
//         UNIT=SYSDA,                                       
//         SPACE=(TRK,(1,1),RLSE),                           
//         DCB=(LRECL=80,RECFM=FB,BLKSIZE=800,DSORG=PS)      
//SYSPRINT DD   SYSOUT=*                                     
//SYSIN    DD DUMMY
                                          

INCLUDE   COND=(48,2,CH,EQ,C'.G',AND,54,3,CH,EQ,C'V00') 

Once you executed IDCAMS step the messages from LISTCAT will be moved to &&TEMP dataset, then using the above CONDITION statement SORT utility will check for .G and V00 characters on the TEMPDATASET, if found SOR will skip the step else if set RETURN CODE 4.

The TEMP Dataset is FBA, so you need to add 4 bytes to the actual position of the characters on TEMP dataset. 44 and 50 are the Character positions of .G & V00 on my TEMPDATASET, after adding 4 it will become 48 and 54.  To find the positions of your characters replace TEMP with a dataset on your system then, check the file. “Don’t forget to add 4 bytes”

//MODEL    EXEC PGM=IEFBR14,COND=(4,NE,GETPOS)

This will execute only if the GETPOS step returned a return code of 4.

Let me know if you have any concerns on the JCL. and Like it/rate it/Comment on it you like the post.

Thanks

-Shibu-