for Your foggy request
//stepnm EXEC PGM=somepgm
//input DD ......
//output DD DISP=(NEW,CATLG),DSN=somegdgbasename(+1),
// all the other DD parameters
//input DD ......
//output DD DISP=(NEW,CATLG),DSN=somegdgbasename(+1),
// all the other DD parameters
where
input is the input dataset ( irrelevant if it is temporary or not )
somepgm is a program capable of copying the input to the output
output will be the newly created gdg generation