Control file structure and basic elements

To understand how the Optimâ„¢ High Performance Unload control file syntax works, you must first be familiar with its general structure.

The first required definition is blocks. Blocks contain keyword options and their values. A block always starts with the name of the block itself. Optim High Performance Unload has several block types: GLOBAL, UNLOAD, USING BACKUP, and SELECT STATEMENT.

Every control file consists of an optional GLOBAL block followed by one or more UNLOAD blocks. Another way to look at the control file is as a sequence of one or more UNLOAD blocks, which can be optionally preceded by one GLOBAL block. Every GLOBAL and UNLOAD block must end with a semicolon. Other block types, such as BACKUP blocks are optional as well and can be embedded within other blocks. A control file can also contain blank lines and comments (lines preceded by two dashes). You can put comments anywhere in the control file. The following sample is a model that you can use to create a control file:
-- Control file for 
-- 
-- Created by :  
-- 
GLOBAL

; 
UNLOAD

;
The last three lines (UNLOAD, blank line and the semicolon) comprise the base for an UNLOAD block, and these three lines can be repeated as needed. A control file has at most one GLOBAL block, which if it is used, must be the first block, followed by one or more UNLOAD blocks. The skeleton for the GLOBAL block (GLOBAL, a blank line and the semicolon) can be deleted if you don't need it. Usually, you will have a GLOBAL block containing at least a CONNECT keyword option. The simplest valid control file would consist of a single UNLOAD block.
A block is terminated by a semicolon and contains keyword options and their values. A block, must be terminated by a semicolon, and might also include other blocks, each one of which must be terminated by a semicolon. If the last item within a block is an embedded block, then two consecutive semicolons are required; the first to terminate the embedded block, and the second to terminate the outer block. For example:
GLOBAL
DB2 NO
USING BACKUP CATALOG db2sampl USE TSM TAKEN AT 20040702 CATN 99 ;;
UNLOAD ... 
You can avoid the double semicolons by making sure the last item in a block is not an embedded block:
GLOBAL 
USING BACKUP CATALOG db2sampl USE TSM TAKEN AT 20040702 CATN 99; 
DB2 NO; 
UNLOAD ....

The Optim High Performance Unload syntax diagrams demonstrate all of the blocks along with all of the keyword options and values they can contain. In addition, the syntax diagrams include "specs". Specs are nonexistent and are used only as a convenience in the syntax diagrams to group related keyword options. Therefore, specs are never terminated by a semicolon.

A SELECT_STATEMENT block must always be the first thing in a SELECT clause and marks its beginning. The SELECT clauses are not considered blocks, and do not require a semicolon at the end. The SELECT_STATEMENT block is optionally followed by one or more keyword option value pairs. Those options will apply to the SELECT clause they appear in and not to any other SELECT clause.