ERASE

The ERASE command removes an object from the database.

TSO with ISPF TSO without ISPF CICS®
X X X

ERASE an object from the database

Read syntax diagramSkip visual syntax diagramERaseobjecttype1QUERYFORMPROCTABLEANALYTICSFOLDERobjectname (CONfirm=profile2YesNoFOLder=dsqec_curr_folder3ALLNONEobjectname)
Notes:
  • 1 The type of the named object, if appropriate, is used. QMF objects have priority over other types of objects (such as database objects).
  • 2 The value set in your profile is used.
  • 3 The value set in this global variable is used.

Description

objectname
The name of the QMF object in the database.

When you specify the name of a FORM object, all parts of the form are erased.

If the object name is too long to fit on the QMF command line, issue the command from a command prompt panel. The name does not need to be delimited by quotation marks when continued on multiple lines on the panel.

CONFIRM
Whether or not a confirmation panel is displayed.
YES
Displays a confirmation panel if an object in the database will be removed by this command.
NO
No confirmation panel is displayed.
FOLDER
The name of the QMF folder object to use with the ERASE command.

You can erase a QMF object from a folder by using the FOLDER keyword with the ERASE command. When you erase a QMF object from a folder, the QMF object is erased from the folder only; the QMF object itself is not erased.

You can specify a folder name either by including the FOLDER keyword in the ERASE command or by setting the DSQEC_CURR_FOLDER global variable:
  • If the FOLDER keyword is specified with the ERASE command, that folder name overrides the folder name that is set in DSQEC_CURR_FOLDER.
  • If the FOLDER keyword is not specified with the ERASE command and DSQEC_CURR_FOLDER is set to a folder name, the object is removed from the folder that is specified by DSQEC_CURR_FOLDER.
  • If the FOLDER keyword is not specified and DSQEC_CURR_FOLDER is not set, the object itself is erased.

The folder name must be a valid QMF object name. The folder name cannot be a QMF object type, such as QUERY, PROC, FORM, ANALYTIC, or FOLDER. Wildcards '%' and '_' are not valid in a folder name. If the folder name includes a blank, the folder name must be enclosed in double quotation marks.

The FOLDER keyword is not valid when you are connected to a DB2® Server for VSE and VM database.

Usage notes

  • Objects can be erased only from the current database location. You cannot erase a remote table by using a three-part name. Instead, first connect to the location where the table is located, then issue the ERASE command. You cannot connect to a remote location if you have started QMF as a stored procedure.
  • If you specify an object name that does not exist, no warning message is issued from a linear procedure.
  • When you issue an ERASE TABLE command that references an unqualified table or view name, QMF sends the unqualified name to Db2® for resolution. Db2 uses the value in the CURRENT SCHEMA register to qualify the table or view name. QMF allows you to set the value of this register using the SET CURRENT SCHEMA statement.
  • When a QMF query, procedure, form, or analytics object is erased, that object is also removed from any folder object that references it.

Examples

  1. To display a command prompt panel:
    ERASE ?
  2. To erase the table PATTI.TABLEONE:
    ERASE TABLE PATTI.TABLEONE
  3. To erase a query named JBQUERY and display a confirmation panel:
    ERASE JBQUERY (CONFIRM=YES
  4. To erase the table PATTI.TABLETWO at the DALLAS location while your local location is BOISE, you must first connect to DALLAS:
    CONNECT TO DALLAS
    Then issue the ERASE command:
    ERASE TABLE PATTI.TABLETWO
  5. To erase a query named MYQUERY from a folder named SALES but not erase the query itself:
    ERASE QUERY MYQUERY (FOLDER=SALES
  6. When using the ERASE command in a QMF procedure, you must use double quotation marks to continue an authorization ID across more than one line within a QMF linear procedure. All continuation lines must have a plus (+) sign in column one, as shown in the following figure:
    Figure 1. Continuing an authorization ID across more than one line using the ERASE command
    PROC                                                           MODIFIED LINE   1
     ERASE QUERY 
     +"LOCATION12345678”.”LONGOWNERID123456789012345678901234567890123456789012345678
     +9012345678901234567890123456789012345678901234567890123456789012345678”.”LONGN
     +AME012345678901234567890123456789012345678901234567890123456789012345678901234
     +56789012345678901234567890123456789012345678”