Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 15 Editing Rules : Using Available Line Commands

Using Available Line Commands
Copying Lines
The C line command copies a line. Type C in the line command field of the line to be copied and use <Enter>. The line is copied after the line where the cursor is located. You can also copy several lines at once by typing C in the line command fields of several lines. All the lines are copied to the destination, in the order in which they already appear. The action sequence numbers are supplied for you.
You can specify a destination with one of the destination indicators A (after) or B (before). Type A or B in the line command field of the line to be used as the reference point. Press Enter to copy the line to the specified destination. In the following screen, the two JOBTITLE lines are explicitly copied after the line JOBTITLE = 'ANALYST'.

 
RULE EDITOR ===> SCROLL: P
EMPLOYEES_RAISE(JOBTITTLE, REGION);
_ LOCAL RAISE, RATE;
_ ---------------------------------------------------------------------------
c JOBTITLE = 'SENIOR ANALYST'; | Y N N
c JOBTITLE = 'ANALYST'; | Y N
b ------------------------------------------------------------+---------------
_ RATE = 0.1; | 1
_ RATE = 0.05; | 1
- RATE = 0.02; | 1
_ GET EMPLOYEES(REGION) WHERE POSITION = JOBTITLE; | 2
_ FORALL EMPLOYEES(REGION) WHERE POSITION = JOBTITLE: | 2 2 3
_ RAISE = EMPLOYEES.SALARY * RATE; |
_ EMPLOYEES.SALARY = EMPLOYEES.SALARY + RAISE; |
_ CALL REPLACE_SALARY(REGION); |
_ CALL MSGLOG(EMPLOYEES.LNAME || ' NOW EARNS ' || |
_ EMPLOYEES.SALARY); |
_ END; |
_ ----------------------------------------------------------------------------
ON GETFAIL:
CALL ENDMSG('POSITION IS INVALID');
PFKEYS: 1=HELP 3=END 12=CANCEL 13=PRINT 14=EXPAND 2=DOCUMENT 22=DELETE

 
Deleting Lines
The D line command deletes lines. Type D in the line command field of the line and press Enter to delete the line. If the line is an action containing an action sequence number, the Rule Editor re-sequences the remaining actions.
Using PF16 has the same effect as the D line command; pressing PF16 while the cursor is positioned anywhere on the line deletes the line.
Inserting Lines
The I line command inserts an empty line. Type I in the line command field of a line and press Enter. This creates a new, empty line below the selected line and places the cursor in column one of the new line. You must type something in the empty line or it disappears when you press Enter.
Using PF4 has the same effect as the I line command. Pressing PF4 while the cursor is positioned anywhere on the line creates a blank line below the selected one.
If you are inserting lines in the action part of a rule and your rule has conditions, you must type in the action sequence numbers for the new lines or type in any character except a blank. If the rule does not have conditions, the action sequence numbers are supplied for you.
Moving Lines
The M line command moves a line. Type an M in the line command field of the line to be moved and move the cursor to the destination, then press Enter. The line is moved after the line where the cursor is located. You can also move several lines at once by typing M in the command fields of several lines. All the lines are moved to the destination, in the order in which they already appear. The Rule Editor re-sequences the action sequence numbers of all the lines.
You can also specify a destination with one of the destination indicators, A (after) or B (before). Type A or B in the line command field of the line to be used as the reference point. Press Enter to move the line to the destination indicated. In the following screen, the lines RATE = 0.05 and RATE = 0.02 are placed before RATE = 0.1.

 
RULE EDITOR ===> SCROLL: P
EMPLOYEES_RAISE(JOBTITTLE, REGION);
_ LOCAL RAISE, RATE;
_ ---------------------------------------------------------------------------
_ JOBTITLE = 'SENIOR ANALYST'; | Y N N
_ JOBTITLE = 'ANALYST'; | Y N
_ ------------------------------------------------------------+---------------
b RATE = 0.1; | 1
m RATE = 0.05; | 1
m RATE = 0.02; | 1
_ GET EMPLOYEES(REGION) WHERE POSITION = JOBTITLE; | 2
_ FORALL EMPLOYEES(REGION) WHERE POSITION = JOBTITLE: | 2 2 3
_ RAISE = EMPLOYEES.SALARY * RATE; |
_ EMPLOYEES.SALARY = EMPLOYEES.SALARY + RAISE; |
_ CALL REPLACE_SALARY(REGION); |
_ CALL MSGLOG(EMPLOYEES.LNAME || ' NOW EARNS ' || |
_ EMPLOYEES.SALARY); |
_ END; |
_ ----------------------------------------------------------------------------
ON GETFAIL:
CALL ENDMSG('POSITION IS INVALID');
PFKEYS: 1=HELP 3=END 12=CANCEL 13=PRINT 14=EXPAND 2=DOCUMENT 22=DELETE

 
Replicating Lines
The R line command replicates a line. You can use this replica as a template for a similar line. Typing R in the line command field and pressing Enter replicates the selected line below itself. The cursor is placed in column one of the new line so that you can modify it. If you are replicating lines in the action part of a rule, the action sequence numbers are supplied for you.
Splitting Lines
The S line command splits a line into two parts. Use this, for example, if a line of code is too long to fit on one line. To split a line, first type S in the line command field and then move the cursor to the place where you want the line to be split. When you press Enter, the Rule Editor creates a new line immediately below the current line and places everything to the right of the cursor position on the new line.
The split command is token-sensitive. When a line is split, the Rule Editor places the token where the cursor is at the start of the new line. Refer to Tokens for the description of a token. If the cursor is between tokens, the split occurs there. If the cursor is not on the same line as the S command, the S is treated as an I (insert) command.
Combining Line Commands
You can enter several different kinds of line commands at once. These commands are processed in order from top to bottom. In the following screen, the line beginning with:
JOBTITLE ='ANALYST' is replicated
RATE = 0.1 is moved after RATE = 0.02
CALL MSGLOG is copied before CALL REPLACE_SALARY

 
RULE EDITOR ===> SCROLL: P
EMPLOYEES_RAISE(JOBTITTLE, REGION);
_ LOCAL RAISE, RATE;
_ ---------------------------------------------------------------------------
_ JOBTITLE = 'SENIOR ANALYST'; | Y N N
r JOBTITLE = 'ANALYST'; | Y N
_ ------------------------------------------------------------+---------------
m RATE = 0.1; | 1
_ RATE = 0.05; | 1
a RATE = 0.02; | 1
_ GET EMPLOYEES(REGION) WHERE POSITION = JOBTITLE; | 2
_ FORALL EMPLOYEES(REGION) WHERE POSITION = JOBTITLE: | 2 2 3
_ RAISE = EMPLOYEES.SALARY * RATE; |
_ EMPLOYEES.SALARY = EMPLOYEES.SALARY + RAISE; |
b CALL REPLACE_SALARY(REGION); |
c CALL MSGLOG(EMPLOYEES.LNAME || ' NOW EARNS ' || |
_ EMPLOYEES.SALARY); |
_ END; |
_ ----------------------------------------------------------------------------
ON GETFAIL:
CALL ENDMSG('POSITION IS INVALID');
PFKEYS: 1=HELP 3=END 12=CANCEL 13=PRINT 14=EXPAND 2=DOCUMENT 22=DELETE

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved