Rename a data set

With ZOAU, you can rename a data set in the following ways:

  • Issuing a shell command:

    • Option 1:
    dmv "${prefix}.RENAME.FILE" "${prefix}.NEWNAME.FILE"
    
    • Option 2:
    mvscmdauth --pgm=IDCAMS --sysprint=dummy --sysin=stdin <<zz
      ALTER ${prefix}.RENAME.FILE -
      NEWNAME(${prefix}.NEWNAME.FILE)
    zz
    
  • Calling an API in Python programs:

    datasets.move("%s.RENAME.FILE" % HLQ, "%s.NEWNAME.FILE" % HLQ)
    

Without ZOAU, to achieve the same purpose, you need to write the following JCL statements:

//*
//* Move (rename) the dataset @@HLQ@@.ZOASAMP.RENAME.FILE
//* to @@HLQ.ZOASAMP.NEWNAME.FILE
//*
//DMV     EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
  ALTER @@HLQ@@.ZOASAMP.RENAME.FILE -
  NEWNAME(@@HLQ@@.ZOASAMP.NEWNAME.FILE)
/*