In this section: How to: |
To index a field after you have entered data into the data source, use the INDEX subcommand. You can index up to seven fields in addition to those previously specified in the Master File or since the last REBUILD or CREATE command. The only requirement is that each field specified must be described with the FIELDTYPE=I (or INDEX=I) attribute in the Master File. If you add more than seven index fields, REBUILD INDEX displays the following message:
(FOC720) THE NUMBER OF INDEXES ADDED AFTER FILE CREATION EXCEEDS 7
The INDEX option uses the operating system sort program. You must have disk space to which you can write. To calculate the amount of space needed, add 8 to the length of the index field in bytes and multiply the sum by twice the number of segment instances
(LENGTH + 8) * 2n
where:
Is the number of segment instances.
You may decide to wait until after loading data to add the FIELDTYPE=I attribute and index the field. This is because the separate processes of loading data and indexing can be faster than performing both processes at the same time when creating the data source. This is especially true for large data sources.
Sort libraries and workspace must be available. The REBUILD allocates default sort work space in z/OS, if you have not already. DDNAMEs SORTIN and SORTOUT must be allocated prior to issuing a REBUILD INDEX.
In CMS, the following command identifies a specific sort product
SET SORTLIB = sortname
where:
Can be SYNCSORT, DFSORT, or VMSORT.
A CMS GLOBAL TXTLIB command must be issued prior to REBUILD INDEX to identify the location of the sort program. If the GLOBAL TXTLIB command and the SET SORTLIB commands are not issued:
If SORTLIB TXTLIB is not available at the time of REBUILD INDEX, the following message appears:
(FOC263) EXTERNAL FUNCTION OR LOAD MODULE NOT FOUND: SORT
The following steps describe how to use the INDEX subcommand:
REBUILD
The following options are available:
1. REBUILD (Optimize the database structure) 2. REORG (Alter the database structure) 3. INDEX (Build/modify the database index) 4. EXTERNAL INDEX (Build/modify an external index database) 5. CHECK (Check the database structure) 6. TIMESTAMP (Change the database timestamp) 7. DATE NEW (Convert old date formats to smartdate formats) 8. MDINDEX (Build/modify a multidimensional index)
INDEX or 3
Statistics appear when the REBUILD INDEX procedure is complete, including the field names that were indexed and the number of index values included.
The following examples illustrate how to use the INDEX subcommand.
The following example illustrates REBUILD INDEX:
cms global txtlib vmslib set sortlib = vmsort rebuild
Enter option 1. REBUILD (Optimize the database structure) 2. REORG (Alter the database structure) 3. INDEX (Build/modify the database index) 4. EXTERNAL INDEX (Build/modify an external index database) 5. CHECK (Check the database structure) 6. TIMESTAMP (Change the database timestamp) 7. DATE NEW (Convert old date formats to smartdate formats) 8. MDINDEX (Build/modify a multidimensional index)
index
ENTER THE NAME OF THE MASTER employee ENTER NAME OF FIELD TO INDEX (OR * FOR ALL) emp_id STARTING.. (FOC319) WARNING. THE FIELD IS INDEXED AFTER THE FILE WAS CREATED: EMP_ID INDEX VALUES RETRIEVED= 12 SORT COMPLETE .. RET CODE 0 INDEX INITIALIZED FOR: EMP_ID INDEX VALUES INCLUDED= 12 >
REBUILD INDEX uses an external sort. FOCUS searches for the system-installed sort product using its normal search path.
> > tso alloc f(sortin) sp(1 1) tracks > > tso alloc f(sortout) sp(1 1) tracks > > tso alloc f(sysout) da(*) > > rebuild Enter option 1. REBUILD (Optimize the database structure) 2. REORG (Alter the database structure) 3. INDEX (Build/modify the database index) 4. EXTERNAL INDEX (Build/modify an external index database) 5. CHECK (Check the database structure) 6. TIMESTAMP (Change the database timestamp) 7. DATE NEW (Convert old date formats to smartdate formats) 8. MDINDEX (Build/modify a multidimensional index) > 3 INDEX
ENTER THE NAME OF THE MASTER > employee ENTER NAME OF FIELD TO INDEX (OR * FOR ALL) > emp_id STARTING.. (FOC319) WARNING. THE FIELD IS INDEXED AFTER THE FILE WAS CREATED: EMP_ID INDEX VALUES RETRIEVED= 12 SORT COMPLETE .. RET CODE 0 INDEX INITIALIZED FOR: EMP_ID INDEX VALUES INCLUDED= 12
Information Builders |