Example 2: Changing a physical file description and attributes

 

This example shows how to create new versions of files in the same library.

To create new versions of files in the same library, follow these steps:

  1. Create a new physical file with a different record format in the same library the old physical file is in. The names of the old and new files should be different. (The old physical file FILEPFA is in library LIBA and has two members MBRA1 and MBRA2.)
    CRTPF FILE(LIBA/FILEPFB) MAXMBRS(2)...

  2. Copy the members of the old physical file to the new physical file.
    CPYF     FROMFILE(LIBA/FILEPFA) TOFILE(LIBA/FILEPFB)
             FROMMBR(*ALL) TOMBR(*FROMMBR)
             FMTOPT(*MAP *DROP) MBROPT(*REPLACE)

  3. Create a new logical file in the same library as the old logical file is in. The names of the old and new files should be different. (You can use the FORMAT keyword to use the same record formats as are in the current logical file if no changes need be made to the record formats.) The PFILE keyword must refer to the new physical file created in step 1. The old logical file FILELFA is in library LIBA.
    CRTLF FILE(LIBA/FILELFB)

  4. Delete the old logical and physical files.
    DLTF FILE(LIBA/FILELFA)
    DLTF FILE(LIBA/FILEPFA)

  5. Rename the new logical file to the name of the old logical file. (If you also decide to rename the physical file, be sure to change the DDS for logical file so that the PFILE keyword refers to the new physical file name.)
    RNMOBJ(LIBA/FILELFB) OBJTYPE(*FILE) NEWOBJ(FILELFA)

  6. If the logical file member should be renamed, and assume that the default was used on the Create Logical File (CRTLF) command, issue the following command:
    RNMM FILE(LIBA/FILELFA) MBR(FILELFB) NEWMBR(FILELFA)

You can use the Change Physical File (CHGPF) command to change some of the attributes of a physical file and its members.

 

Parent topic:

Changing a physical file description and attributes

 

Related concepts


Control language