PROCEDURE quit_create, quic, qc

  IF $utility(name) = 'SCU_EDIT' THEN
    "$FORMAT=OFF"
    VAR
      y_or_n  : string 1..1
    VAREND
    "$FORMAT=ON"

    IF $current_object_type = 'FILE' THEN
      IF $file($fname($current_object), assigned) THEN
        IF $file($command_of_caller, device_class) = 'MASS_STORAGE' THEN
          EXIT quit_create WITH $status(false, 'QC', 1001, ' File already exists.')
        IFEND
        IF $screen_active THEN
          y_or_n = $si(' File already exists.  Reply Y to overwrite file or N to resume session.')
        ELSE
          put_line ' File already exists.  Reply Y to overwrite file or N to resume session.'
          get_line v=y_or_n i=$input prompt='? '
        IFEND
        IF y_or_n = 'Y' OR y_or_n = 'y' THEN
          end_file write_file=true
        IFEND
      ELSE
        end_file write_file=true
      IFEND
    ELSE
      IF $current_object_type = 'DECK' THEN
        IF $file($command_of_caller, device_class) = 'MASS_STORAGE' THEN
          EXIT quit_create WITH $status(false, 'QC', 1002, ' This command is not applicable for decks.')
        IFEND
        IF $screen_active THEN
          put_row text=' This command is not applicable for decks.' row=$message_row
        ELSE
          put_line ' This command is not applicable for decks.'
        IFEND
      IFEND
    IFEND

    IF $current_object_type = 'NULL' THEN
      "$FORMAT=OFF"
      quit write_file=false
      "$FORMAT=ON"
    IFEND

  IFEND

PROCEND quit_create
