Search code examples
mainframejcl

How to copy a dataset(ps or pds) from MVS to PC using JCL


I want to copy a mvs file to my PC.. I have tried with the below code.

//JOBNAME JOB NOTIFY=&SYSUID,CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),  
 //         REGION=0M                                              
 //STEP01   EXEC PGM=FTP                                                                    
 //OUTPUT   DD SYSOUT=*                                            
 //SYSPRINT DD SYSOUT=*                                            
 //INPUT    DD *                                                   
 MVS IP ADDRESS                                                    
 USER.ID(MVS)                                                           
 PASSWORD                                                           
 PUT 'USERID.NEW1.TXT' C:\MYPATH\DATA.TXT               
 QUIT                                                              
 /*          

spool output shows

'Invalid data set name "c:\mypath\data.txt". Use MVS Dsname conventions.'

But it is working fine with MVS to MVS dataset but not with PC. Can anyone suggest me what has to be done further.


Solution

  • If you do have an FTP server running on your PC, or a Windows server then it's simple to FTP using batch. Although the syntax you specified using a drive like C:\path\file is not supported. FTP commands and directory structures are similar Unix. When you configured the FTP server you would have specified a root directory (folder) that clients can access. You can't just access the entire Windows file system.

    This JCL will work.

    //FTPSTEP  EXEC PGM=FTP,REGION=0M        
    //SYSPRINT DD  SYSOUT=*                  
    //INPUT    DD  *                         
    *windows-ip-address*                     
    *windows-username windows-password*    
    put 'USERID.NEW1.TXT' new1.txt           
    quit