$Code: Difference between revisions
m (add link) |
No edit summary |
||
Line 1: | Line 1: | ||
<p> | <p> | ||
The <var>[[$Code]]</var> function, along with <var>[[$Decode]]</var>, provides an encoding/decoding facility in SOUL. <var>$Code</var> and <var>$Decode</var> operate on code tables that are defined, created, and controlled by the system manager. These tables can be searched but not changed by SOUL functions. </p> | The <var>[[$Code]]</var> function, along with <var>[[$Decode]]</var>, provides an encoding/decoding facility in SOUL. <var>$Code</var> and <var>$Decode</var> operate on [Customizing_functions_and_translation_tables#CDTB_module|code tables]] that are defined, created, and controlled by the system manager. These tables can be searched but not changed by SOUL functions. </p> | ||
<p> | <p> | ||
<var>$Code</var> and <var>$Decode</var> search tables that are external to a <var class="product">Model 204</var> file. These tables are independent of a field's CODED/NON-CODED attribute, which affects how the field is stored internally in the <var class="product">Model 204</var> file. </p> | <var>$Code</var> and <var>$Decode</var> search tables that are external to a <var class="product">Model 204</var> file. These tables are independent of a field's CODED/NON-CODED attribute, which affects how the field is stored internally in the <var class="product">Model 204</var> file. </p> |
Revision as of 13:45, 24 January 2018
The $Code function, along with $Decode, provides an encoding/decoding facility in SOUL. $Code and $Decode operate on [Customizing_functions_and_translation_tables#CDTB_module|code tables]] that are defined, created, and controlled by the system manager. These tables can be searched but not changed by SOUL functions.
$Code and $Decode search tables that are external to a Model 204 file. These tables are independent of a field's CODED/NON-CODED attribute, which affects how the field is stored internally in the Model 204 file.
The $Code function takes two arguments:
- The first argument contains the name of the table to be searched.
- $Code returns the code for the character string value contained in the second argument. A null value is returned if the string is not contained within the table or if the table does not exist. A nonexistent table also causes the nonfatal message:
INVALID CODE TABLE IDENTIFIER=X.
Example
This request prompts for the full name of a state, but it performs the record search on the coded value for that state.
BEGIN %STCD = $code ('STATE', $READ ('ENTER STATE NAME')) GET.RECS: FIND ALL RECORDS FOR WHICH STATE = %STCD END FIND FOR EACH RECORD IN GET.RECS . . .