DB2 Server for VSE & VM: Database Services Utility


Working with a Control File in DB2 Server for VM

Using a Control File

The control file contains a group of SQL statements and Database Services Utility commands to be executed. Grouping these commands in one file gives you the option of saving the file for periodic execution of the sequence of commands in it; you do not have to retype these commands. Use a control file when running a batch job, testing statements or commands, or when you expect to use the same or similar utility commands again.

Creating a Control File

Create a control file by using an editor program as follows.

  1. Give your control file a file name, file type, and file mode and start the editor. If you are doing this exercise to learn about the Database Services Utility, call your control file COMMANDS DBSU A (if you are using your A-disk), and set the width of the file to 80.
  2. Type the desired utility commands and SQL statements. You must use uppercase; for example, you can type:
    SELECT * FROM SQLDBA.DEPARTMENT;
    SELECT * FROM SQLDBA.PROJECT;
    

    Note:Always end SQL statements with a semicolon.

  3. If your editor program is set to variable length record format, set it to a fixed length record format.
    Note:This step sets the record length of the control file to a fixed length. If the default of the editor is set to variable length record format, you must repeat this step each time you edit the file.
  4. Store the control file and leave the editor.

For more information on Database Services Utility commands, see Chapter 8, "Command Reference". For more information on SQL statements, see the DB2 Server for VSE & VM SQL Reference.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]