OPEN FILE command: Difference between revisions
(→Syntax) |
(→Syntax) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
</dl> | </dl> | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"> | <p class="syntax"><b>O</b>PEN [FILE] <var class="term">filename</var> [AT <var class="term">location</var>] | ||
[[,<var class="term">defupdt1</var>] [,<var class="term">defupdt2</var>]] | [[,<var class="term">defupdt1</var>] [,<var class="term">defupdt2</var>]] | ||
</p> | </p> | ||
Line 20: | Line 20: | ||
<ul> | <ul> | ||
<li> | <li> | ||
<p> | <p> | ||
For [[PQO: Overview of Parallel Query Option/204|Parallel Query Option/204]] files, this is the symbolic name (as many as eight characters) that refers to the location of the node on which the remote file resides. An unquoted equal sign (<tt>=</tt>) specifies that the file is local.</p> | |||
</li> | </li> | ||
<li> | <li> | ||
<p>If remote, must match a symbolic destination name specified in the DESTINATION parameter of the relevant local client DEFINE PROCESS command.</p> | <p>If remote, must match a symbolic destination name specified in the <var>DESTINATION</var> parameter of the relevant local client <var>DEFINE PROCESS</var> command.</p> | ||
</li> | </li> | ||
</ul> | |||
</li> | </li> | ||
<li> | <li> | ||
<p><var class="term">defupdt1</var> is the name of the fixed-length deferred update data set. If this option is specified, deferred updates to KEY and NUMERIC RANGE fields are written to the fixed-length deferred update data set (1 to 8 characters in the form TAPE<var class="term">xxxx</var>).</p> | <p><var class="term">defupdt1</var> is the name of the fixed-length deferred update data set. If this option is specified, deferred updates to <var>KEY</var> and <var>NUMERIC RANGE</var> fields are written to the fixed-length deferred update data set (1 to 8 characters in the form TAPE<var class="term">xxxx</var>).</p> | ||
</li> | </li> | ||
<li> | <li> | ||
<p><var class="term">defupdt2</var> is the name of the variable-length deferred update data set. If this option is specified, deferred updates to ORDERED fields are written to the variable-length deferred update data set. All deferred index updates are written to defupdt2 if defupdt1 is not specified. If defupdt2 is not specified, updates to ORDERED fields are not deferred.</p> | <p><var class="term">defupdt2</var> is the name of the variable-length deferred update data set. If this option is specified, deferred updates to <var>ORDERED</var> fields are written to the variable-length deferred update data set. All deferred index updates are written to defupdt2 if defupdt1 is not specified. If defupdt2 is not specified, updates to <var>ORDERED</var> fields are not deferred.</p> | ||
<p>Deferred updates are updates to the <var class="product">Model 204</var> file index that are saved and applied all at the same time.</p> | <p>Deferred updates are updates to the <var class="product">Model 204</var> file index that are saved and applied all at the same time.</p> | ||
<p>For user privileges needed to open deferred update data sets through a security interface, see | <p> | ||
<p>For information about opening remote files in deferred update mode, see | For user privileges needed to open deferred update data sets through a security interface, see [[:Category:Security interfaces|Security interfaces]].</p> | ||
<p> | |||
For information about opening remote files in deferred update mode, see [[PQO: Remote files and scattered groups]]. </p> | |||
</li> | </li> | ||
</ul> | |||
===Syntax notes=== | ===Syntax notes=== | ||
A comma is required if a deferred update name is specified. If the comma is omitted, the name is ignored and no message is generated. | A comma is required if a deferred update name is specified. If the comma is omitted, the name is ignored and no message is generated. | ||
==Example== | ==Example== | ||
The following command opens the <var class="product">Model 204</var> file CENSUS in deferred update mode. Hashed index deferred updates are written to defupdt1, TAPEFIX, and Ordered Index deferred updates are written to defupdt2, TAPEVAR: | The following command opens the <var class="product">Model 204</var> file <code>CENSUS</code> in deferred update mode. Hashed index deferred updates are written to <var class="term">defupdt1</var>, <code>TAPEFIX</code>, and Ordered Index deferred updates are written to <var class="term">defupdt2</var>, <code>TAPEVAR</code>: | ||
<p class="code">*** M204.0620: FILE CENSUS OPENED | <p class="code">*** M204.0620: FILE CENSUS OPENED | ||
<b></b>*** M204.1203: CENSUS WAS LAST UPDATED ON 89.003 JAN03 10.24.12 | <b></b>*** M204.1203: CENSUS WAS LAST UPDATED ON 89.003 JAN03 10.24.12 | ||
<b></b>*** M204.0656: UPDATES DEFERRED TO TAPEFIX TAPEVAR | <b></b>*** M204.0656: UPDATES DEFERRED TO TAPEFIX TAPEVAR | ||
</p> | </p> | ||
<p>The following command opens the <var class="product">Model 204</var> file CENSUS in deferred update mode. All index updates are written to defupdt2, TAPEVAR:</p> | <p> | ||
The following command opens the <var class="product">Model 204</var> file <code>CENSUS</code> in deferred update mode. All index updates are written to <var class="term">defupdt2</var>, <code>TAPEVAR</code>:</p> | |||
<p class="code"><b>OPEN FILE CENSUS,,TAPEVAR </b> | <p class="code"><b>OPEN FILE CENSUS,,TAPEVAR </b> | ||
<b></b>*** M204.0620: FILE CENSUS OPENED | <b></b>*** M204.0620: FILE CENSUS OPENED | ||
Line 55: | Line 60: | ||
<b></b>*** M204.0656: UPDATES DEFERRED TO TAPEVAR | <b></b>*** M204.0656: UPDATES DEFERRED TO TAPEVAR | ||
</p> | </p> | ||
<p>The following command opens the <var class="product">Model 204</var> file CENSUS in deferred update mode. Hashed index updates are written to TAPEFIX. Ordered Index updates are not deferred:</p> | <p>The following command opens the <var class="product">Model 204</var> file <code>CENSUS</code> in deferred update mode. Hashed index updates are written to <code>TAPEFIX</code>. Ordered Index updates are not deferred:</p> | ||
<p class="code">OPEN FILE CENSUS,TAPEFIX | <p class="code">OPEN FILE CENSUS,TAPEFIX | ||
<b></b>*** M204.0620: FILE CENSUS OPENED | <b></b>*** M204.0620: FILE CENSUS OPENED | ||
Line 61: | Line 66: | ||
<b></b>*** M204.0656: UPDATES DEFERRED TO TAPEFIX | <b></b>*** M204.0656: UPDATES DEFERRED TO TAPEFIX | ||
</p> | </p> | ||
==Usage notes== | ==Usage notes== | ||
<p>A <var class="product">Model 204</var> file is a collection of records. A file group is a collection of <var class="product">Model 204</var> files that <var class="product">Model 204</var> treats logically as a single file. An individual file can be a member of several different groups. Any user can open several files or groups during a single <var class="product">Model 204</var> session. These remain open until a CLOSE, LOGOUT, or DISCONNECT command is issued or until the user is restarted.</p> | <p> | ||
<p>The file or group specified in the most recent OPEN command is considered the default file or group. Thus, a successful OPEN command causes the current default file or group to be replaced. If an OPEN command is rejected, the default is not changed.</p> | A <var class="product">Model 204</var> file is a collection of records. A file group is a collection of <var class="product">Model 204</var> files that <var class="product">Model 204</var> treats logically as a single file. An individual file can be a member of several different groups. Any user can open several files or groups during a single <var class="product">Model 204</var> session. These remain open until a CLOSE, LOGOUT, or DISCONNECT command is issued or until the user is restarted.</p> | ||
<p>If no specific file or group specification is included in the OPEN command, as in:</p> | <p> | ||
The file or group specified in the most recent OPEN command is considered the default file or group. Thus, a successful OPEN command causes the current default file or group to be replaced. If an OPEN command is rejected, the default is not changed.</p> | |||
<p> | |||
If no specific file or group specification is included in the OPEN command, as in:</p> | |||
<p class="code">OPEN CENSUS | <p class="code">OPEN CENSUS | ||
</p> | </p> | ||
<p><var class="product">Model 204</var> attempts to determine whether a file or a group is to be opened. <var class="product">Model 204</var> searches first for a temporary group that has the specified name. If no temporary group is found, <var class="product">Model 204</var> tries to open a permanent group by using that name. If a permanent group cannot be found, <var class="product">Model 204</var> searches for a file by that name. Further OPEN processing depends upon what type of file or group is actually being opened.</p> | <p> | ||
<p>There are three types of files:</p> | <var class="product">Model 204</var> attempts to determine whether a file or a group is to be opened. <var class="product">Model 204</var> searches first for a temporary group that has the specified name. If no temporary group is found, <var class="product">Model 204</var> tries to open a permanent group by using that name. If a permanent group cannot be found, <var class="product">Model 204</var> searches for a file by that name. Further OPEN processing depends upon what type of file or group is actually being opened.</p> | ||
<p> | |||
There are three types of files:</p> | |||
<ul> | <ul> | ||
<li> | <li> | ||
Line 82: | Line 93: | ||
</li> | </li> | ||
</ul> | </ul> | ||
<p>If the file is public, <var class="product">Model 204</var> opens it without asking for a file password. You are given the default file privileges assigned to the file by the file manager.</p> | <p> | ||
<p>If the file is semi-public or private, <var class="product">Model 204</var> asks you to enter a valid password as shown:</p> | If the file is public, <var class="product">Model 204</var> opens it without asking for a file password. You are given the default file privileges assigned to the file by the file manager.</p> | ||
<p class="code">***M204.0347: PASSWORD | <p> | ||
If the file is semi-public or private, <var class="product">Model 204</var> asks you to enter a valid password as shown:</p> | |||
<p class="code">***M204.0347: PASSWORD [<i>password</i> [:<i>new-password</i>]] | |||
</p> | </p> | ||
<p>where password or new password is a valid password for the file to be opened (1 to 8 characters); it cannot contain spaces, commas, or colons. Each file can have several passwords defined for it. If you enter a valid password, the file is opened with the file privileges associated with that password.</p> | <p> | ||
<p>For a semi-public file, if you do not know the password for the file and simply enter a carriage return, the file is opened and you are given the default privileges for the file. An invalid password also causes the file to be opened, but only default privileges are granted. For a private file, you must enter a valid password or the file is not opened. If the file privileges for a file include the ability to update data, the following message is displayed when the file is successfully opened:</p> | where <var class="term">password</var> or <var class="term">new-password</var> is a valid password for the file to be opened (1 to 8 characters); it cannot contain spaces, commas, or colons. Each file can have several passwords defined for it. If you enter a valid password, the file is opened with the file privileges associated with that password.</p> | ||
<p> | |||
For a semi-public file, if you do not know the password for the file and simply enter a carriage return, the file is opened and you are given the default privileges for the file. An invalid password also causes the file to be opened, but only default privileges are granted. For a private file, you must enter a valid password or the file is not opened. If the file privileges for a file include the ability to update data, the following message is displayed when the file is successfully opened:</p> | |||
<p class="code">*** M204.0620: FILE <i>filename</i> OPENED | <p class="code">*** M204.0620: FILE <i>filename</i> OPENED | ||
</p> | </p> | ||
<p>If the file privileges do not allow update, or if the OPEN occurs while <var class="product">Model 204</var> is running the RESTART to perform recovery, the following is displayed:</p> | <p> | ||
If the file privileges do not allow update, or if the OPEN occurs while <var class="product">Model 204</var> is running the RESTART to perform recovery, the following is displayed:</p> | |||
<p class="code">*** M204.0620: FILE <i>filename</i> OPENED -- NO UPDATES ALLOWED | <p class="code">*** M204.0620: FILE <i>filename</i> OPENED -- NO UPDATES ALLOWED | ||
</p> | </p> | ||
<p>With application subsystems, if you open a file defined as optional to the subsystem, you are granted the privileges assigned in the subsystem definition. Such privilege assignment takes places regardless of the default file privileges assigned the file. A file defined as required to the subsystem is opened implicitly when you enter the subsystem. </p> | <p> | ||
<p>If you have the appropriate user privileges (established by the login), you can change a file password at the time that the file is opened. When <var class="product">Model 204</var> prompts for the password, you can enter the current and desired password, separated by a colon, as shown above. If the old password is invalid, the new password specification is ignored. If the new password is too long, or if you do not have the appropriate privileges, <var class="product">Model 204</var> rejects the password. If both the old and the new file passwords are valid, <var class="product">Model 204</var> displays a message that the password has changed. The new file password has the same file privileges as those associated with the old password. | With application subsystems, if you open a file defined as optional to the subsystem, you are granted the privileges assigned in the subsystem definition. Such privilege assignment takes places regardless of the default file privileges assigned the file. A file defined as required to the subsystem is opened implicitly when you enter the subsystem. </p> | ||
<p> | |||
If you have the appropriate user privileges (established by the login), you can change a file password at the time that the file is opened. When <var class="product">Model 204</var> prompts for the password, you can enter the current and desired password, separated by a colon, as shown above. If the old password is invalid, the new password specification is ignored. If the new password is too long, or if you do not have the appropriate privileges, <var class="product">Model 204</var> rejects the password. If both the old and the new file passwords are valid, <var class="product">Model 204</var> displays a message that the password has changed. The new file password has the same file privileges as those associated with the old password.</p> | |||
====The logic of OPEN command processing==== | ====The logic of OPEN command processing==== | ||
<p>The following psudeo-code | <p> | ||
<p class="code"> OPEN something | The following psudeo-code shows how OPEN processing applies the order of precedence to <var class="product">Model 204</var> entities (file, temporary group, and permanent group) that all have the same name: <code>something</code>.</p> | ||
<p class="code">OPEN something | |||
... | ... | ||
If there is an open temp group named 'something' then | If there is an open temp group named 'something' then | ||
Line 112: | Line 131: | ||
ifend | ifend | ||
</p> | </p> | ||
[[Category: | |||
[[Category: User commands]] | |||
[[Category:Commands]] | [[Category:Commands]] |
Latest revision as of 16:30, 13 April 2017
Summary
- Privileges
- Any user
- Function
Syntax
OPEN [FILE] filename [AT location] [[,defupdt1] [,defupdt2]]
Where:
-
filename is the name of the Model 204 file to be opened.
-
location
-
For Parallel Query Option/204 files, this is the symbolic name (as many as eight characters) that refers to the location of the node on which the remote file resides. An unquoted equal sign (=) specifies that the file is local.
-
If remote, must match a symbolic destination name specified in the DESTINATION parameter of the relevant local client DEFINE PROCESS command.
-
-
defupdt1 is the name of the fixed-length deferred update data set. If this option is specified, deferred updates to KEY and NUMERIC RANGE fields are written to the fixed-length deferred update data set (1 to 8 characters in the form TAPExxxx).
-
defupdt2 is the name of the variable-length deferred update data set. If this option is specified, deferred updates to ORDERED fields are written to the variable-length deferred update data set. All deferred index updates are written to defupdt2 if defupdt1 is not specified. If defupdt2 is not specified, updates to ORDERED fields are not deferred.
Deferred updates are updates to the Model 204 file index that are saved and applied all at the same time.
For user privileges needed to open deferred update data sets through a security interface, see Security interfaces.
For information about opening remote files in deferred update mode, see PQO: Remote files and scattered groups.
Syntax notes
A comma is required if a deferred update name is specified. If the comma is omitted, the name is ignored and no message is generated.
Example
The following command opens the Model 204 file CENSUS
in deferred update mode. Hashed index deferred updates are written to defupdt1, TAPEFIX
, and Ordered Index deferred updates are written to defupdt2, TAPEVAR
:
*** M204.0620: FILE CENSUS OPENED *** M204.1203: CENSUS WAS LAST UPDATED ON 89.003 JAN03 10.24.12 *** M204.0656: UPDATES DEFERRED TO TAPEFIX TAPEVAR
The following command opens the Model 204 file CENSUS
in deferred update mode. All index updates are written to defupdt2, TAPEVAR
:
OPEN FILE CENSUS,,TAPEVAR *** M204.0620: FILE CENSUS OPENED *** M204.1203: CENSUS WAS LAST UPDATED ON 89.041 FEB10 16.34.27 *** M204.0656: UPDATES DEFERRED TO TAPEVAR
The following command opens the Model 204 file CENSUS
in deferred update mode. Hashed index updates are written to TAPEFIX
. Ordered Index updates are not deferred:
OPEN FILE CENSUS,TAPEFIX *** M204.0620: FILE CENSUS OPENED *** M204.1203: CENSUS WAS LAST UPDATED ON 88.335 DEC01 11.52.36 *** M204.0656: UPDATES DEFERRED TO TAPEFIX
Usage notes
A Model 204 file is a collection of records. A file group is a collection of Model 204 files that Model 204 treats logically as a single file. An individual file can be a member of several different groups. Any user can open several files or groups during a single Model 204 session. These remain open until a CLOSE, LOGOUT, or DISCONNECT command is issued or until the user is restarted.
The file or group specified in the most recent OPEN command is considered the default file or group. Thus, a successful OPEN command causes the current default file or group to be replaced. If an OPEN command is rejected, the default is not changed.
If no specific file or group specification is included in the OPEN command, as in:
OPEN CENSUS
Model 204 attempts to determine whether a file or a group is to be opened. Model 204 searches first for a temporary group that has the specified name. If no temporary group is found, Model 204 tries to open a permanent group by using that name. If a permanent group cannot be found, Model 204 searches for a file by that name. Further OPEN processing depends upon what type of file or group is actually being opened.
There are three types of files:
-
Public
-
semi-public
-
Private
If the file is public, Model 204 opens it without asking for a file password. You are given the default file privileges assigned to the file by the file manager.
If the file is semi-public or private, Model 204 asks you to enter a valid password as shown:
***M204.0347: PASSWORD [password [:new-password]]
where password or new-password is a valid password for the file to be opened (1 to 8 characters); it cannot contain spaces, commas, or colons. Each file can have several passwords defined for it. If you enter a valid password, the file is opened with the file privileges associated with that password.
For a semi-public file, if you do not know the password for the file and simply enter a carriage return, the file is opened and you are given the default privileges for the file. An invalid password also causes the file to be opened, but only default privileges are granted. For a private file, you must enter a valid password or the file is not opened. If the file privileges for a file include the ability to update data, the following message is displayed when the file is successfully opened:
*** M204.0620: FILE filename OPENED
If the file privileges do not allow update, or if the OPEN occurs while Model 204 is running the RESTART to perform recovery, the following is displayed:
*** M204.0620: FILE filename OPENED -- NO UPDATES ALLOWED
With application subsystems, if you open a file defined as optional to the subsystem, you are granted the privileges assigned in the subsystem definition. Such privilege assignment takes places regardless of the default file privileges assigned the file. A file defined as required to the subsystem is opened implicitly when you enter the subsystem.
If you have the appropriate user privileges (established by the login), you can change a file password at the time that the file is opened. When Model 204 prompts for the password, you can enter the current and desired password, separated by a colon, as shown above. If the old password is invalid, the new password specification is ignored. If the new password is too long, or if you do not have the appropriate privileges, Model 204 rejects the password. If both the old and the new file passwords are valid, Model 204 displays a message that the password has changed. The new file password has the same file privileges as those associated with the old password.
The logic of OPEN command processing
The following psudeo-code shows how OPEN processing applies the order of precedence to Model 204 entities (file, temporary group, and permanent group) that all have the same name: something
.
OPEN something ... If there is an open temp group named 'something' then re OPEN TEMP GROUP something elseif there is an open perm group named 'something' then re OPEN PERM GROUP something elseif there is a defined temp group named 'something' then OPEN TEMP GROUP something elsif there is a defined perm group named 'something' then OPEN PERM GROUP something else try to re OPEN or OPEN file something ifend