Standard Adis Key Functions

Below is a full list of the functions performed by the Adis keys. Functions 0 through 27 are simple functions. Functions 55 to 62 are complex functions which can perform different actions depending on some state. For example, those functions provided for RM compatibility have a different action depending on whether or not the UPDATE clause is specified in the ACCEPT statement.

Function 0, Terminate Accept
This function terminates an ACCEPT operation. The first byte of any CRT STATUS field (defined as pic 9 display) is set to the character "0" (ASCII 48) and the second byte (defined as PIC 9(2) COMP-X) is set to 0.
Function 1, Terminate Program
If enabled, this function causes the Abort confirmation message to be output to the screen and a character requested from the user. If the user responds with anything other than "Y" or "y", the message is blanked and normal processing of the ACCEPT operation continues. If the user presses "Y", or "y" or no message is configured, the program is terminated as if a STOP RUN had been executed.
Function 2, Carriage Return
The cursor is moved to the first character position that occurs within a field at or after column one on the next or subsequent line of the screen. If there is no such field, no action takes place.
Function 3, Cursor Left
Moves the cursor to the previous character in the field. If the current character is the first character of the field, the cursor is moved to the last character of the preceding field. If the current character is the first character of the first field on the screen, an error is signalled to the user.
Function 4, Cursor Right
Moves the cursor to the next character in the field. If the current character is the last character of the field, the cursor is moved to the first character of the next field. If the current character is the last character of the last field on the screen, an error is signalled to the user.
Function 5, Cursor Up
The cursor is moved to the next unprotected character position; that is, a position that occurs in a field in direct line above the current position.
Function 6, Cursor Down
Moves the cursor to the next unprotected character position in direct line below the current position.

For cursor up and cursor down (functions 5 and 6), cursor movement functions follow the same rules as items defined using the CURSOR IS clause if a position is found that is within a field but is protected by virtue of containing an insertion character or a suppressed numeric digit. In such situations the cursor is moved right to the first unprotected character position within that field. If all such positions are protected, the cursor is moved to the last unprotected character position within the field.

Function 7, Move to the Start of the Screen
Moves the cursor to the first unprotected character position of the current screen.
Function 8, Move to Next Tab Position
Moves the cursor to the next column Tab stop position. The cursor is never moved forward further than the first available character position after the end of the current field (or line in multi-line fields).
Function 9, Move to Previous Tab Position
Moves the cursor to the previous column Tab stop position. The cursor is never moved back further than the last available character position before the start of the current field (or line in multi-line fields).
Function 10, End
Moves the cursor to unprotected character positions in the order:
  1. The last character position of the current line in a multi-line alphanumeric field.
  2. The last character position of the current field.
  3. The first character position of the last field on the current screen.
Function 11,Move to Next Field
Moves the cursor to the first unprotected character position of the next field on the screen. If already in the last field and auto-skip out of an ACCEPT is not enabled for this key, the cursor is positioned to the last character of the field and the request is considered to have been unsuccessful.
Function 12, Move to Previous Field
Moves the cursor to the first unprotected character position in the current field. If the cursor is already at the first position, it moves to the first character position of the previous field. If the cursor is already at the first character of the first field, the request is considered unsuccessful.
Function 13, Change Case of Current Character
Retrieves the character at the current cursor position, changes its case if alphabetic and processes it as if it were just keyed. The function is not permitted in numeric or Kanji fields. Changing case on a non-alphabetic character is treated as equivalent to simply typing the character again. The function cannot be used to override the fold to upper-case mechanism which simply re-inverts the case if an attempt is made to fold a character to lower-case.
Function 14, Backspace Character
Moves the cursor to the unprotected character position logically preceding the current one, pushes the character there into the retype buffer and replaces it with one popped from the restore buffer. When in insert mode, removal is achieved by moving the remaining characters in the field along one position and popping a character from the overflow buffer to occupy the gap at the end.

In either case, if the relevant buffer is empty or the next character is not valid for the field, a space or zero (according to type of field) is used. Action is slightly different when to the left of the decimal point in numeric fields, but the logical effect is the same - that of reversing the effect of typing a character.

One unusual effect emanating from the logical requirements is that where the cursor was unable to move out of a field when a character was keyed into the last position, the cursor is not moved prior to character replacement.

Function 15, Retype Character
Pops a character from the restore buffer and proceeds as if it had been received from the keyboard. An error is signalled if the buffer is empty or the character is illegal in the current field.
Function 16, Insert Single Character
Places a space or zero character (according to the field type) under the current cursor position, making room for it by shuffling characters along the field. Except when to the left of the decimal point in numeric fields, significant characters can be pushed off the end (the character that is lost is pushed into the overflow buffer and an error is signalled to the user). When to the left of the decimal point in a numeric field, an attempted insertion is unsuccessful if a significant digit would otherwise be lost or if the cursor is on the leftmost digit position (since the functionality of numeric insertion operations in these circumstances implies a requirement to insert before the current digit).
Function 17, Delete Character
Pushes the character currently under the cursor into the restore buffer, moving the remaining characters in the field left by one position and pops a character from the overflow buffer to occupy the gap at the end. If the overflow buffer is empty, a space or zero (according to type of field) is used. Action is slightly different when to the left of the decimal point in numeric fields, but the logical effect is normally the same - that of reversing the effect of inserting or restoring a character. If the field is numeric, the character is discarded and not pushed into the restore buffer.
Function 18, Restore Character
The effect and restrictions of this function are identical to insert character (function 16 above) except that the character to be inserted is popped from the restore buffer. An error is signalled if the buffer is empty or if the character popped is not valid in the current field. This function is not available in numeric fields.
Function 19, Clear to End of Field
Characters at, and to the right of, the current cursor position in the current field are pushed into the restore buffer and replaced by spaces or zeros (according to the type of field). Operation is from left to right and includes trailing nonsignificant spaces and zeros. The cursor does not move. Multi-line alphanumeric fields are treated as being split at line boundaries for the purposes of this operation.
Function 20, Clear Field
The entire contents of the current field (or the current line in the case of a multi-line alphanumeric field) are pushed into the restore buffer as for clear to end of field on the first character position. The field then has spaces (alphanumerics) or zeros (numerics) moved to it and the cursor is placed on its initial position as defined for the type and format of the field.
Function 21, Clear to End of Screen
The action defined for clear to end of field is performed on the current field (or line), and the following fields have spaces or zeros moved to them, as appropriate.
Function 22, Clear Screen
All fields on the screen have spaces or zeros (as appropriate) moved to them and the cursor is moved to its home position (the first unprotected character of the first field). The restore and retype buffers are cleared by this function.
Function 23, Set Insert Mode
Sets the current editing mode to insert and displays or clears any relevant configured indicators. Any Off end of field indicator is cleared by this function.
Function 24, Set Replace Mode
Sets the current editing mode to replace, and displays or clears any relevant configured indicators. Any Off end of field indicator is cleared by this function.

The concept of insert mode and replace mode apply only in alphanumeric fields. The mode flag is therefore suppressed while in numeric fields and reinstated on moving to another alphanumeric field.

Replace mode is sometimes known as overtype mode.

Function 25, Undo
Reinstates the current field (or line) to its state when the cursor last moved into it. Operations involving hidden MOVE operations out of the current field (clear screen, clear to end of screen) can cause edits to cease to be undoable as well as the more obvious operations such as field-tab and auto-skip out.
Function 26, Home
Moves the cursor to unprotected character positions in the order:
  1. The first character position of the current line in a multi-line alphanumeric field.
  2. The first character position of the current field.
  3. The first character position of the current screen.