# `UADD` — `USUB`

## Contents

- `UADD` — Adds two unsigned integers
- `UNLOADM` — Unloads a module
- `UNTIL` — See `DO`
- `UPDATE` — Deletes the current record and saves as a new record at the end of the file
- `UPPER$` — Converts a string to upper case
- `USE` — Selects a data file
- `USUB` — Subtracts two unsigned integers

## `UADD` — Adds two unsigned integers

Usage: `i%=UADD(val1%, val2%)`

Add `val1%` and `val2%`, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic when the 64K memory restriction is set (see `SETFLAGS`), e.g. `UADD(ADDR(text$),1)` should be used instead of `ADDR(text$)+1`.

One argument would normally be a pointer and the other an offset expression.

Note that `UADD` and `USUB` should not be used on the for pointer arithmetic unless `SETFLAGS` has been used to enforce the 64K memory limit. In general, long integer arithmetic should be used for pointer arithmetic.

See also USUB.

## `UNLOADM` — Unloads a module

Usage: `UNLOADM module$`

Removes from memory the module `module$` loaded with `LOADM`.

`module$` is a string containing the name of the translated module.

The procedures in an unloaded module cannot then be called by another procedure.

`UNLOADM` causes any procedures in the module that are not still running to be unloaded from memory too. Running procedures are unloaded on return. It is considered bad practice, however, to use `UNLOADM` on a module with procedures that are still running.

Once `LOADM` has been called, procedures loaded stay in memory until the module is unloaded. Modules are not flushed automatically.

## `UNTIL` — See `DO`

See `DO`.

## `UPDATE` — Deletes the current record and saves as a new record at the end of the file

Usage: `UPDATE`

Warning: This function is deprecated and included only for compatibility with older versions of the OPL language. `INSERT`, `PUT`, and `CANCEL` should be used in preference to `APPEND` and `UPDATE`, although `APPEND` and `UPDATE` are still supported. However, note that `APPEND` can generate a lot of extra (intermediate) erased records. `COMPACT` should be used to remove them, or alternatively use `SETFLAGS` to set auto-compaction on.

Deletes the current record in the current data file and saves the current field values as a new record at the end of the file.

This record, now the last in the file, remains the current record.

Example:

        A.count=129
        A.name$="Brown"
        UPDATE

Use `APPEND` to save the current field values as a new record.

## `UPPER$` — Converts a string to upper case

Usage: `u$=UPPER$(a$)`

Converts any lower case characters in `a$` to upper case, and returns the completely upper case string. Example:

        ...
        CLS :PRINT "Y to continue"
        PRINT "or N to stop."
        g$=UPPER$(GET$)
        IF g$="Y"
              nextproc:
        ELSEIF g$="N"
              RETURN
        ENDIF
        ...

Use `LOWER$` to convert to lower case.

## `USE` — Selects a data file

Usage: `USE` logical name

Selects the data file with the given logical name (`A`-`Z`). The file must previously have been opened with `OPEN`, `OPENR` or `CREATE` and not yet be closed.

All the record handling commands (such as `POSITION` and `UPDATE`, and `GOTOMARK`, `INSERT`, `MODIFY`, `CANCEL` and `PUT`) then operate on this file.

## `USUB` — Subtracts two unsigned integers

Usage: `i%=USUB(val1%,val2%)`

Subtract `val2%` from `val1%`, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic when the 64K memory restriction is set (see `SETFLAGS`)

Note that `UADD` and `USUB` should not be used for pointer arithmetic unless `SETFLAGS` has been used to enforce a 64K memory limit. In general long integer arithmetic should be used.

See also `UADD`.