VALIDATE Command [ HP ALLBASE/4GL Developer Reference Manual Vol. 2 ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Reference Manual Vol. 2
VALIDATE Command
The VALIDATE command checks for the presence or absence of a field on an
indexed (KSAM) file and optionally displays a message. The VALIDATE
command cannot be used with HP ALLBASE/SQL tables, select lists, HP
TurboIMAGE/iX data sets, or serial files.
Formats
VALIDATE file_field_ref[*INDEX=index_name]
*KEY=key {*PRESENT} [message_ref][;command]
{*ABSENT }
Window
Parameters
file_field_ref
The field that you want to check as present or absent within the file.
You must express the field in the format:
F-field_name.file_name[.record_name]
That is, you must use a valid file record field reference.
index_name
This parameter allows you to specify the name or number of the index to
be used to access the file. If you do specify an index name or number,
you must precede it with *INDEX=. The index name must be the name of a
field specification defined as a key field on the default record layout
for the file. The index number must be a valid index for the file.
If you don't specify an index name, HP ALLBASE/4GL accesses the file
according to the index specified by the current value of *INDEXNO.
key
The key data used to access the file file_name[.record_name] to check for
the presence or absence of the field. It can be one of the following:
* Literal.
* Alphanumeric constant.
* Variable or calculated item.
* Screen field reference.
* Scratch-pad field reference.
* File record field reference.
* Work area field reference.
* Non-numeric communication area field.
message_ref
A message to be displayed if the validation fails.
command
A command to be executed if the validation fails. You must precede the
command name with a semicolon. The command can be any one of the
following logic commands:
* ENTER
* EXIT
* EXTERNAL
* MESSAGE
* PROCEED
* SERIES
* TOP
* VISIT
* ZIP
Description
The VALIDATE command checks for the absence or presence of a specified
field on a file record.
The absence or presence of a field depends on its type as follows:
Field type Absent if Present if
Numeric Zero Not zero
Not numeric Blank Not blank
A check for absence is also satisfied if the file record specified by key
cannot be located. In this situation, HP ALLBASE/4GL clears the file
record buffer.
HP ALLBASE/4GL performs the file read using the key field specified by
the current value of *INDEXNO or the *INDEX= argument. If the index
allows duplicate key values, only the first occurrence is used.
If the VALIDATE command does not fail, (that is, the field is found to be
absent or present as required) HP ALLBASE/4GL executes the next command
in the logic block.
If the validation check (present or absent) fails, and the file record is
located, the file record buffer contains the record read from the file.
When the validation check fails, HP ALLBASE/4GL displays any message and
executes the optional command.
Example
VALIDATE F-deleted.stock *KEY=* *ABSENT item_deleted; TOP
This command reads the file stock using the contents of the current
screen field as the key for the read. If HP ALLBASE/4GL locates the
record, it checks the contents of the field deleted. If the field is
blank, HP ALLBASE/4GL executes the next command step. If the field is
not blank, HP ALLBASE/4GL displays the message item_deleted and resumes
processing from the first step in the logic block.
MPE/iX 5.0 Documentation