How can we set and Determine a Cursor Position within an CA UFO Application?

Document ID:  TEC403490
Last Modified Date:  07/11/2017
{{active ? 'Hide' : 'Show'}} Technical Document Details


  • CA UFO


  • CA UFO:Release:3.2



How can we set and Determine a Cursor Position within an CA UFO Application?


Setting the Initial Cursor

The CURSOR field tells CA UFO where the initial cursor should be placed on the application screen, which is described by the Display Definition (DD). The field specified on the CURSOR field must correspond to one of the fields in the DD.

If you do not code an explicit field name, the initial cursor position will be the first unprotected screen field.

Below is a sample display of a DD that specifies positioning of the cursor at a field called "ACBKEY":

DISPLAY.. UFOACB   STATUS.   VML..   3.20               DATE CHANGED 04/16/97  
CURSOR... ACBKEY                                        TERMINAL.... X001      
PROCEDURE UFOONEOF DDXNAME                              OPERATOR....           
   ROW COL FOR- **NAME** ********* DESCRIPTION ********* US- F R ATT EDIT T    
           MAT                                           AGE # # F D CD F F    
01   1   1  F   /MSG                                         0 0 0 8 00        
02   3   1      /ACB                                         0 0   8 00   16   
03                       REVIEW/UPDATE/CREATE ACB'S          0 0 0 8 00    8   
04              /FID     FUNCTION->                          0 0   8 00        
05              ACBKEYG                                   N  0 0 0 8 00        
06   6   1      ACBKEY   ACB name....:                       0 0   8 00   14   
07              ACBSTAT  Status.:                            0 0   8 00    5   
08              ACBLCHGD Date changed...                     0 0 0 8 00        

Setting Cursor within a CA UFO Application Procedure (PDS)

Advantage CA UFO provides methods for setting the cursor within a CA UFO application procedure (PDS). One method is via the /CURSOR keyword. You may use the /CURSOR keyword in your application procedure to dynamically override a cursor location that has been previously specified in the DD. To indicate a new cursor location, move the name of the field to /CURSOR.

Below are examples of MOVE statements that accomplish the same result. You can code the name as a character literal or the actual name of the field:


After execution of either MOVE statement, the cursor will be positioned at the beginning of the field called "ACBSTAT" the next time the screen is displayed. The name placed in the /CURSOR keyword must be the name of a field defined in the DD, whether it is a data field or a work field. If the field is not defined in the DD, the cursor will be positioned at the first unprotected field on the screen. If there are no unprotected fields, the cursor will be positioned at row 1 column 1.

The second method of positioning the cursor is by using the /CURSORP keyword within a PDS. The /CURSORP keyword will dynamically override the cursor position with the value that you specify. This method takes some calculation on your part. You must first know the dimensions of the terminal model that you are using prior to setting the value. The MOVE statement is coded like this:

     MOVE     position     TO    /CURSORP

This formula can be used to determine the position value:

     Position = (terminal-width ? 1) x (row-number ? minus 1) + column-number

For example, using a terminal model with a width of 80, to set the cursor position to be at row 2, column 11, you would need to perform the following calculation:

     Position = (80 - 1) x (2 - 1) + 11

The result is the value 90. So, you would code the following move statement:

     MOVE       90        TO    /CURSORP

Determining the Current Position of the Cursor

CA UFO provides two PDS keywords, /CURSORC and /CURSORR, that allow you to determine the current location of the cursor. The /CURSORC keyword contains the number of the column and the /CURSORR keyword contains the number of the row where the cursor was positioned when the terminal operator pressed any interrupt key.

Additional Information:

For detailed information on the CA UFO Display Definitions, cursor positioning, and procedure keywords, see Section 17 of the publication CA UFO Application Guide.

Please help us improve!

Will this information enable you to resolve your issue?

Please tell us what we can do better.

{{feedbackText.length ? feedbackText.length : '0'}}/255


Not what you were looking for?

Search Again >

Product Information

Support by Product >


Join a Community >