# `BACK` — `BYREF`

## Contents

- `BACK` — Moves back one record in the data file
- `BEEP` — Sounds the buzzer
- `BEGINTRANS` — Begins a transaction on a database
- `BOOKMARK` — Places a bookmark on the current record
- `BREAK` — Breaks out of a control loop
- `BUSY` — Busy message
- `BYREF` — Passes a variable by reference

## `BACK` — Moves back one record in the data file

Usage: `BACK`

Makes the previous record in the current data file the current record.

If the current record is the first record in the file, then the current record does not change.

## `BEEP` — Sounds the buzzer

Usage: `BEEP time%,pitch%`

Sounds the buzzer. The beep lasts for `time%`/32 seconds so for a beep a second long make `time%`=32, etc. The maximum is 3840 (2 minutes).

The pitch (frequency) of the beep is 512/(`pitch%`+1) KHz.

`BEEP 5,300` gives a comfortably pitched beep.

If you make `time%` negative, `BEEP` first checks whether the sound system is in use (perhaps by another OPL program), and returns if it is. Otherwise, `BEEP` waits until the sound system is free.

Example a scale from middle C:

        PROC scale:
              LOCAL freq,n%                  REM n% relative to middle A
              n%=3                         REM start at middle C
              WHILE n%<16
                    freq=440*2**(n%/12.0)       REM middle A = freq 440Hz
                    BEEP 8,512000/freq-1.0
                    n%=n%+1
                    IF n%=4 OR n%=6 OR n%=9 OR n%=11 OR n%=13
                          n%=n%+1
                    ENDIF
              ENDWH
        ENDP

Alternatively, sound the buzzer with this statement: `PRINT CHR$(7)`. This produces a click sound.

If your batteries are low, `BEEP` may not produce the desired effect: on the Psion Series 5, the buzzer will be used instead to produce the ‘beep’. The buzzer produces a higher pitched sound.

## `BEGINTRANS` — Begins a transaction on a database

Usage: `BEGINTRANS`

Begins a transaction on the current database. The purpose of this is to allow changes to a database to be committed in stages. Once a transaction has been started on a view (or table) then all database keywords will function as usual, but the changes to that view will not be made until `COMMITTRANS` is used.

See also `COMMITTRANS`, `ROLLBACK`, `INTRANS`.

## `BOOKMARK` — Places a bookmark on the current record

Usage: `b%=BOOKMARK`

Puts a bookmark at the current record of the current database view. The value returned can be used in `GOTOMARK` to make the record current again. Use `KILLMARK` to delete the bookmark.

## `BREAK` — Breaks out of a control loop

Usage: `BREAK`

Makes a program performing a `DO`...`UNTIL` or `WHILE`...`ENDWH` loop exit the loop and immediately execute the line following the `UNTIL` or `ENDWH` statement.

Example:

## `BUSY` — Busy message

Usage: any of

        BUSY str$,c%,delay%
        BUSY str$,c%
        BUSY str$
        BUSY OFF

`BUSY str$` displays `str$` in the bottom left of the screen, until `BUSY OFF` is called. Use this to indicate ‘Busy’ messages, usually when an OPL program is going to be unresponsive to keypresses for a while.

If `c%` is given, it controls the corner in which the message appears:

``KBusyTopLeft%`` | 0 | top left
``KBusyBottomLeft%`` | 1 | bottom left (default)
``KBusyTopRight%`` | 2 | top right
``KBusyBottomLeft%`` | 3 | bottom right

These corner value constants are supplied in Const.oph.

`delay%` specifies a delay time (in half seconds) before the message should be shown. Use this to prevent ‘Busy’ messages from continually appearing very briefly on the screen.

Only one message can be shown at a time. The maximum string length of a `BUSY` message is 80 characters, given by `Const.oph`’s `KBusyMaxtext%`. An ‘Invalid argument’ error is returned for any value of `str$` longer than this.

`KBusyMaxtext%` | 80 | Maximum length of a `BUSY` message.

## `BYREF` — Passes a variable by reference

Usage: `BYREF variable`

Passes variable by reference to an OPX procedure when used in a procedure argument list. This means that the value of the variable may be changed by the procedure.

See the OPX header files for more details.