Using the STATUS Option [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
Using the STATUS Option
You can disable several aspects of Transact's automatic processing by
using the STATUS option. Using the STATUS option causes the status
register to be set differently then when the STATUS option is not used.
You can then test the contents of the status register (by using an IF
statement) before deciding what further processing should be done. The
STATUS option has a different effect depending on whether the statement
in which it appears performs data entry or accesses a database or file.
You can assign a value to the status register with a LET statement.
Thus, you can reset status to zero with the following statement:
LET STATUS = 0;
Data Entry Errors
Under automatic error handling, the status register contains the number
of characters entered in response to the data entry verbs DATA, INPUT,
and PROMPT.
When the user enters "]" or "]]" and the verb does not have a STATUS
option, an escape to the next processing level is generated as discussed
in the "Data Entry Control Characters" section in Chapter 5, "User
Interface." The STATUS option suppresses the escape and allows you to
test the contents of the register before continuing processing.
Table 7-2 shows the contents of the status register when a data entry
verb is used with and without the STATUS option.
Table 7-2. Contents of Status Register After Data Entry Verbs
------------------------------------------------
| |
| User Entry Status Status |
| Register Register |
| with no with the |
| STATUS Option STATUS Option |
| |
------------------------------------------------
| |
| <CR> 0 0 |
| |
| ABC 3 3 |
| |
| blanks -3 -3 |
| |
| timeout -4 -4 |
| |
| ] escape -1 |
| |
| ]] escape -2 |
| |
------------------------------------------------
When the STATUS option is used with the CHECK or CHECKNOT option and the
user enters a blank, a carriage return, "]", or "]]", neither CHECK nor
CHECKNOT will be performed.
Transact validates data for data entry verbs whether or not the STATUS
option is used.
Database or File Operation Errors
Specifying the STATUS option with database and file operation verbs
suppresses the automatic error handling described above. Instead, you
must determine further processing according to the contents of the status
register. When STATUS is specified, the effect of the operation is
described by the value in the status register:
Status Meaning
Register
Value
0 The operation was successful.
-1 A KSAM or MPE end-of-file
condition for serial read or
end-of-chain for chain read has
occurred.
>0 For a description of the
condition that occurred, refer
to the database condition word
or KSAM file system error
documentation corresponding to
the value.
1 If NOFIND option or the GET verb
is used and the record is found.
In addition, STATUS has the following effects:
* It causes accesses and deletions that are normally multiple
(iterative) to be single. This affects the iterative verbs:
DELETE, FIND, OUTPUT, and REPLACE.
* It suppresses the location of the chain head when DELETE, FIND,
GET, OUTPUT, or REPLACE is used with the CHAIN modifier. Before
using these verbs with the CHAIN modifier, you must locate the
chain head with the PATH verb.
* It suppresses the normal rewind performed on a data set or file
when DELETE, FIND, GET, OUTPUT, or REPLACE is used with a SERIAL
modifier. You should force a rewind by closing the file or data
set before using any of these verbs with the SERIAL modifier.
Table 7-3 summarizes the effect of STATUS with database and file
operation verbs.
Table 7-3. STATUS Option with Database and File Operation Verbs
---------------------------------------------------------------
| |
| Verb No Automatic No CLOSE or Multiple |
| Error Handling FIND Before the Action |
| or Recovery Operation Suppressed |
| (CHAIN and SERIAL |
| Modifiers) |
| |
---------------------------------------------------------------
| |
| CLOSE X |
| |
| DELETE X X X |
| |
| FIND X X X |
| |
| GET X X |
| |
| OUTPUT X X X |
| |
| PATH X |
| |
| PUT X |
| |
| REPLACE X X X |
| |
| UPDATE X |
| |
---------------------------------------------------------------
Table 7-4 shows the contents of the status register when a data
management verb is used without the STATUS option.
Table 7-4. Contents of Status Register Following Operations of Data Management Verbs
when STATUS Option Is NOT USED
--------------------------------------------------------------------------------------
| | |
| Verb | Status Register Value |
| | |
--------------------------------------------------------------------------------------
| | | |
| | Operation Successful | Operation Not Successful |
| | | |
| | Number of entries or | 0 = No entries or records |
| DELETE | records selected (not | found* |
| FIND | necessarily number | |
| OUTPUT | retrieved) | -1 = No master entry |
| REPLACE | | (FIND(CHAIN) and |
| | | FIND(RCHAIN) only*) |
| | | |
| | | Otherwise undefined |
| | | |
--------------------------------------------------------------------------------------
| | | |
| | 0 = One entry or record | -1 = Entry not found |
| GET | found | |
| PUT | | Otherwise undefined |
| UPDATE | | |
| | | |
--------------------------------------------------------------------------------------
| | | |
| | Number of bytes read | -1 = End of file |
| FILE(READ) | | |
| | Otherwise undefined | |
| | | |
--------------------------------------------------------------------------------------
| | | |
| | Number of records in | 0 = No detail set chain* |
| PATH | detail data set chain | |
| | | -1 = No master entry |
| | | |
| | | Otherwise undefined |
| | | |
--------------------------------------------------------------------------------------
| | | |
| | 0 = Successful operation | Undefined |
| FILE(CLOSE) | | |
| FILE(CONTROL) | | |
| FILE(SORT) | | |
| FILE(UPDATE) | | |
| FILE(WRITE) | | |
| | | |
--------------------------------------------------------------------------------------
* Entry not found does not always activate the ERROR= option; see
Table 7-1.
For additional information about the STATUS option with these verbs, see
Chapter 8, "Transact Verbs."
MPE/iX 5.0 Documentation