INITIALIZE command: Difference between revisions
m (File Manager's Guide ref) |
m (File Manager's Guide ref) |
||
Line 6: | Line 6: | ||
<dd>Clears the data while preserving the structure of an open <var class="product">Model 204</var> file | <dd>Clears the data while preserving the structure of an open <var class="product">Model 204</var> file | ||
</dl> | </dl> | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"> | <p class="syntax"><span class="squareb">[</span><span class="literal">IN</span> <span class="term">filename</span><span class="squareb">]</span> <span class="literal">INITIALIZE</span> | ||
<span class="squareb">[</span><span class="literal">IN</span> <span class="term">filename</span><span class="squareb">]</span> <span class="literal">INITIALIZE</span> | |||
<span class="squareb">[</span> <span class="literal">SORT</span><span class="squareb">|</span><span class="literal">HASH</span> <span class="term">fldName</span> <span class="squareb">[</span><span class="literal">(</span> <span class="term">defineFldStyleAttributes</span> <span class="literal">)</span><span class="squareb">]</span> <span class="squareb">]</span> | <span class="squareb">[</span> <span class="literal">SORT</span><span class="squareb">|</span><span class="literal">HASH</span> <span class="term">fldName</span> <span class="squareb">[</span><span class="literal">(</span> <span class="term">defineFldStyleAttributes</span> <span class="literal">)</span><span class="squareb">]</span> <span class="squareb">]</span> | ||
<span class="squareb">[</span> <span class="literal">RECSCTY</span> <span class="term">fldName</span> <span class="squareb">[</span><span class="literal">(</span> <span class="term">defineFldStyleAttributes</span> <span class="literal">)</span><span class="squareb">]</span> <span class="squareb">]</span> | <span class="squareb">[</span> <span class="literal">RECSCTY</span> <span class="term">fldName</span> <span class="squareb">[</span><span class="literal">(</span> <span class="term">defineFldStyleAttributes</span> <span class="literal">)</span><span class="squareb">]</span> <span class="squareb">]</span> </p> | ||
Or | Or: | ||
<span class="squareb">[</span><span class="literal">IN</span> <span class="term">filename</span><span class="squareb">]</span> <span class="literal">INITIALIZE</span> <span class="literal">KEEPDEF</span><span class="squareb">[</span><span class="literal">S</span><span class="squareb">]</span> | <p class="syntax"><span class="squareb">[</span><span class="literal">IN</span> <span class="term">filename</span><span class="squareb">]</span> <span class="literal">INITIALIZE</span> <span class="literal">KEEPDEF</span><span class="squareb">[</span><span class="literal">S</span><span class="squareb">]</span> | ||
</p> | </p> | ||
Where: | |||
<ul> | <ul> | ||
<li | <li><var>KEEPDEFS </var>specifies that <var>INITIALIZE</var> processing retain the field definitions when issued on a file that has defined fields. With the <var>KEEPDEFS</var> option, <var>INITIALIZE</var> processing will not format Table A attribute pages. The <var>KEEPDEFS</var> argument is entered on the <var>INITIALIZE</var> command line. | ||
<p> | |||
< | If <var>KEEPDEFS</var> is specified on the <var>INITIALIZE</var> command line, then the <var>INITIALIZE</var> processing verifies the presence of the sort or hash and/or record security fields, if specified by the <var>[[FILEORG parameter|FILEORG]]</var> and/or <var>[[OPENCTL parameter|OPENCTL]]</var> parameters. In this case, the file manager cannot define or redefine those fields.</p> | ||
< | <p> | ||
If <var>KEEPDEFS</var> is not specified, and the <var>FILEORG</var> creation parameter defines the file to be either <var>HASH</var> or <var>SORT</var> and/or the <var>OPENCTL</var> parameter defines the file to be a record security file, then additional input lines follow the <var>INITIALIZE</var> 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.</p></li> | |||
< | |||
< | |||
< | |||
</li> | |||
<li> | <li><var>RECSCTY</var> specifies that the field-description that follows is a record security file. If the <var>OPENCTRL</var> parameter defines the file as a record security file, the <var>RECSCTY</var> clause is mandatory. The <var>INITIALIZE</var> process automatically defines any record security field to have the <var class="product">Model 204</var> attribute of <var>KEY</var>.</li> | ||
< | |||
</li> | |||
<li> | <li><var class="term">field-description</var> is a description of a field in the <var class="product">Model 204</var> file. It is specified in the form: | ||
< | |||
<p class="code"><i>fieldname</i> (<i>attribute</i> [,<i>attribute</i>...])] | <p class="code"><i>fieldname</i> (<i>attribute</i> [,<i>attribute</i>...])] | ||
</p> | </p> | ||
<p>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 | <p> | ||
</li> | 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 [[DEFINE FIELD command]] and are discussed in detail in [[Field design]].</p></li> | ||
<li | <li><var>SORT</var> or <var>HASH</var>, 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. <var>SORT</var> or <var>HASH</var> is required, if the <var>FILEORG</var> parameter defined the file <var>SORT</var> or <var>HASH</var>. The sort or hash field need not be defined with the <var class="product">Model 204</var> field attribute <var>KEY</var>.</li> | ||
</ul> | |||
</li> | |||
==Usage notes== | ==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. | You must issue an <var>INITIALIZE</var> command in file context: that is, the current default must be a file, not a group, following the OPEN command for the file. | ||
<ul> | <ul> | ||
<li> | <li> | ||
Line 57: | Line 45: | ||
<li> | <li> | ||
<p>If the KEEPDEFS option was also specified, the field definitions are preserved along with the parameter settings.</p> | <p>If the <var>KEEPDEFS</var> option was also specified, the field definitions are preserved along with the parameter settings.</p> | ||
</li> | </li> | ||
</ul> | |||
<p>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: </p> | <p> | ||
To use the <var>INITIALIZE</var> command you must have update authority to the selected file. If the file is open for read-only access, the <var>INITIALIZE</var> command is rejected with the following message: </p> | |||
<p class="code">M204.1036: UPDATES NOT PERMITTED. | <p class="code">M204.1036: UPDATES NOT PERMITTED. | ||
</p> | </p> | ||
====Specifying INITIALIZE options | |||
<p>You must specify the appropriate option(s) on the following types of file: </p> | ====Specifying mandatory INITIALIZE options==== | ||
<p> | |||
You must specify the appropriate option(s) on the following types of file: </p> | |||
<ul> | <ul> | ||
<li> | <li> | ||
<p>For a sort file, you must specify the SORT option before field- description. </p> | <p>For a sort file, you must specify the <var>SORT</var> option before field-description. </p> | ||
</li> | </li> | ||
<li> | <li> | ||
<p>For a hash file, you must specify the HASH option before field-description. </p> | <p>For a hash file, you must specify the <var>HASH</var> option before field-description. </p> | ||
</li> | </li> | ||
<li> | <li> | ||
<p>For a file with record security in effect, you must specify the RECSCTY option before field-description. </p> | <p>For a file with record security in effect, you must specify the <var>RECSCTY</var> option before field-description. </p> | ||
</li> | </li> | ||
</ul> | |||
<p>The order of the options is unimportant. A full description of different <var class="product">Model 204</var> file types is included in | <p> | ||
The order of the options is unimportant. A full description of different <var class="product">Model 204</var> file types is included in [[File design#Specifying a file organization|Specifying a file organization]].</p> | |||
====Specifying field attributes==== | ====Specifying field attributes==== | ||
<p> | <p> | ||
Line 84: | Line 77: | ||
<p class="code">(NON-CODED STRING VISIBLE) | <p class="code">(NON-CODED STRING VISIBLE) | ||
</p> | </p> | ||
For hash key fields, <var class="product">Model 204</var> also supplies the NON-KEY attribute as though you had entered them as follows: | For hash key fields, <var class="product">Model 204</var> also supplies the <var>NON-KEY</var> attribute as though you had entered them as follows: | ||
<p class="code">(NON-CODED STRING VISIBLE NON-KEY) | <p class="code">(NON-CODED STRING VISIBLE NON-KEY) | ||
</p> | </p> | ||
<p> | <p> | ||
Neither sort nor hash key fields can have the UPDATE attribute. </p> | Neither sort nor hash key fields can have the <var>UPDATE</var> 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> | 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> | <p> | ||
For record security fields, the KEY attribute is automatically supplied.</p> | For record security fields, the <var>KEY</var> 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> | ||
<b></b>*** M204.0620: FILE filename OPENED | <b></b>*** M204.0620: FILE filename OPENED | ||
Line 101: | Line 95: | ||
</p> | </p> | ||
<p> | <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> | When <var class="product">Model 204</var> processes the <var>INITIALIZE</var> 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> | ||
<var>KEEPDEFS</var> processing happens only on a file that has fields defined. If you specify the <var>KEEPDEFS</var> 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 <var>KEEPDEFS</var> is not specified. </p> | |||
<p class="code">M204.2646 'KEEPDEFS' SPECIFIED AND NO FIELD DEFINITIONS PRESENT, 'KEEPDEFS' IGNORED | <p class="code">M204.2646 'KEEPDEFS' SPECIFIED AND NO FIELD DEFINITIONS PRESENT, 'KEEPDEFS' IGNORED | ||
</p> | </p> | ||
<p>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: </p> | <p> | ||
If <var>KEEPDEFS</var> processing ends with one of the following variations of message M204.2645, the file remains as it was before the <code>INITIALIZE KEEPDEFS</code> command was issued. The possible variations are: </p> | |||
<p class="code">M204.2645 'KEEPDEFS' SPECIFIED AND SOME FIELD DEFINITION PAGES ARE UNREADABLE | <p class="code">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 FIELD DEFINITION PAGES NOT PREVIOUSLY INITIALIZED | ||
Line 113: | Line 109: | ||
</p> | </p> | ||
<p class="note"><b>Note:</b> 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.</p> | <p class="note"><b>Note:</b> 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.</p> | ||
<p>Completion of an INITIALIZE KEEPDEFS command ends with the message: </p> | <p> | ||
<p class="code">M204.0764 END FILE INITIALIZATION: | Completion of an <code>INITIALIZE KEEPDEFS</code> command ends with the message: </p> | ||
<p class="code">M204.0764 END FILE INITIALIZATION: <filename> - FIELD DEFINITIONS PRESERVED | |||
</p> | </p> | ||
====Limitation to INITIALIZE KEEPDEFS==== | ====Limitation to INITIALIZE KEEPDEFS==== | ||
<p>You cannot use an INITIALIZE KEEPDEFS command to recover deleted space in the Table A attribute pages; it merely skips formatting those pages.</p> | <p> | ||
You cannot use an <code>INITIALIZE KEEPDEFS</code> command to recover deleted space in the Table A attribute pages; it merely skips formatting those pages.</p> | |||
==Examples== | ==Examples== | ||
<p class="code"><b>OPEN CARS</b> | <p class="code"><b>OPEN CARS</b> | ||
Line 134: | Line 134: | ||
<b></b>*** M204.0764: END FILE INITIALIZATION: TESTFILE - FIELD DEFINITIONS PRESERVED | <b></b>*** M204.0764: END FILE INITIALIZATION: TESTFILE - FIELD DEFINITIONS PRESERVED | ||
</p> | </p> | ||
[[Category: File manager commands]] | [[Category: File manager commands]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Revision as of 16:54, 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 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 DEFINE FIELD command and are discussed in detail in Field design.
- 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 mandatory INITIALIZE options
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 Specifying a file organization.
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