HELPLIB.HLB  —  DEFINE  /KEY  Examples
    1.$ DEFINE/KEY PF3 "SHOW TIME" /TERMINATE
      %DCL-I-DEFKEY, DEFAULT key PF3 has been defined
      $ <PF3>
      $ SHOW TIME
        14-DEC-2001 14:43:59

      In this example, the DEFINE/KEY command defines the PF3 key on
      the keypad to perform the SHOW TIME command. DEFAULT refers to
      the default state.

    2.$ DEFINE/KEY PF1 "SHOW " /SET_STATE=GOLD/NOTERMINATE/ECHO
      %DCL-I-DEFKEY, DEFAULT key PF1 has been defined
      $ DEFINE/KEY PF1 " DEFAULT" /TERMINATE/IF_STATE=GOLD/ECHO
      %DCL-I-DEFKEY, GOLD key PF1 has been defined
      $ <PF1>
      $ <PF1>
      $ SHOW DEFAULT
      DISK1:[JOHN.TEST]

      In this example, the first DEFINE/KEY command defines the PF1
      key to be the string SHOW. The state is set to GOLD for the
      subsequent key. The /NOTERMINATE qualifier instructs the system
      not to process the string when the key is pressed. The second
      DEFINE/KEY command defines the use of the PF1 key when the
      keypad is in the GOLD state. When the keypad is in the GOLD
      state, pressing PF1 causes the current read to be terminated.

      If you press the PF1 key twice, the system displays and
      processes the SHOW DEFAULT command.

      The word DEFAULT in the second line of the example indicates
      that the PF1 key has been defined in the default state. Note
      the space before the word DEFAULT in the second DEFINE/KEY
      command. If the space is omitted, the system fails to recognize
      DEFAULT as the keyword for the SHOW command.

    3.$ SET KEY/STATE=ONE
      %DCL-I-SETKEY, keypad state has been set to ONE
      $ DEFINE/KEY PF1 "ONE"
      %DCL-I-DEFKEY, ONE key PF1 has been defined
      $ DEFINE/KEY/IF_STATE=ONE PF1 "ONE"
      %DCL-I-DEFKEY, ONE key PF1 has been defined

      This example shows two ways to define the PF1 key to be "ONE"
      for state ONE.

      The second DEFINE/KEY command shows the preferred method for
      defining keys. This method eliminates the possibility of
      error by specifying the state in the same command as the key
      definition.
Close Help