CREATE [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation
QUERY/V Reference Manual
CREATE
Stores a command as a named procedure in the current Proc-file.
Syntax
{filename }
C[REATE] procedure name,{command END}
For example:
>CREATE FIND6,FINDFILE
>CREATE FINDNAME,FIND LAST-NAME IS "" END
Parameters
procedure name is a name composed of 1 to 8 alphanumeric
characters chosen by you. The first character
must be alphabetic. No special characters or
spaces are allowed. The procedure name cannot be
any of the following: ALL, D, DELETE, Dn, En,
END, EZ, Gn, Hn, LIST, LP, NOPAGE, PAUSE, Rn, S,
Sn, SPACE, TF, or Tn, where n is an integer from 0
to 9. (QUERY only recognizes these as options or
report statements, not as procedure names.)
file name is the name of an MPE ASCII file containing one of
the commands listed in Table 2-2. The command
will be stored as a procedure in the current
Proc-file. The file name cannot be FIND, REPORT,
UPDATE, or any legal abbreviation of these
commands. (QUERY cannot distinguish these names
from the command parameter.) FINDX and other
supersets are acceptable.
command is one of the commands listed in Table 2-2. Refer
to the command in this section for the syntax of
the command.
Discussion
You can create a procedure in two ways:
* from input stored in an MPE ASCII file
* from input entered through the session or job input device
If the procedure you are creating does not fit in the available Proc-file
space, an error message is printed. The incomplete procedure is stored,
and you can list it with the DISPLAY command.
File Input
If you create the procedure from a file, QUERY reads the named file when
the command is entered. QUERY then lists the file on the standard list
device and stores it as a procedure in the current Proc-file. When the
input is copied from the MPE ASCII file to the Proc-file, the procedure
is not checked for correct syntax. The command syntax is not checked
until the procedure is executed.
QUERY does not process the last eight characters of each record in an MPE
ASCII file. If you create the file using EDIT/3000 and keep it with
numbered lines, the last eight characters are the line numbers. Even if
you keep the file unnumbered, QUERY commands or parameters should not be
entered in this part of a record.
Example
:EDITOR
HP32201A.7.17 EDIT/3000 MON, MAR 23, 1987 2:51 PM
(C) HEWLETT-PACKARD CO. 1983
/ADD
1 FIND
2 CUSTOMER.ACCOUNT IS ""
3 END
4 //
/KEEP FINDFILE
/EXIT
END OF SUBSYSTEM
:RUN QUERY.PUB.SYS
HP32216C.00.08 QUERY/3000 MON, MAR 23, 1987 2:51 PM
COPYRIGHT HEWLETT-PACKARD CO. 1976
>DATA-BASE=ORDERS
PASSWORD = >>CLERK
MODE = >>1
>PROC-FILE=PROC2
>CREATE FINDACCT,FINDFILE
FIND
CUSTOMER.ACCOUNT IS ""
END
>
In the previous example, an MPE file is created with EDIT/3000. After
running QUERY, the data base is opened with the DATA-BASE= command and
the Proc-file is declared. When the CREATE command is issued, FINDACCT
is created and listed on the screen.
Terminal Input
If you enter a procedure through a terminal (in session mode) or through
a standard input device (in job mode), the command can be entered on one
line or on as many lines as necessary without the use of the continuation
character (&). Whenever you press RETURN, QUERY prompts for additional
lines by printing >>. To terminate the command, enter a pair of slashes
(//) or END as the last three characters in a line. All the characters
you enter are stored in the current Proc-file without checking for
correct syntax. The command is not checked for correct syntax until the
procedure is executed.
QUERY allows a maximum input record of 250 characters. If you use the
continuation character (&), QUERY considers all the lines connected with
it as one input record.
Examples
>CREATE FINDNAME, FIND LAST-NAME IS "","","" END
>FIND FINDNAME
WHAT IS THE VALUE OF - LAST-NAME
>>MURTZ
WHAT IS THE VALUE OF - LAST-NAME
>>FRANZONI
WHAT IS THE VALUE OF - LAST-NAME
>>X
USING SERIAL READ
2 ENTRIES QUALIFIED
The previous example illustrates the result of creating a procedure with
null values. When the procedure is executed, QUERY prompts for three
LAST-NAME values. A value must be supplied for each null value.
However, you can use a known invalid response if you do not want a third
name. Refer to the FIND command for more information on using null
values.
>CREATE CHECK,FIND CREDIT-RATING ILT 5 END
>FIND CHECK
USING SERIAL READ
2 ENTRIES QUALIFIED
>CREATE NAMES,
>>REPORT
>>D,LAST-NAME,20
>>//
>REPORT NAMES
>>PAUSE;
>>END
MCFALL
CELERY
The previous example shows two procedures. The second procedure, NAMES,
operates on the results of the first procedure, CHECK. The procedure
named CHECK is useful each time you want to find the names of customers
with low credit ratings. The NAMES report procedure can also be used
repeatedly to list names from the retrieved entries. As shown in the
second procedure, it can be useful to leave the END keyword out of a
REPORT procedure. When the procedure is executed, QUERY prompts for the
missing END. You can then enter additional report statements such as sort
or output control statements to vary the report output.
MPE/iX 5.0 Documentation