Page 1 of 2

Extracting source code from a PDS

PostPosted: Tue Sep 02, 2008 6:43 pm
by jeroc
Hello,

I need to extract program source code from a library (in fact a PDS) to ASCII text files (one text file per program). My goal is to transfer the program source code on a Windows workstation.
Could you explain me how to proceed and if you have some examples of JCL doing this, then it could be helpful.

Thanks in advance

Re: Extracting source code from a PDS

PostPosted: Tue Sep 02, 2008 7:13 pm
by dick scherrer
Hello,

The easiest way to do this is to sign onto the mainframe ftp using the ftp client on your desktop, set the transmission to ascii, specify the target directory on the pc, highlight the members you want to transfer to your pc, and click the transfer. Each member will be brought to the pc as a separate file and will be stored in the directory you are pointing to.

Re: Extracting source code from a PDS

PostPosted: Tue Sep 02, 2008 9:10 pm
by jeroc
Ok, this is interesting. But if I want to extract the members by using a utility, what is the utility to use? IEBCOPY, IEBGENER...?

Re: Extracting source code from a PDS

PostPosted: Tue Sep 02, 2008 10:20 pm
by dick scherrer
Hello,

You can use those or your sort or several other utilities. . . .

If you do, you will have to create an output file for each member (assuming you want individual files on the target system).

If you use the ftp client you already have (which you will have to use anyway once you create the files on the mainframe - you would still need to ftp them), you can merely click on the members you want to download directly and create no intermediate files.

Re: Extracting source code from a PDS

PostPosted: Tue Sep 02, 2008 10:36 pm
by jeroc
I want to automate the extraction and perform it regularly. This is why I thought to use a JCL. However, I noted your suggestion because it is an interesting way for occasional and manual usages.
Do you have an example of such a JCL?

Thanks

Re: Extracting source code from a PDS

PostPosted: Wed Sep 03, 2008 12:03 am
by MrSpock
jeroc wrote:Do you have an example of such a JCL?


I'm sorry, but a job that does what exactly?

Re: Extracting source code from a PDS

PostPosted: Wed Sep 03, 2008 12:38 am
by dick scherrer
Hello,

What i suggested requires no jcl. It is done from the desktop,

If you want to pull a set of members repeatedly, you could write a batch script on the pc that connects to the mainframe ftp and downloads all of the members you want. Again, there would be no jcl.

Re: Extracting source code from a PDS

PostPosted: Wed Sep 03, 2008 1:19 pm
by jeroc
Hello MrSpock,

I'm looking for a JCL that extract the members of a PDS into separate files. For instance, in order to create a file per program from a source library.

dick Scherrer suggested me to use FTP but I also want to know if it possible to use a JCL.

Thanks in advance.
Jeroc

Re: Extracting source code from a PDS

PostPosted: Wed Sep 03, 2008 1:27 pm
by jeroc
Sorry, my previous question is not exactly what I'm looking for.

I would like to have a JCL that creates a file containing all the members of a PDS in 1 file (in order to download it onto a Windows pc) but each file must be separate by a banner like MEMBER NAME=<member name>.

For example, if the PDS contains the source of 3 programs, the extraction file should be:
MEMBER NAME=program1
source code of prog1
MEMBER NAME=program2
source code of prog2
MEMBER NAME=program3
source code of prog3

Re: Extracting source code from a PDS

PostPosted: Fri Sep 05, 2008 2:45 am
by shagnwrx
jeroc, You may be going about this the long way around.

We have several processes here where we ship complete PDS's to workstations or unix boxes (in ASCII format). The way we tackeld it was to use JCL to invoke FTP. This would require that you setup an FTP server on your windows machine. You would issue the LCD to connect to the PDS on the mainframe, and use CD to identify the directory on your target workstation. Do an MPUT to the target workstation or server from the mainframe. It will place the members as seperate ASCII files in the directory that you identified with the LCD command. One clean step and no having to manipulate a flat file into seperate files on your workstation.

Just for reference, here's what the JCL would look like.... In the PARM field on the EXEC card of the JCL, you put the IP Addr of the workstation you sending to. Also, before you run anything similar to this sample, remove the comments from of the SYSIN statements.

//FTPSTP1  EXEC PGM=FTP,REGION=2M,                   
//     PARM='10.0.0.1'             <=======  CHANGE TO THE IP ADDRESS OF TARGET WORKSTATION               
//STEPLIB  DD  DSN=TCPIP.SEZALOAD,DISP=SHR           
//SYSFTPD  DD  DSN=TCPIP.SEZAINST(FTPSDATA),DISP=SHR
//SYSMDUMP DD  SYSOUT=A                             
//SYSPRINT DD  SYSOUT=*                             
//OUTPUT   DD  SYSOUT=*                             
//INPUT    DD  *                                     
userid password    /* Userid and passord you've set up in the FTP software on your workstation */                                 
cd d:\TargetDirectory\       /*connects to the directory on the workstation */
lcd NAME.OF.THE.MAINFRAME.PDS         /*connects to the PDS on the mainframe*/
noprompt                                          /* without this, it would be a pain in the butt */
mput *                                              /* this means Multi-put, it will send every member of the PDS to the workstation */   
quit
/*
//