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


Chapter 3 Tools : SETCURSOR_POS

SETCURSOR_POS
Positions the cursor in the column of the field of the occurrence, in the screen table of the screen. (C)
Invocation
CALL SETCURSOR_POS(screen, table, field, occurrence_number, column_offset)
 
The name of the screen. Its syntax is C (fixed-length character string) with length 16.
An integer specifying the occurrence within the screen table. Its syntax is B (binary) with length 2.
An integer specifying the relative column number. Its syntax is B (binary) with length 2. The first column is column 1.
Usage Notes
When you supply values for screen, table, and field, the cursor is positioned on the field in the table at the specified occurrence and column offset. If the values do not exist, an error occurs.
The set of occurrences used by SETCURSOR_POS is the set of real and empty occurrences. For example, if occurrence_number is set to 5 and there are three real occurrences and two empty occurrences displayed, the cursor is positioned on the second empty occurrence.
As occurrences are inserted into the screen table, the number of empty occurrences is decreased by the number of occurrences inserted. The number of empty occurrences is reset to the value on the screen definition each time the screen appears. For example, if a screen definition has EMPTY OCCS set to 5 and three occurrences are inserted into the screen table, the number of empty occurrences equals 2.
If the screen appears again, the number of empty occurrences is reset to 5. Therefore, if SETCURSOR_POS is called prior to the display, the maximum valid value for occurrence_number is 5 (three real occurrences plus two empty occurrences). After the display, the maximum valid value for occurrence_number is 8 (three real occurrences plus five empty occurrences).
If you do not specify table or field, the call to SETCURSOR_POS is ignored.
If occurrence_number or column_offset are invalid, the call to SETCURSOR_POS is ignored.
Example
The following rule fills the example screen with data from the example table, positions the cursor in column 1 in the first occurrence of the LNAME field, and displays the screen. The cursor is positioned on the first S in Smythe.

 
SETCURSOR_POS_1;
_
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ FORALL EMPLOYEE : | 1
_ EMPLOYEE_DATA.* = EMPLOYEE.*; |
_ INSERT EMPLOYEE_DATA('EMPLOYEE_SCR'); |
_ END; |
_ CALL SETCURSOR_POS('EMPLOYEE_SCR', 'EMPLOYEE_DATA', | 2
_ 'LNAME', 1, 1); |
_ DISPLAY EMPLOYEE_SCR; | 3
_ ------------------------------------------------------------------------

 
Resulting Output
Executing this rule displays the following screen:

 
Employee Name Employee#
------------- ---------
SMYTHE 80000
ROTERDAM 80002
CHANG 80003
GARZA 80004
TOWNSEND 80014
PASTARINA 80019

 

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