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


Chapter 8 Using Expressions and Operators : Using Table.Field for Indirect Referencing

Using Table.Field for Indirect Referencing
Examples of Table.Field
The following series of figures show:
1.
2.
The table.field form of indirect reference
The example in Reference to a Parameterized Table generalizes this rule for use with parameterized tables.
3.
About the Examples
In the following examples:
1.
2.
The occurrence for that PF key in the table instance FCNKEYS(DELETE_EMPLOYEE) is then retrieved.
3.
Looking at the FCNKEYS(DELETE_EMPLOYEE) table instance, if you press PF22 the DEL_EMP rule is invoked.
Calling a Rule that Uses Indirect Reference
The rule shown in the following figure initializes the function keys for the screen DELETE_EMPLOYEE, displays the screen, and calls the PROCESS_FCNKEY rule, which has screen as its argument.

 
RULE EDITOR ===> SCROLL: P
DELETE_EMPLOYEE;
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ FCNKEY_SPECS.FCNKEYS = FCNKEY_MSG('DELETE_EMPLOYEE'); | 1
_ INSERT FCNKEY_SPECS('DELETE_EMPLOYEE'); | 2
_ UNTIL EXIT_DISPLAY DISPLAY DELETE_EMPLOYEE : | 3
_ CALL PROCESS_FCNKEY('DELETE_EMPLOYEE'); |
_ END; |
_ ---------------------------------------------------------------------------
PFKEYS: 1=HELP 3=END 12=CANCEL 13=PRINT 14=EXPAND 2=DOCUMENT 22=DELETE

 
Table.Field Form of Indirect Reference
The PROCESS_FCNKEY tool is called to get the FCNKEYS table, which is parameterized by screen, and then uses the table.field indirect reference in the statement:CALL FCNKEYS.ROUTINE.

 
RULE EDITOR ===> SCROLL: P
PROCESS_FCNKEY(SCREEN);
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ GET FCNKEYS(SCREEN) WHERE PF_KEY = ENTERKEY(SCREEN); | 1
_ CALL FCNKEYS.ROUTINE; | 2
_ ---------------------------------------------------------------------------
_ ON GETFAIL FCNKEYS :
_ CALL SCREENMSG(SCREEN, MESSAGE('GENERAL', 3, ENTERKEY(SCREEN)));
PFKEYS: 1=HELP 3=END 12=CANCEL 13=PRINT 14=EXPAND 2=DOCUMENT 22=DELETE

 
Example of a Table Instance Used for Indirect Referencing
The ROUTINE field in this table, FCNKEYS, contains the name of the rule to be invoked when a PF key is used.

 
BROWSING TABLE : FCNKEYS(DELETE_EMPLOYEE)
COMMAND ==>
SCROLL: P
PF_KEY NAME COMMAND ROUTINE
_ ----- ---------------- ---------------- ----------------
_ PF1 HELP DISPLAY_HELP
_ PF22 DELETE DEL_EMP
_ PF3 EXIT EXIT_DISPLAY
 
 
 
 
 
 
 
 
 
 
 
 
 
PFKEYS: 1=HELP 5=FIND NEXT 9=RECALL 18=EXCLUDE 13=PRINT 3=END 14=EXPAND

 
Reference to a Parameterized Table
To generalize the sample rule shown in Example of an Argument to a Rule to handle tables that have up to two parameters, or none at all, you can expand the rule as shown in the following figure:

 
RULE EDITOR ===> SCROLL: P
COUNT1(TABLEREF, FIELDREF, PARM1, PARM2);
_ LOCAL SUM;
_ ---------------------------------------------------------------------------
_ PARM1 = NULL; | Y N N
_ PARM2 = NULL; | Y N
_ ------------------------------------------------------------+--------------
_ FORALL TABLEREF : | 1
_ SUM = SUM +(TABLEREF).(FIELDREF); |
_ END; |
_ FORALL TABLEREF(PARM1) : | 1
_ SUM = SUM +(TABLEREF).(FIELDREF); |
_ END; |
_ FORALL TABLEREF(PARM1, PARM2) : | 1
_ SUM = SUM +(TABLEREF).(FIELDREF); |
_ END; |
_ CALL MSGLOG('THE SUM OF ' || TABLEREF ||'.' || FIELDREF || | 2 2 2
_ ' IS ' || SUM); |
_ ---------------------------------------------------------------------------
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