Q
Get started Bring yourself up to speed with our introductory content.

Watch out when changing the name of IBM VSAM files

You can rename VSAM datasets, but you might lock the mainframe out of VSAM files if you do it incorrectly. Here's how to change a VSAM name.

Can we change the name of an IBM VSAM data set?

Use the access method services program IDCAMS and the ALTER function to change the name of a data set in IBM's mainframe OS Virtual Storage Access Method (Listing 1).

Listing 1. An example of changing the name of a VSAM data set.

//IDCAMS   JOB ...
//RENAME  EXEC  PGM=IDCAMS,REGION=2M
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
ALTER HLQ.ORIGINAL.NAME -
NEWNAME(HLQ.NEW.NAME)
ALTER HLQ.ORIGINAL.NAME.DATA -
NEWNAME(HLQ.NEW.NAME.DATA)
ALTER HLQ.ORIGINAL.NAME.INDEX -
NEWNAME(HLQ.NEW.NAME.INDEX)
/*

A word of caution when altering VSAM names: The alias for the high level qualifier (HLQ) for the new name must relate to the same catalog as the original name. If the new name's HLQ does not relate to the catalog, the data set will be rendered inaccessible. However, the HLQ doesn't need to be exactly the same.

If the alias for the HLQ does not relate to the same catalog as the original name, use IDCAMS command REPRO MERGECAT to put the entries into the proper catalog (Listing 2).

Listing 2.

//IDCAMS   JOB
//MERGECAT EXEC PGM=IDCAMS,REGION=2M
//SYSPRINT DD  SYSOUT=*
//INCAT    DD  DSN=SYS1.ICFCAT.ORIGINAL,DISP=SHR
//OUTCAT   DD  DSN=SYS1.ICFCAT.NEW,DISP=SHR
//SYSIN    DD  *
   REPRO -
       INFILE (INCAT)    -
       OUTFILE (OUTCAT)  -
       ENT(HLQ.NEW.NAME) -
       MERGECAT
/*

It almost goes without saying that the data set can't be in use while you are doing the ALTER or MERGECAT. More information is available in the DFSMS Access Method Services for Catalogs.

This was last published in January 2003

Dig Deeper on IBM system z and mainframe systems

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

SearchServerVirtualization

SearchCloudComputing

Close