JCL to Unload all members of PDS in a PS Flat file.


JCL to Unload all members of PDS in a PS Flat file.
There may be instances when  you wish to unload all the members in a 
PDS to a flat file so that you may print them (later read them) or transport 
the data from mainframe to your pc and work with this data.
IBM provides a utility to perform this for you. The utility is IEBPTPCH and here
is an example JCL to do the needful.
The first step uses IBM's utility to unload the data to a flat file, but since 
an extra byte is loaded into flat file which is created we would need a SORT step
to get rid of this extra byte.
//STEP001  EXEC PGM=IEBPTPCH                               
//SYSPRINT DD  SYSOUT=*                                    
//             DISP=(NEW,CATLG,DELETE),                    
//             SPACE=(CYL,(5,5),RLSE),                     
//             UNIT=SYSDA,                                 
//             DCB=(RECFM=FB,LRECL=81,BLKSIZE=0)           
//SYSIN    DD  *                                           
 PUNCH TYPORG=PO                                           
//JSTEP002 EXEC PGM=SORT                                                
//SYSOUT   DD  SYSOUT=*                                                 
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUDUMP DD  SYSOUT=*                                                 
//REPORT1  DD  SYSOUT=*                                                 
//            DISP=(NEW,CATLG,CATLG),UNIT=SYSDA,SPACE=(CYL,(2,2)),      
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)                         
//SORTWK01 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)                        
//SORTWK02 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)                        
//SORTWK03 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)                        
//SYSIN    DD *                                                         
 SORT FIELDS=COPY                                                       
 INREC FIELDS=(1:2,80)                                                  
; ; ; ;
As most of the users who read about this tip asked is there a way to do the reverse, 
so if also want to know if its possible then read the article on IEBUPDTE here.
To know more about IEBPTPCH read the IBM manual here.


this was just what I was looking for...