AUTOSAVE—Save Data Automatically

The AUTOSAVE primary command sets autosave mode, which controls whether changed data is saved when you enter END.

Syntax

Read syntax diagramSkip visual syntax diagramAUTOSAVEONPROMPTOFFPROMPTNOPROMPT
ON
Turns autosave mode on. When you enter END, any changed data is saved.
OFF PROMPT
Turns autosave mode off with the PROMPT operand. You are notified that changes have been made and that either the SAVE command (followed by END) or CANCEL must be used. When you use AUTOSAVE PROMPT by itself, it implies the OFF command.
OFF NOPROMPT
Turns autosave mode off with the NOPROMPT operand. You are not notified and the data is not saved when you issue an END command. END becomes an equivalent to CANCEL. Use the NOPROMPT operand with caution.

Description

Data is considered changed if you have operated on it in any way that could cause a change. Shifting a blank line or changing a word to the same word does not actually alter the data, but the editor considers this data changed. When you enter SAVE, the editor resets the change status.

Autosave mode, along with the PROMPT operand, is saved in the edit profile. To check the current setting of autosave mode:

  1. On the command line, type:
    PROFILE 3
  2. Press Enter. The third line of the edit profile shows the autosave mode setting.

To turn on autosave mode:

  1. On the command line, type:
    AUTOSAVE
    Note: This is the equivalent of entering AUTOSAVE ON.
  2. Press Enter. The next time you enter END, any changes that you made to the data set or member that you were editing are saved.

To turn off autosave mode:

  1. On the command line, type:
    AUTOSAVE OFF
    Note: This is the equivalent of entering AUTOSAVE OFF PROMPT.
  2. Press Enter. The next time you enter END when a data set or member has been changed, the editor prompts you to specify whether you want changes to the data set or member saved (SAVE) or not saved (CANCEL). However, if no changes have been made to the data set or member, the edit session ends without a prompt.

To turn off autosave mode and specify that you do not want to be prompted when data has changed:

  1. On the command line, type:
    AUTOSAVE OFF NOPROMPT
  2. Press Enter. The next time you enter END when a data set or member has been changed, the edit session ends without saving your changes, just as if you had entered CANCEL. You are not prompted to save the changes.

For more information on saving data, see the CANCEL and END primary commands, and the DATA_CHANGED, CANCEL, and END macro commands.

Examples

This example shows a practical application of AUTOSAVE usage.

  1. You have been editing a data set member and now want to end the edit session. Enter END:
    END
  2. The member that you were editing remains with this message in the upper-right corner:
    DATA CHANGED-SAVE/CANCEL
    This message implies that autosave mode in the edit profile is set to AUTOSAVE OFF PROMPT. You are prompted to enter either SAVE to save your changes, or CANCEL to end the edit session without saving your changes.

    You also have the option to change autosave mode in the edit profile to AUTOSAVE ON. By doing so, the next time you enter END, your changes will be saved and the edit session will end.

  3. You decide to turn on autosave mode:
    AUTOSAVE ON
  4. Then you enter END again to save your changes and end the edit session.
    END