Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 3 Tools : CURSOROCC#

CURSOROCC#
Returns the occurrence number within the screen table where the cursor is positioned. (F)
Invocation
occ_num = CURSOROCC#(screen)
 
A character string and specifies the name of the screen. Its syntax is C (fixed-length character string), with length 16.
Usage Notes
If the screen table is populated with occurrences and the cursor is positioned on a title row, CURSOROCC# returns an occurrence number of 1. If the screen table is not populated with occurrences and the cursor is positioned on a title row, CURSOROCC# returns an occurrence number of 0.
Example
The following rule fills the example screen with data from the example table, displays it, determines the number of the occurrence within the table where the cursor is positioned, and prints it to the message log:

 
CURSOROCC#_1;
_ LOCAL OCCURRENCE_NUM;
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ FORALL EMPLOYEE : | 1
_ EMPLOYEE_DATA.* = EMPLOYEE.*; |
_ INSERT EMPLOYEE_DATA('EMPLOYEE_SCR'); |
_ END; |
_ FCNKEY_SPECS.FCNKEYS = FCNKEY_MSG('EMPLOYEE_SCR'); | 2
_ INSERT FCNKEY_SPECS('EMPLOYEE_SCR'); | 3
_ UNTIL EXIT_DISPLAY DISPLAY EMPLOYEE_SCR: | 4
_ CALL PROCESS_FCNKEY('EMPLOYEE_SCR'); |
_ END; |
_ OCCURRENCE_NUM = CURSOROCC#('EMPLOYEE_SCR'); | 5
_ CALL MSGLOG( | 6
_ 'THE CURSOR IS POSITIONED ON OCCURRENCE NUMBER ' || |
_ OCCURRENCE_NUM); |
_ ------------------------------------------------------------------------

 
Sample Output
Executing this rule displays the following output:

 
Employee Name Employee#
------------- ---------
SMYTHE 80000
ROTERDAM 80002
CHANG 80003
GARZA 80004
TOWNSEND 80014
PASTARINA 80019
CHESSEL 80020
TOWENSEND 80021
NAPIER 80024
CANON 80033

 
The cursor position is indicated by a bold letter.
Message Log
After the rule ends, press PF2 to display the following output:

 
----------------------- INFORMATIONAL MESSAGE LOG --------------------
COMMAND ===> SCROLL ===> P
THE CURSOR IS POSITIONED ON OCCURRENCE NUMBER 1

 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved