In the run of the previous week two people asked me how to transform a PDS (a dataset with members) into a flat file (a sequential dataset). Therefore I decided to write this tip. There are lots of ways to make such a transformation. You can code your own transformation, but IBM should have made a utility to perform the task long ago.
In fact IBM has created such a utility long ago, but they really do not advertise for this product. In the manual DFSMS Utilities there is a description of a program called IEBPTPCH which does the trick nice and easy. There are good reasons for the lack of advertising for IEBPTPCH. It is filled with strange limitations which seems too old fashioned in 2009. Well who cares: if your PDS has a LRECL of 80 you are up and running with the following piece of JCL:
MY.FLAT.FILE must be allocated with a LRECL one greater than the original PDS, because IEBPTPCH unfortunately prefixes each record with an ASA character. You may easily remove this character in a following step using DFSORT. The above step will unload all members in MY.WONDER.FUL.PDS and write them out in MY.FLAT.FILE as one long concatenation. In front of the data of each individual member IEBPTPCH inserts a record containing the name of the following member. This makes it pretty easy to find out which member you are looking at when you process MY.FLAT.FILE.
I have used IEBPTPCH with lot of success for unloading member datasets to UNIX or WINDOWS using FTP. With FTP you have to transfer members one at a time and it becomes quite complicated to automate such transfers. It is much easier and faster to transfer one single file.