Use DS

PURPOSE:  The USE DS command declares a specified Data Set (DS) upon which subsequent commands operate.

Syntax

USE DS name [IN DBL dbl_name] [DI NAME]

[CHECK COUNT]

[SHOW/ING/ COUNT]

[ALWAYS; CREATE /IF MISSING/]

USE NO DS

USE DS name

references the name of the DS to be declared for use in the current DBL.

DI name

activates the named DI for the declared DS.

IN DBL dbl_name

is used to declare a DS in a Data Base Library (DBL) other than the current one.

CHECK COUNT

checks the number of records in the declared DS as recorded in the DBL against the actual number.  If there is a discrepancy, the recorded count is updated, and the message COUNT UPDATED is displayed.  If the records are fixed length (e.g., only on record type), the count is calculated by dividing the file size by the record size.  Otherwise the records are read.

SHOW/ING/ COUNT

requests ACCENT R to display the record count of the declared DS as recorded in the DBL.  If the DS has been manipulated external to ACCENT R, it is possible for the displayed count to be incorrect.  Unless CHECK COUNT is specified.

ALWAYS

creates the associated DS system file if it does not exist.  Normally, a USE DS command will generate an error if no system file exists for the declared DS.

CREATE /IF MISSING/

checks for the existence of the DS file and immediately creates an empty DS file if it does no exist.  The difference between ALWAYS and CREATE /IF MISSING/ is that ALWAYS creates the DS file only if records are entered into it, while CREATE /IF MISSING/ immediately creates a DS file if it does not exist.

USE NO DS

closes a currently declared DS.

EXAMPLE

*USE DBL BOOKS
*USE DS PUBLISHER CHECK COUNT
COUNT UPDATED
*

If the count is wrong, ACCENT R displays the message COUNT UPDATED.  If the count is right, nothing is displayed.

*USE DS BOOKS_DBM2 CHECK COUNT SHOWING COUNT
21 Records

Even though there was no disparity in record count for DS BOOKS_DBM2 above, the SHOWING COUNT option caused the count to be displayed.

*USE DS BOOKS_DBM2 DI BOOKS

This command declares the DS BOOKS_DBM2 and invokes the DI BOOKS_DBM2 so that all subsequent processing is done through the DI.  This command requires a DBL be declared.

NOTES:  The DS that is presently declared is known as the current DS.  It functions as the master DS for all subsequent commands until another DS is declared, the USE NO DS command is issued, another DBL is declared, or the current ACCENT R session is terminated.

If a REMOVE command specifies the current DS for removal, ACCENT R sets the USE NO DS condition.  An error message will be displayed if a DS with corrupt data is used.  The "IN DBL" clause must follow the name of the DS or DI.