Why using assembler-programm. Better use an utility for copying
members form one pds to an other.
If you code an open instruction there is an open of the file you specify in the dcb. The logical name of the dcb refers to the corresponding JCL DD-Statement. There you have to specify the physical name of the file.
This means the DSN of the PDS and the member you want to process.
For example: Userid.Testpds(Member).
So in the normal way, with an PDS with 20 members, you will have normaly 20 DCB's in your programm an 20 DD's in your JCL.
But if you will handel a various number of members in an PDS, you could
use the IHADCB macro for modifying DCB-Parameters thru runtime.
First you have to create a littele file with alle the membernames of that pds. Use a utility or a Rexx or something else. This is the first step in your Job. Second step is your programm. This is now reading this little file sentence for sentence. With the info of the membername and the changing
of the DCB before open instruction, the open becomes dynamic.
Exampel: modify IN-DCB with Membername-1 then, open-read-close
modify IN-DCB with Membername-2 then, open-read-close
and so on.
You will only need one DCB in programm and one DD-Statement in JCL.