Rename a data set member
With ZOAU, you can rename the member ${prefix}.PROJ23.COBOL(PAYMENT)
or move it to a new name in the following ways:
-
Issuing a shell command:
- Option 1:
mmv "${prefix}.PROJ23.COBOL" PAYMENT PAYMENTS
- Option 2:
mvscmdauth --pgm=IEHPROGM --sysprint=dummy --dd=${vol},vol --sysin=stdin <<zz RENAME VOL=SYSALLDA=${vol}, + NEWNAME=PAYMENTS,MEMBER=PAYMENT, + DSNAME=${prefix}.PROJ23.COBOL zz
-
Calling an API in Python programs:
datasets.move_member("%s.PROJ23.COBOL" % HLQ, "PAYMENT", "PAYMENTS")
Without ZOAU, to achieve the same purpose, you need to write the following JCL statements:
//*
//* Rename the PDSE member PAYMENT to PAYMENTS in
//* PDSE @@HLQ@@.ZOASAMP.PROJ23.COBOL.
//* Note the volume that the PDSE resides on must be
//* specified in place of @@VOL@@
//*
//MMV EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=*
//DD DD DSN=@@HLQ@@.ZOASAMP.PROJ23.COBOL, +
// UNIT=SYSALLDA,DISP=OLD,VOL=SER=@@VOL@@
//SYSIN DD *
RENAME VOL=SYSALLDA=@@VOL@@, +
DSNAME=@@HLQ@@.ZOASAMP.PROJ23.COBOL, +
NEWNAME=PAYMENTS,MEMBER=PAYMENT
/*