procedurejcl

Do I need delimiters on Dataset names for IDCAMS ALTER?


Ok, I'm sort of new to the whole mainframe/JCL thing.

I've done a bit of looking and I'm not seeing the answer to what should be a very simple question, IMO. When writing a JCL proc, I'm wanting to take my current production datasets and back them up with a version # (as &BUVER). The example I'm copying is using IDCAMS and the SYSIN DD statement is using ALTER 'HLQ.MY.PROD.DS01' NEWNM('HLQ.MY.PROD.DS01.VER100.D010122').

Are the tics around the DS names necessary? I'm trying to write a proc to back up a regular set of DS names with the version and backup date by using HLQ.MY.PROD.DS01.&BUVERNO.&BUDATE and I'm not sure if I can put the symbolics inside the tics or if I can leave the tics off the whole thing and just concatenate the symbolics as above.

Does 'HLQ.MY.PROD.DS01.&BUVERNO.&BUDATE' work?

If not, will HLQ.MY.PROD.DS01.&BUVERNO.&BUDATE work?

Or am I trying to do something that isn't allowed at all?

Thanks for any help I can get on this?


Solution

  • The single quotes are NOT necessary for PGM=IDCAMS. Even if they are present it ensures that the dataset enclosed is an ABSOLUTE dataset name. However certain IDCAMS commands such as DEFINE CLUSTER can be used as a TSO command (using PGM=IKJEFT01). In that case the system may append the PREFIX(Usually your ID) as the first qualifier if the name is NOT enclosed in single quotes. So depending on how you are running the command you may need the single quotes.

    If you want to ensure that it works in both environments always use the single quotes.

    The symbols &BUVERNO and &BUDATE need to be exported so that you can export them to SYSIN. Also note that the jobclass that the job runs need to have SYSSYM=ALLOW defined.

    // your job card
    // EXPORT SYMLIST=*                                     
    // SET BUVERNO=VER100                                   
    // SET BUDATE=D010122                                   
    //*                                                     
    //STEP0100 EXEC PGM=IDCAMS                              
    //SYSPRINT DD SYSOUT=*                                  
    //SYSIN    DD *,SYMBOLS=EXECSYS                         
      ALTER 'HLQ.MY.PROD.DS01'          -              
            NEWNAME('HLQ.MY.PROD.DS01.&BUVERNO..&BUDATE')   
    /*