INITIALIZE command: Difference between revisions
(→Syntax) |
m (File Manager's Guide ref) |
||
Line 80: | Line 80: | ||
<p>The order of the options is unimportant. A full description of different <var class="product">Model 204</var> file types is included in the <var>Model 204 File Manager's Guide.</var></p> | <p>The order of the options is unimportant. A full description of different <var class="product">Model 204</var> file types is included in the <var>Model 204 File Manager's Guide.</var></p> | ||
====Specifying field attributes==== | ====Specifying field attributes==== | ||
<p>For sort or hash key fields, <var class="product">Model 204</var> automatically supplies the following field attributes as though you had entered them:</p> | <p> | ||
For sort or hash key fields, <var class="product">Model 204</var> automatically supplies the following field attributes as though you had entered them:</p> | |||
<p class="code">(NON-CODED STRING VISIBLE) | <p class="code">(NON-CODED STRING VISIBLE) | ||
</p> | </p> | ||
Line 86: | Line 87: | ||
<p class="code">(NON-CODED STRING VISIBLE NON-KEY) | <p class="code">(NON-CODED STRING VISIBLE NON-KEY) | ||
</p> | </p> | ||
<p>Neither sort nor hash key fields can have the UPDATE attribute. </p> | <p> | ||
<p>If a sort or hash key is required in every record, you can specify the OCCURS 1 attribute. If a key is not required, do not specify the OCCURS attribute. </p> | Neither sort nor hash key fields can have the UPDATE attribute. </p> | ||
<p>For record security fields, the KEY attribute is automatically supplied.</p> | <p> | ||
If a sort or hash key is required in every record, you can specify the OCCURS 1 attribute. If a key is not required, do not specify the OCCURS attribute. </p> | |||
<p> | |||
For record security fields, the KEY attribute is automatically supplied.</p> | |||
<p>The following example code illustrates when a hash or sort key file or a record security file is initialized:</p> | <p>The following example code illustrates when a hash or sort key file or a record security file is initialized:</p> | ||
<p class="code"><b>OPEN filename</b> | <p class="code"><b>OPEN filename</b> | ||
Line 96: | Line 100: | ||
<b></b>*** M204.0765: ENTER SORT, HASH, OR RECORD SECURITY KEY | <b></b>*** M204.0765: ENTER SORT, HASH, OR RECORD SECURITY KEY | ||
</p> | </p> | ||
<p>When <var class="product">Model 204</var> processes the INITIALIZE command, <var class="product">Model 204</var> ends any update unit in progress and begins a non-backoutable update unit | <p> | ||
When <var class="product">Model 204</var> processes the INITIALIZE command, <var class="product">Model 204</var> ends any [[File integrity and recovery#Update units and transactions|update unit]] in progress and begins a non-backoutable update unit. </p> | |||
====Keeping field definitions==== | ====Keeping field definitions==== | ||
<p>KEEPDEFS processing happens only on a file that has fields defined. If you specify the KEEPDEFS option, but no field name definitions are associated with the file, the following message is issued. Processing continues as though the option had not been specified. File pages-including Table A, MANY-VALUED, and FEW-VALUED pages-are formatted as they are when KEEPDEFS is not specified. </p> | <p>KEEPDEFS processing happens only on a file that has fields defined. If you specify the KEEPDEFS option, but no field name definitions are associated with the file, the following message is issued. Processing continues as though the option had not been specified. File pages-including Table A, MANY-VALUED, and FEW-VALUED pages-are formatted as they are when KEEPDEFS is not specified. </p> |
Revision as of 16:19, 20 January 2015
Summary
- Privileges
- File manager
- Function
- Clears the data while preserving the structure of an open Model 204 file
Syntax
[IN filename] INITIALIZE [ SORT|HASH fldName [( defineFldStyleAttributes )] ] [ RECSCTY fldName [( defineFldStyleAttributes )] ] Or [IN filename] INITIALIZE KEEPDEF[S]
Where:
-
KEEPDEFS specifies that INITIALIZE processing retain the field definitions when issued on a file that has defined fields. With the KEEPDEFS option, INITIALIZE processing will not format Table A attribute pages. The KEEPDEFS argument is entered on the INITIALIZE command line.
-
If KEEPDEFS is specified on the INITIALIZE command line, then the INITIALIZE processing verifies the presence of the sort or hash and/or record security fields, if specified by the FILEORG and/or OPENCTL parameters. In this case, the file manager cannot define or redefine those fields.
-
If the KEEPDEFS is not specified, and the FILEORG creation parameter defines the file to be either HASH or SORT and/or the OPENCTL parameter defines the file to be a record security file, then additional input lines follow the INITIALIZE command line. One line defines the field to be used as the hash or sort key and one line defines the field to be used as a record security key. The field-description lines may be in either order.
-
-
RECSCTY specifies that the field-description that follows is a record security file. If the OPENCTRL parameter defines the file as a record security file, the RECSCTY clause is mandatory. The INITIALIZE process automatically defines any record security field to have the Model 204 attribute of KEY.
-
field-description is a description of a field in the Model 204 file. It is specified in the form:
fieldname (attribute [,attribute...])]
In the field-description, attributes must be separated by commas or blanks and must be enclosed in parentheses. The other rules for specifying field names and attributes are presented in the description of the DEFINE command and are discussed in detail in the Model 204 File Manager's Guide.
-
SORT or HASH, which are mutually exclusive, specifies that the filed-description that follows is a key field on which the file is sorted or on which a hash key is specified. SORT or HASH is required, if the FILEORG parameter defined the file SORT or HASH. The sort or hash field need not be defined with the Model 204 field attribute KEY.
Usage notes
You must issue an INITIALIZE command in file context: that is, the current default must be a file, not a group, following the OPEN command for the file.
-
If the file already has data in it, the data is erased; however, parameter settings for the file are preserved.
-
If the KEEPDEFS option was also specified, the field definitions are preserved along with the parameter settings.
To use the INITIALIZE command you must have update authority to the selected file. If the file is open for read-only access, the INITIALIZE command is rejected with the following message:
M204.1036: UPDATES NOT PERMITTED.
Specifying INITIALIZE options-optional, but mandatory
You must specify the appropriate option(s) on the following types of file:
-
For a sort file, you must specify the SORT option before field- description.
-
For a hash file, you must specify the HASH option before field-description.
-
For a file with record security in effect, you must specify the RECSCTY option before field-description.
The order of the options is unimportant. A full description of different Model 204 file types is included in the Model 204 File Manager's Guide.
Specifying field attributes
For sort or hash key fields, Model 204 automatically supplies the following field attributes as though you had entered them:
(NON-CODED STRING VISIBLE)
For hash key fields, Model 204 also supplies the NON-KEY attribute as though you had entered them as follows:
(NON-CODED STRING VISIBLE NON-KEY)
Neither sort nor hash key fields can have the UPDATE attribute.
If a sort or hash key is required in every record, you can specify the OCCURS 1 attribute. If a key is not required, do not specify the OCCURS attribute.
For record security fields, the KEY attribute is automatically supplied.
The following example code illustrates when a hash or sort key file or a record security file is initialized:
OPEN filename *** M204.0620: FILE filename OPENED *** M204.0627: FILE filename IS NOT INITIALIZED INITIALIZE *** M204.0765: ENTER SORT, HASH, OR RECORD SECURITY KEY
When Model 204 processes the INITIALIZE command, Model 204 ends any update unit in progress and begins a non-backoutable update unit.
Keeping field definitions
KEEPDEFS processing happens only on a file that has fields defined. If you specify the KEEPDEFS option, but no field name definitions are associated with the file, the following message is issued. Processing continues as though the option had not been specified. File pages-including Table A, MANY-VALUED, and FEW-VALUED pages-are formatted as they are when KEEPDEFS is not specified.
M204.2646 'KEEPDEFS' SPECIFIED AND NO FIELD DEFINITIONS PRESENT, 'KEEPDEFS' IGNORED
If KEEPDEFS processing ends with one of the following variations of message M204.2645, the file remains as it was before the INITIALIZE KEEPDEFS command was issued. The possible variations are:
M204.2645 'KEEPDEFS' SPECIFIED AND SOME FIELD DEFINITION PAGES ARE UNREADABLE M204.2645 'KEEPDEFS' SPECIFIED AND FIELD DEFINITION PAGES NOT PREVIOUSLY INITIALIZED M204.2645 'KEEPDEFS' SPECIFIED AND THE NECESSARY SORT/HASH/RECORD FIELD(S) ARE NOT PRESENT
Note: The previous message, M204.2646, is never issued for a SORT, HASH, or RECSCTY file; for those types of files, only message M204.2645 can be issued.
Completion of an INITIALIZE KEEPDEFS command ends with the message:
M204.0764 END FILE INITIALIZATION: <filename> - FIELD DEFINITIONS PRESERVED
Limitation to INITIALIZE KEEPDEFS
You cannot use an INITIALIZE KEEPDEFS command to recover deleted space in the Table A attribute pages; it merely skips formatting those pages.
Examples
OPEN CARS *** M204.0620: FILE CARS OPENED *** M204.0627: CARS IS NOT INITIALIZED INITIALIZE *** M204.0765: ENTER SORT, HASH, OR RECORD SECURITY KEY SORT SERIAL NUMBER (OCCURS 1 LENGTH 10) *** M204.0765: ENTER SORT, HASH, OR RECORD SECURITY KEY RECSCTY RECSEC OPEN TESTFILE *** M204.0620: FILE TESTFILE OPENED *** M204.0627: TESTFILE IS NOT INITIALIZED INITIALIZE KEEPDEFS *** M204.0763: BEGIN FILE INITIALIZATION: TESTFILE *** M204.0764: END FILE INITIALIZATION: TESTFILE - FIELD DEFINITIONS PRESERVED