HOME (Home) keyword for display files

You use this file-level or record-level keyword to specify that you want to recognize and handle the Home key through your program.

See System/36 environment considerations for display files for special considerations when you specify the HOME keyword in files that are used in the System/36 environment.

The format of the keyword is:
HOME[(response-indicator ['text'])]

If you press the Home key and the cursor is not already at the home position, the cursor returns to the home position, even if you do not specify the HOME keyword.

If the cursor is already at the home position when the Home key is pressed, the IBM® i operating system returns control to your program as it does when a command attention key is pressed (no data is received from the device). In this situation, if you have not specified the HOME keyword, the IBM i operating system sends a message indicating that the key is not valid at that time.

The home position is one of the following positions (in order of priority):
  • The cursor position specified by the last output operation
  • The first unprotected input field
  • Position 1, line 1

The optional text is included on the computer printout created at program compilation time to explain the intended use of the indicator. This text's only function in the file or the program is as a comment. The single quotation marks are required. If you specify more than 50 characters between the single quotation marks, the text is truncated to 50 characters on the program computer printout.

Option indicators are valid for this keyword.

Example

The following example shows how to specify the HOME keyword so that if the cursor is in the home position when the Home key is pressed, control returns to the program with response indicator 95 set on.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00030A                                      HOME(95 'Home key')
     A