ALTER [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation
QUERY/V Reference Manual
ALTER
Inserts, replaces, and deletes lines of a procedure stored in the current
Proc-file.
Syntax
A[LTER] procedure name
For example:
>ALTER REP22
Where procedure name = REP22
Parameter
procedure name is the name of a procedure stored in the current
Proc-file.
Discussion
When you enter the ALTER command, QUERY prompts you for insert, replace,
and delete statements by printing >>. Each statement operates on a line
or range of lines in the procedure. In the statement descriptions that
follow, m is the first line number in the range, and n is the last line
number. n must always be greater than or equal to m, and m must be
greater than or equal to 1. Neither m nor n can exceed the total number
of lines in the procedure.
Once you enter the ALTER command, you must do your editing sequentially
from lower numbered lines to higher numbered lines. You cannot go back
to a line which precedes the ones you are currently editing without
exiting the ALTER command and entering another ALTER command. This
technique is illustrated in the examples which follow.
If an error occurs after a statement is entered, an error message is
printed and QUERY prompts you for another ALTER statement.
You can abort the command at any time by entering CONTROL Y. If you do
this, the procedure will remain unchanged. Always terminate the command
with /E if you want to save the results of your changes.
You can use one of four statements in response to an ALTER prompt:
Insert, Replace, Delete, and End.
Lines which are added or changed are not checked for correct syntax until
the procedure is executed. Similarly, if line deletion causes a command
to have incorrect syntax, it not will be detected until the procedure is
executed.
INSERT STATEMENT
Inserts lines into the procedure. QUERY prompts for each statement and
line with >>.
Syntax
>>/I, m
>>line
>>line
.
.
Parameters
m is the number of the procedure line after which
you want to insert statements.
line is the new line you want to insert.
Discussion
The lines which follow the insert statement are inserted into the
procedure following line number m. You cannot insert lines in front of
the first procedure line. To indicate you do not want to insert mores
lines, enter a slash followed by another ALTER statement.
Example
>ALTER FIND1
>>/I,1
>>STOCK# IS "" AND
>>LASTSHIPDATE IS ""
>>/E
The example above changes the procedure FIND1 from:
001 FIND
002 END
To:
001 FIND
002 STOCK# IS "" AND
003 LASTSHIPDATE IS ""
004 END
REPLACE STATEMENT
Deletes the specified line or range of lines and replaces them with the
lines following the replace statement. QUERY prompts for each statement
and line with >>.
Syntax
>>/R,m[,n]
(current lines m through n are listed)
>>replacement line
>>replacement line
.
.
Parameters
m is the number of the first procedure line you want
to replace.
n is the number of the last procedure line you want
to replace. If n is not specified, only line m is
replaced.
replacement line is the new line which will replace the existing
line.
Example
>ALTER UPDATE1
>>/R,2,3
HOURS="";
DATE="851022";
>>HOURS="14";
>>DATE="851101";
>>STATUS="OK";
The example above changes the procedure UPDATE1 from:
001 UPDATE REPLACE,
002 HOURS="";
003 DATE="851022";
004 END
To:
001 UPDATE REPLACE,
002 HOURS="14";
003 DATE="851101";
004 STATUS="OK";
005 END
DELETE STATEMENT
Deletes the specified line or range of lines. QUERY prompts for each
statement with >>.
Syntax
>>/D,m [,n]
(deleted lines are listed)
Parameters
m is the first line you want to delete.
n is the last line you want to delete. If n is not
specified, only line m is deleted. If line n is
specified, the range of lines from m to n is
deleted.
Discussion
If you try to delete all the lines in the procedure, an error message is
printed. To delete the entire procedure, use the DESTROY command.
Example
>ALTER REPORT4
>>/D,4,5
S2,ORDERDATE
S,LASTSHIPDATE
>>/E"
The example above changes the procedure named REPORT4 from:"
001 REPORT
002 H1,"MONTHLY SHIPMENTS",25,SPACE A2
003 S1,STOCK#
004 S2,ORDERDATE
005 S,LASTSHIPDATE
006 G1,STOCK#,15
007 END
To:
001 REPORT
002 H1,"MONTHLY SHIPMENTS",25,SPACE A2
003 S1,STOCK#
004 G1,STOCK#,15
005 END
END STATEMENT
Terminates the ALTER command and saves the procedure.
Syntax
>>/E
Discussion
QUERY continues to prompt you for insert, delete, or replace statements
until you enter /E. If the ALTER command is terminated using CONTROL Y,
the entire command is ignored and the procedure remains in its original
state. To save your changes, you must terminate the ALTER command with
/E.
Example
>DISPLAY REPORT2
PROCEDURE: REPORT2
001 REPORT
002 H1,"AS OF:",6
003 H1,DATE,15
004 H2,"BOBO'S MERCANTILE",45
005 H1,"PAGE",69
006 H1,PAGENO,71
007 D1,STOCK#,36
008 D1,LASTSHIPDATE,48,E2
009 E2,"XX/XX/XX"
010 END
The following is an example of using the ALTER command with all four
statements. The DISPLAY command can be used to examine the procedure and
the results of the ALTER command.
>ALTER REPORT2
>>/R,2,3
H1,"AS OF:",6
H1,DATE,15
>>H1,"TO DATE:",6
>>H1,DATE,20
>>/D,5,6
H1,"PAGE",69
H1,PAGENO,71
>>I/,9
>>S,LASTSHIPDATE
>>/E
>
>DISPLAY REPORT2
PROCEDURE: REPORT2
001 REPORT
002 H1,"TO DATE:",6
003 H1,DATE,20
004 H2,"BOBO'S MERCANTILE",45
005 D1,STOCK#,36
006 D1,LASTSHIPDATE,48,E2
007 E2,"XX/XX/XX"
008 S,LASTSHIPDATE
009 END
MPE/iX 5.0 Documentation