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                                //SYSUT1   DD  DISP=SHR,DSN=USERID.MY.PDS //SYSUT2   DD  DSN=USERID.DUMP.OF.MY.PDS.PS, //             DISP=(NEW,CATLG,DELETE),                     //             SPACE=(CYL,(5,5),RLSE),                      //             DCB=(RECFM=FB,LRECL=81,BLKSIZE=0)            //SORTIN   DD  DISP=SHR,DSN=USERID.DUMP.OF.MY.PDS.PS //SORTOUT  DD DSN=USERID.DUMP.OF.MY.PDS.PS.SORTED, //            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)                         ; ; ; ;