CSRLOC (Cursor Location) keyword for display files

You use this record-level keyword to specify the cursor location on an output operation to the record format that you are defining. Your program sends the output operation after setting the cursor location.

The format of the keyword is:

CSRLOC(field-name-1 field-name-2)

The parameter values on the keyword specify the names of two fields whose contents are the line number (for field-name-1) and the position number (for field-name-2) of the cursor location. Field-name-1 and field-name-2 are 3-byte, zoned decimal, hidden fields. Your program uses these fields to tell the IBM® i operating system where to locate the cursor.

The cursor is not positioned to the required location on an output operation that leaves the keyboard locked. The cursor does not move to the required position until your program sends an input or an output operation that unlocks the keyboard. If your program sets the cursor location fields to values outside the range of values valid for the display device, this keyword is ignored.

For any one output operation, the CSRLOC keyword overrides any other cursor location specifications, such as DSPATR(PC) and SFLRCDNBR(CURSOR), that are in effect. This keyword is in effect until your program sends another output operation with DSPATR(PC), CSRLOC, or SFLRCDNBR(CURSOR) in effect or until the record in which this keyword is specified is overlaid (OVERLAY keyword) or erased (ERASE keyword), whichever comes first.

On an input operation, the cursor location can be determined by looking at the I/O feedback area or specifying the appropriate parameter on the RTNCSRLOC keyword. See the Application Display Programming bookLink to PDF for more information about the I/O feedback area.

Specify the CSRLOC keyword only once per record format.

The CSRLOC keyword is not valid for the following record formats:

  • Subfile record formats (identified by the SFL keyword)
  • User-defined record formats (identified by the USRDFN keyword)

Option indicators are valid for this keyword. Display size condition names are not valid.

Example

The following example shows how to specify the CSRLOC keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1                   CSRLOC(LINNBR POSNBR)
00020A            TITLE         40   B  1  2
00030A            PAGE           5Y OB  1 60
00040A            TEXT        1760   B  2  1
00050A            LINNBR         3  OH
00060A            POSNBR         3  OH
     A

The application program sets the contents of LINNBR and POSNBR before issuing an output operation to RECORD1. When the record is displayed, the fields Title, Page, and Text appear on the display. The cursor can be at some location in a field of RECORD1 where the workstation user is to make changes.