BELL statement Causes the terminal to make a beep sound. Note: Does not apply to SpeedScript programming. Syntax BELL Example The following procedure dynamically determines the output file to use for a report that lists all customer records. The SET statement gets the name of a file from the user. The SEARCH function returns an unqualified file name if that file already exists in your working directory. If the file exists in your working directory, it displays messages, undoes the work done in the DO block, and lets the user enter another file name. (The procedure determines whether the file is in your working directory. If SEARCH returns a directory other than your current working directory, you receive no messages and it does not undo your work.) After you type a file name that does not already exist, the OUTPUT TO statement directs the output of the procedure to that file. r-bell.p DEFINE VARIABLE outfile AS CHARACTER NO-UNDO FORMAT "x(8)" LABEL "Output file name". getfile: DO ON ERROR UNDO, RETRY: SET outfile WITH SIDE-LABELS. IF SEARCH(outfile) = outfile THEN DO: MESSAGE "A file named" outfile "already exists in your directory". MESSAGE "Please use another name". BELL. UNDO getfile, RETRY getfile. END. END. OUTPUT TO VALUE(outfile). FOR EACH Customer NO-LOCK: DISPLAY Customer.Name Customer.CreditLimit. END. Note If the terminal is not the current output device, BELL has no effect.
BELL
DEFINE VARIABLE outfile AS CHARACTER NO-UNDO FORMAT "x(8)"
LABEL "Output file name".
getfile:
DO ON ERROR UNDO, RETRY:
SET outfile WITH SIDE-LABELS.
IF SEARCH(outfile) = outfile THEN DO:
MESSAGE "A file named" outfile "already exists in your directory".
MESSAGE "Please use another name".
BELL.
UNDO getfile, RETRY getfile.
END.
OUTPUT TO VALUE(outfile).
FOR EACH Customer NO-LOCK:
DISPLAY Customer.Name Customer.CreditLimit.