You need to prepar an outline/skeleton piece of JCL.
//somename dd dsn=<i want to replace dsn1>,
// vol=ser=<i want to replace vols1>
For each DD statement requiring updating, the markers need to be unique with respect to the actual value required for replacement. If you want the same group of vols, or same dsn, use the same for replacement. For different dsn/vols must be different. Note that all commas are correctly included in the original "text" where needed. All that is needed is to replace/swap the things within the delimiters.
Code your parameter file simply:
<i want to replace dsn1> andthenthestuff
<i want to replace vols1> andthensomeotherstuff
Is Sort the dicated requirement for the solution?