# call processing code

The call processing code calls a BASIC
or FlashBASIC subroutine from the file-defining item or an ADI. Called
subroutines are Flash compiled to improve performance.

If you attempt to file or restore a call in an FSI file-defining
item, it will be commented-out with an asterisk (`*`).

This processing code is supported only from the VME.

| System Processors | Select, Update, List |
| --- | --- |
| Code Type | Attribute Defining, File Defining |
| Dictionary Attributes | Input Conversion, Output Conversion, Correlative |

## Syntax

```
call {file.spec} module
```

## Parameter(s)

| file.spec | Full path to the file containing the FlashBASIC code. The full path database,file, must be used (for example dm,bp,). The account name in the file path must be an FSI account. file.spec can be omitted if the module has been cataloged in the Domain Catalog. |
| --- | --- |
| module | Record-ID of the BASIC or FlashBASIC module. |

## Description

The syntax for calling a subroutine
does not specify any parameters, but the subroutine is passed a parameter
anyway, so one parameter must be specified in the subroutine statement.
However, when a subroutine is called from the file-defining item,
the entire item body is passed to the subroutine. When a subroutine
is called from an attribute-defining item, the value of the calling
attribute is passed to the subroutine.

Subroutines can be called
from the correlative or input-conversion attributes for file-defining
items, or the correlative, input-conversion, or output-conversion
attributes for attribute-defining items.

When a subroutine is
called from the correlative field of the file-defining item, control
passes to the subroutine at file time.

When a subroutine is
called from the input-conversion of the file-defining item, control
passes to the subroutine before the operator gets into the file via
the Update processor. That is, after the Update processor command
has been executed (`:u*file.name*`) and before the user gets access to the item.

Subroutines
for attribute-defining items that are called from the output-conversion
attribute are executed on output for redisplay after entry. Subroutines
called from the correlative attribute are executed prior to processing.
Subroutines called from the input-conversion attribute are executed
after input.

When passing a parameter value to the subroutine
where the processing code is in a file-defining item, the entire item
is passed to the subroutine. If the processing code is in an attribute-defining
item, the current, single value is passed to the subroutine. If called
from a hotkey, no parameters are passed automatically, and parameters
are additionally forbidden. However, the FlashBASIC AQL function can
be used in the called subroutine to obtain values from the processing
code.

Note:

- When Basic calls (that convert single values to multiple values) are used within an attribute definition that is used as selection criteria by an access statement, an index must be utilized to ensure proper functionality.

- When using correlatives from the FSI during a restore, illegal or unsupported correlatives are automatically commented out (by inserting a leading asterisk (*)). For example, any correlatives intended for use within the VME whose formats would not work properly within the FSI are automatically commented out.

- The call processing code is not always processed on null values.

Data may be interrogated and modified in the subroutine
using the FlashBASIC access statement.

Error
conditions can be set if an inputerr statement
is executed in the FlashBASIC subroutine.

## Example(s)

Assume that there is an attribute-defining
item that contains a call to a subroutine called st.name:

```
subroutine st.name(st)
states = "alaska,washington,oregon,california,idaho"
codes = "al,wa,or,ca,id"
convert "," to char(254) in codes
locate(st,codes;x) then
st = field(states,",",x)
end else st = "unknown"
```
Press ENTER. The value is passed from AQL into the `st` variable. If the corresponding string is found, `st` is loaded with the appropriate code and control returns
to AQL.

## See also

- [access() function](https://d3codex.com/pickbasic-flashbasic/access-function/)
- [callx (write trigger) processing code](https://d3codex.com/processingcodes/callx-write-trigger-processing-code/)
- [Processing codes (Update processor)](https://d3codex.com/updateprocessor/processing-codes-update-processor/)
- [Defining attributes](https://d3codex.com/attributedefiningitem/defining-attributes/)
- [File-defining items](https://d3codex.com/definitions/file-defining-items/)
- [input-conversion](https://d3codex.com/attributedefiningitem/input-conversion/)
- [Processing codes (Update processor)](https://d3codex.com/updateprocessor/processing-codes-update-processor/)
- [inputerr statement](https://d3codex.com/pickbasic-flashbasic/inputerr-statement/)
- [output-conversion](https://d3codex.com/attributedefiningitem/output-conversion/)
- [Processing codes (Update processor)](https://d3codex.com/updateprocessor/processing-codes-update-processor/)
- [Processing codes overview](https://d3codex.com/processingcodes/processing-codes-overview/)
- [Processing codes (Update processor)](https://d3codex.com/updateprocessor/processing-codes-update-processor/)
- [u31bc user exit](https://d3codex.com/proc/u31bc-user-exit/)
- [u41bc user exit](https://d3codex.com/proc/u41bc-user-exit/)
- [u51bc user exit](https://d3codex.com/proc/u51bc-user-exit/)

---
Source: https://d3codex.com/processingcodes/call-processing-code/ - part of the D3Codex reference.
