@database ARx_Error.ag
@index ARx_Index/ARx_NdxCont

@node MAIN "ARexxGuide | Error codes"
@toc ARexxGuide.guide/MAIN
@prev ARx_Cmd.ag/MAIN
@next ARexxGuide.guide/MAIN
   @{fg highlight}AN AMIGAGUIDE® TO ARexx@{fg text}                 Second edition (v2.0)
   by Robin Evans

   @{" About this section                                   " link ABOUT}
   @{fg highlight}Error codes:@{fg text}
       @{" 1  " link ERROR_1} @{" 2  " link ERROR_2} @{" 3  " link ERROR_3} @{" 4  " link ERROR_4} @{" 5  " link ERROR_5} @{" 6  " link ERROR_6} @{" 7  " link ERROR_7} @{" 8  " link ERROR_8} @{" 9  " link ERROR_9} @{" 10 " link ERROR_10}
       @{" 11 " link ERROR_11} @{" 12 " link ERROR_12} @{" 13 " link ERROR_13} @{" 14 " link ERROR_14} @{" 15 " link ERROR_15} @{" 16 " link ERROR_16} @{" 17 " link ERROR_17} @{" 18 " link ERROR_18} @{" 19 " link ERROR_19} @{" 20 " link ERROR_20}
       @{" 21 " link ERROR_21} @{" 22 " link ERROR_22} @{" 23 " link ERROR_23} @{" 24 " link ERROR_24} @{" 25 " link ERROR_25} @{" 26 " link ERROR_26} @{" 27 " link ERROR_27} @{" 28 " link ERROR_28} @{" 29 " link ERROR_29} @{" 30 " link ERROR_30}
       @{" 31 " link ERROR_31} @{" 32 " link ERROR_32} @{" 33 " link ERROR_33} @{" 34 " link ERROR_34} @{" 35 " link ERROR_35} @{" 36 " link ERROR_36} @{" 37 " link ERROR_37} @{" 38 " link ERROR_38} @{" 39 " link ERROR_39} @{" 40 " link ERROR_40}
       @{" 41 " link ERROR_41} @{" 42 " link ERROR_42} @{" 43 " link ERROR_43} @{" 44 " link ERROR_44} @{" 45 " link ERROR_45} @{" 46 " link ERROR_46} @{" 47 " link ERROR_47} @{" 48 " link ERROR_48}

       @{" Alphabetic list of error messages                " link ALPHAERROR}

            Copyright © 1993,1994 Robin Evans.  All rights reserved.

    This guide is @{" shareware " link ARexxGuide.guide/REG}. If you find it useful, please register.

@endnode

@node ABOUT " ARexxGuide | Error codes | ABOUT THIS SECTION"
@{fg highlight}Error codes and messages@{fg text}
~~~~~~~~~~~~~~~~~~~~~~~~
When a syntax error occurs in an ARexx script, the @{" interpreter " link ARexxGuide.guide/GLOSSARY 117} will
print a message listing an error number and an error message. Although a
comprehensive outline is impossible, this section explains some of the
conditions that can trigger each error. Each possible error number is
listed on the main page. The messages printed with the error numbers are
also @{" listed alphabetically " link ALPHAERROR}.

The error message is printed to the @{" STDOUT " link ARexxGuide.guide/GLOSSARY 232} device or to @{" STDERR " link ARexxGuide.guide/GLOSSARY 219} if that
device is defined. In some environments, STDOUT is redirected to @{" NIL: " link ARexxGuide.guide/GLOSSARY 163},
which will send ARexx error messages off to the Amiga-ether. To view the
messages under any condition, a trace console can be opened with the @{" TCO " link ARx_Cmd.ag/TCO}
command.

An all-too-frequent error message that isn't listed here is one that looks
something like this:

   Unknown command 1
     1 *-* open(t,'t:test',w);
   +++ Command returned 20

That error message was not generated by ARexx, which executed the @{" OPEN() " link ARx_Func3.ag/OPEN()}
function without a problem, but by the operating system. The problem here
is that an @{" expression " link ARx_Elements2.ag/EXPRESSION} -- the open() function -- was used without making
it a part of a valid ARexx @{" instruction " link ARx_Elements3.ag/INSTRUCTION} or @{" assignment " link ARx_Elements3.ag/ASSIGNMENT}.

         More information: @{" Avoiding accidental commands            " link ARx_Elements3.ag/ACICMD}

   Also see @{" TRACE instruction  " link ARx_Instr3.ag/TRACE}
            @{" TRACE() function   " link ARx_Instr3.ag/TRACE}
            @{" TS command         " link ARx_Cmd.ag/TS}
   Tutorial @{" Debugging a macro  " link ARx_Tutor.ag/MCR7}

@{" Compatibility issues: " link ARx_Intro.ag/COMPATIBILITY}
   The error messages used in ARexx are similar to those defined in
   @{" TRL2 " link ARx_Intro.ag/COMPATIBILITY 26}, but not identical. The error code associated with each message
   is significantly different.

Next, Prev, and Contents: Error codes

@endnode

@node ALPHAERROR "ARexxGuide | Error codes | Alphabetical listing"
@next MAIN
@prev MAIN
      @{" Arithmetic conversion error         : Error 47 " link ERROR_47}
      @{" Boolean value not 0 or 1            : Error 46 " link ERROR_46}
      @{" Command string error                : Error 11 " link ERROR_11}
      @{" Error return from function          : Error 12 " link ERROR_12}
      @{" Execution halted                    : Error  2 " link ERROR_2}
      @{" Expression nesting >32              : Error 43 " link ERROR_43}
      @{" Expression required                 : Error 45 " link ERROR_45}
      @{" Extraneous characters               : Error 35 " link ERROR_35}
      @{" Function did not return value       : Error 16 " link ERROR_16}
      @{" Function not found                  : Error 15 " link ERROR_15}
      @{" Host environment not found          : Error 13 " link ERROR_13}
      @{" Incomplete IF or SELECT             : Error 29 " link ERROR_29}
      @{" Insufficient memory                 : Error  3 " link ERROR_3}
      @{" Invalid argument to function        : Error 18 " link ERROR_18}
      @{" Invalid DO syntax                   : Error 28 " link ERROR_28}
      @{" Invalid expression                  : Error 41 " link ERROR_41}
      @{" Invalid expression result           : Error 44 " link ERROR_44}
      @{" Invalid keyword                     : Error 33 " link ERROR_33}
      @{" Invalid message packet              : Error 10 " link ERROR_10}
      @{" Invalid operand                     : Error 48 " link ERROR_48}
      @{" Invalid PROCEDURE                   : Error 19 " link ERROR_19}
      @{" Invalid statement in SELECT         : Error 23 " link ERROR_23}
      @{" Invalid template                    : Error 37 " link ERROR_37}
      @{" Invalid variable name               : Error 40 " link ERROR_40}
      @{" Keyword conflict                    : Error 36 " link ERROR_36}
      @{" Label not found                     : Error 30 " link ERROR_30}
      @{" Missing or multiple THEN            : Error 24 " link ERROR_24}
      @{" Missing or unexpected END           : Error 26 " link ERROR_26}
      @{" Missing OTHERWISE                   : Error 25 " link ERROR_25}
      @{" Program not found                   : Error  1 " link ERROR_1}
      @{" Requested library not found         : Error 14 " link ERROR_14}
      @{" Required keyword missing            : Error 34 " link ERROR_34}
      @{" Symbol expected                     : Error 31 " link ERROR_31}
      @{" Symbol mismatch                     : Error 27 " link ERROR_27}
      @{" Symbol or string >65535 characters  : Error  9 " link ERROR_9}
      @{" Symbol or string expected           : Error 32 " link ERROR_32}
      @{" Unbalanced parentheses              : Error 42 " link ERROR_42}
      @{" Unexpected BREAK, LEAVE or ITERATE  : Error 22 " link ERROR_22}
      @{" Unexpected ELSE or OTHERWISE        : Error 21 " link ERROR_21}
      @{" Unexpected THEN or WHEN             : Error 20 " link ERROR_20}
      @{" Uninitialized variable              : Error 39 " link ERROR_39}
      @{" Unmatched quote                     : Error  5 " link ERROR_5}
      @{" Unrecognized token                  : Error  8 " link ERROR_8}
      @{" Unterminated comment                : Error  6 " link ERROR_6}
      @{" Wrong number of arguments           : Error 17 " link ERROR_17}

Next, Prev. & Contents: Error codes

@endnode
@node ERROR_1 "ARexxGuide | Error codes (1 of 48) | Error 1"
@keywords "error code, Error 1, Program not found"
@prev MAIN
@{fg highlight}Error 1: Program not found@{fg text}

ARexx follows its own @{" search path " link ARx_Cmd.ag/RX 9} when looking for a program. If a
script is launched with the command "rx myprog", ARexx will first look for
the file "myprog" in the current directory and then for the file
"myprog.rexx". If neither file is present in the current directory, the
interpreter will search for "rexx:myprog" and then "rexx:myprog.rexx".

This error is sometimes caused by lack of opening @{" comment " link ARx_Elements.ag/COMMENT} marker in an
otherwise valid script. ARexx will not recognize a program as a REXX
script unless the first non-space characters in the file are "/*".


@endnode
@node ERROR_2 "ARexxGuide | Error codes (2 of 48) | Error 2"
@{fg highlight}Error 2: Execution halted@{fg text}

Triggered by a @{" BREAK C " link ARx_Instr3.ag/BREAK_C} interrupt or an external halt signal from @{" HI " link ARx_Cmd.ag/HI}.


@endnode
@node ERROR_3 "ARexxGuide | Error codes (3 of 48) | Error 3"
@{fg highlight}Error 3: Insufficient memory@{fg text}

The @{" interpreter " link ARexxGuide.guide/GLOSSARY 117} was unable to allocate the minimum memory required for
its initial scan of the script.


@endnode
@node ERROR_4 "ARexxGuide | Error codes (4 of 48) | Error code 4"
   Error code 4 is not used.


@endnode
@node ERROR_5 "ARexxGuide | Error codes (5 of 48) | Error 5"
@{fg highlight}Error 5: Unmatched quote@{fg text}

The @{" interpreter " link ARexxGuide.guide/GLOSSARY 117} finds many unmatched quotation marks during its initial
scan of a script, before execution starts.

The error will sometimes go unnoticed becuase ARexx allows @{" string tokens " link ARx_Elements.ag/STRING}
to span multiple physical lines. If two quotation marks are missing from a
script, the interpreter will often pair the first unterminated mark with
the second one, producing an unintentional string spanning many lines of
program code.

   Also see: @{" Error 9       " link Error_9}
   Also see: @{" Error 26      " link Error_26}


@endnode
@node ERROR_6 "ARexxGuide | Error codes (6 of 48) | Error 6"
@{fg highlight}Error 6: Unterminated comment@{fg text}

This error is recognized during the initial scan of a program.

@{" Comments " link ARx_Elements.ag/COMMENT} may be nested within other comments, but each "/*" marker must
be paired with a "*/" marker.


@endnode
@node ERROR_7 "ARexxGuide | Error codes (7 of 48) | Error code 7"
   Error code 7 is not used.


@endnode
@node ERROR_8 "ARexxGuide | Error codes (8 of 48) | Error 8"
@{fg highlight}Error 8: Unrecognized token@{fg text}

This error is recognized during the initial scan of a program.

It occurs when a character that is not valid for use as a @{" symbol " link ARx_Elements.ag/SYMBOL},
@{" operator " link ARx_Elements3.ag/OPERATION}, or @{" special character " link ARx_Elements.ag/SPECCHAR} is used outside of a @{" literal string " link ARx_Elements.ag/STRING}.

The error sometimes occurs when @{" commands " link ARx_Elements3.ag/COMMAND} that use unique characters are
listed without quotation marks.


@endnode
@node ERROR_9 "ARexxGuide | Error codes (9 of 48) | Error 9"
@{fg highlight}Error 9: Symbol or string >65535 characters@{fg text}

@{" Strings " link ARx_Elements2.ag/STRINGEXPR}, @{" symbols " link ARx_Elements.ag/SYMBOL}, and @{" variables " link ARx_Elements2.ag/VARIABLE} are limited to 64k bytes. This error
will result from an attempt to create a string or (less likely) a symbol
that is longer than that.

The error is sometimes generated by misplaced quotation marks. @{" Error 5 " link ERROR_5}
is signalled if there are an uneven number of quotation marks in a file,
but if two marks are missing, the interpreter will attempt include
everything between the first and second marks in one long string.


@endnode
@node ERROR_10 "ARexxGuide | Error codes (10 of 48) | Error 10"
@{fg highlight}Error 10: Invalid message packet@{fg text}

The @{" message port functions " link ARx_Func4.ag/PORTLIST} usually generate @{" Error 18 " link ERROR_18} when an invalid
address is used as an argument. The error may result, though, if the
address is valid, but the returned packet does not meet specifications.

The error code might also be used by @{" library function " link ARx_Elements3.ag/LIBFUNC} packages.


@endnode
@node ERROR_11 "ARexxGuide | Error codes (11 of 48) | Error 11"
@{fg highlight}Error 11: Command string error@{fg text}

This error is not generated under any known condition by ARexx itself, but
might be used by programs that include an ARexx port. The error would
indicate that the command was successfully sent to the @{" host " link ARx_Elements3.ag/HOST} but rejected
in that environment. Consult the documentation for the program to which
the command was sent.

The ARexx @{" interpreter " link ARexxGuide.guide/GLOSSARY 117} does not check for valid @{" command " link ARx_Elements3.ag/COMMAND} strings, but
rather sends the command to the @{" current host " link ARx_Elements3.ag/DEFHOST} and generates a
@{" command error " link ARx_Instr3.ag/ERROR} or @{" command failure " link ARx_Instr3.ag/FAILURE} if the host does not recognize the
string.


@endnode
@node ERROR_12 "ARexxGuide | Error codes (12 of 48) | Error 12"
@{fg highlight}Error 12: Error return from function@{fg text}

If an error occurs in a function, ARexx will still attempt to return
control to the calling environment, but with an error condition set.

If the error was caused by an @{" internal " link ARx_Elements3.ag/PROGFUNC} or @{" external function " link ARx_Elements3.ag/EXTFUNC} then the
original (and more informative) error message will often be printed to the
error console before this message is output.


@endnode
@node ERROR_13 "ARexxGuide | Error codes (13 of 48) | Error 13"
@{fg highlight}Error 13: Host environment not found@{fg text}

   "address foo; 'jump hoops'
   +++ Error 13 in line 1: Host environment not found

The error indicates that the @{" current host " link ARx_Elements3.ag/DEFHOST} is not available. The error
will be associated with a @{" command clause " link ARx_Elements3.ag/CMDSTRING} rather than with the @{" ADDRESS " link ARx_Instr.ag/ADDRESS}
instruction that is the real source of the problem.

The ADDRESS instruction changes the current host for a script, but does
not verify that the host is available.

This error can be caused by a misspelled name used as the argument to
ADDRESS. Host names are case-sensitive and must refer either to "COMMAND"
or to a message port open and available on the system at the time the
command is issued. Port names that include lower-case letters must be
enclosed in quotation marks.

To view available ports from a shell, the following ARexx clause can be
used:

   rx "say show('P',,'0a'x)

The AmigaDOS command @{" WaitForPort " link ARx_Cmd.ag/WAITFORPORT} will delay a script until the proper
port has been established by an external program.


@endnode
@node ERROR_14 "ARexxGuide | Error codes (14 of 48) | Error 14"
@{fg highlight}Error 14: Requested library not found@{fg text}

   "call addlib('NoLib',0,-30,0); say foo()
   +++ Error 14 in line 1: Requested library not found

The error is triggered when one of the @{" libraries " link ARx_Elements3.ag/LIBFUNC} on the interpreter's
resource list could not be loaded. This error will be associated with a
function call rather than with the @{" ADDLIB() " link ARx_Func3.ag/ADDLIB()} function that is the real
source of the problem.

This error can occur in a different script since library names remain on
the list even after the program that put them there exits. Use the
AmigaDOS command @{" RXLIB " link ARx_Cmd.ag/RXLIB} or the instruction `SAY @{" SHOW('L') " link ARx_Func2.ag/SHOW()}' to list
ARexx libraries. Compare the listed libraries to a listing of the libs:
directory. Library names are case-sensitive.

Remove incorrect library names with the @{" REMLIB() " link ARx_Func3.ag/REMLIB()} function.


@endnode
@node ERROR_15 "ARexxGuide | Error codes (15 of 48) | Error 15"
@{fg highlight}Error 15: Function not found@{fg text}

   "call 10 + 12
   +++ Error 15 in line 1: Function not found

   "x= foo()
   +++ Error 15 in line 1: Function not found

The error is sometimes caused by failure to use the @{" ADDLIB() " link ARx_Func3.ag/ADDLIB()} function or
@{" RXLIB " link ARx_Cmd.ag/RXLIB} command to add an @{" external library " link ARx_Elements3.ag/EXTFUNC} to the list of function hosts
searched by the interpreter. It might also indicate that an invalid name
is included in the library list, since such a name will interfere with
valid calls to functions in libraries loaded after the invalid name was
added. Remove the invalid name with remlib() to correct the situation.

If an @{" internal function " link ARx_Elements3.ag/PROGFUNC} was invoked, a typo in the @{" label " link ARx_Elements3.ag/LABEL} would cause
this error. Misplaced quotation marks can sometimes cause a label to
become invisible to the @{" interpreter " link ARexxGuide.guide/GLOSSARY 117}. (See @{" Error 9 " link ERROR_9}.)

If an @{" external function " link ARx_Elements3.ag/EXTFUNC} was invoked, this error indicates that the
interpreter could not find the program within the @{" ARexx search path " link ARx_Cmd.ag/RX 9}.
Even if it is called as a function, a script must begin with @{" comment " link ARx_Elements.ag/COMMENT}
tokens if it is to be recognized.


@endnode
@node ERROR_16 "ARexxGuide | Error codes (16 of 48) | Error 16"
@{fg highlight}Error 16: Function did not return value@{fg text}

   "say Func(); exit; Func: return
   +++ Error 16 in line 1: Function did not return value

@{" Functions " link ARx_Elements3.ag/FUNCTION} must return a value of some kind to the calling environment.
The error will be reported if control is passed back to the caller by an
@{" internal " link ARx_Elements3.ag/PROGFUNC} or @{" external function " link ARx_Elements3.ag/EXTFUNC} using @{" RETURN " link ARx_Instr3.ag/RETURN} or @{" EXIT " link ARx_Instr.ag/EXIT} without a value.

It is good practice to add at least a "0" to all RETURN and EXIT
instructions.


@endnode
@node ERROR_17 "ARexxGuide | Error codes (17 of 48) | Error 17"
@{fg highlight}Error 17: Wrong number of arguments@{fg text}

   "say right(34)
   +++ Error 17 in line 1: Wrong number of arguments

Although functions often include optional arguments that may be omitted,
this error is triggered if an argument required by a @{" built-in " link ARx_Elements3.ag/BLTFUNC} or
@{" library function " link ARx_Elements3.ag/LIBFUNC} is missing or if more arguments are included than
allowed by the function definition.

See the @{" Functions Reference " link ARX_FUNC.AG/MAIN} chapter for arguments templates for each
built-in and @{" rexxsupport.library " link ARx_Func.ag/RXSPTLIB} function.


@endnode
@node ERROR_18 "ARexxGuide | Error codes (18 of 48) | Error 18"
@{fg highlight}Error 18: Invalid argument to function@{fg text}

   "say right(2,'word')
   +++ Error 18 in line 1: Invalid argument to function

The error usually occurs when a non-numeric value is used in an argument
slot that requires a @{" number " link ARx_Elements2.ag/NUMBER}, but the error might also indicate some
other @{" datatype " link ARx_Elements2.ag/VARTYPE} mismatch.


@endnode
@node ERROR_19 "ARexxGuide | Error codes (19 of 48) | Error 19"
@{fg highlight}Error 19: Invalid PROCEDURE@{fg text}

   "startover: procedure; say "Begin"
   +++ Error 19 in line 1: Invalid PROCEDURE

The @{" PROCEDURE " link ARx_Instr3.ag/PROCEDURE} instruction can be used only within a @{" subroutine " link ARexxGuide.guide/GLOSSARY 248}. This
error will be triggered if program flow falls through to a subroutine
because of a missing @{" exit " link ARx_Instr.ag/EXIT} or @{" return " link ARx_Instr3.ag/RETURN} instruction in the preceding
section.


@endnode
@node ERROR_20 "ARexxGuide | Error codes (20 of 48) | Error 20"
@{fg highlight}Error 20: Unexpected THEN or WHEN@{fg text}

   "if a=a then say 'Yes'; then say 'Equivalent'
   Yes
   +++ Error 20 in line 1: Unexpected THEN or WHEN

The subkeyword @{" THEN " link ARx_Instr.ag/THEN} may be used only within an @{" IF " link ARx_Instr.ag/IF} or @{" WHEN " link ARx_Instr3.ag/WHEN}
instruction. WHEN may be used only within a SELECT instruction. This error
sometimes indicates that the conditional expression used in the primary
instruction is improperly formed.


@endnode
@node ERROR_21 "ARexxGuide | Error codes (21 of 48) | Error 21"
@{fg highlight}Error 21: Unexpected ELSE or OTHERWISE@{fg text}

   "if a=b then say 'Yes'
    say 'Equivalent'
    else say 'Not'

   Equivalent
   +++ Error 21 in line 1: Unexpected ELSE or OTHERWISE

The secondary keyword @{" ELSE " link ARx_Instr.ag/ELSE} may be used only within an @{" IF " link ARx_Instr.ag/IF} instruction.
@{" OTHERWISE " link ARx_Instr3.ag/OTHERWISE} may be used only as the final @{" clause " link ARx_Elements3.ag/CLAUSE} in a @{" SELECT " link ARx_Instr3.ag/SELECT}
instruction. This error will be set if the words appear as @{" keywords " link ARexxGuide.guide/GLOSSARY 135} in
any other situation.

As in the example above, the error is sometimes set when multiple clauses
following an IF instruction are not enclosed within a @{" DO/END " link ARx_Instr.ag/DO} block.


@endnode
@node ERROR_22 "ARexxGuide | Error codes (22 of 48) | Error 22"
@{fg highlight}Error 22: Unexpected BREAK, LEAVE or ITERATE@{fg text}

   "do 2; say 'Hi'; end; iterate;
   Hi
   Hi
   +++ Error 22 in line 1: Unexpected BREAK, LEAVE or ITERATE

@{" LEAVE " link ARx_Instr.ag/LEAVE} and @{" ITERATE " link ARx_Instr.ag/ITERATE} may be used only within an @{" iterative " link ARexxGuide.guide/GLOSSARY 127} DO loop.
@{" BREAK " link ARx_Instr.ag/BREAK} may be used in any DO block or in an INTERPRET statement. Use of
the instructions in other situations will cause this error.


@endnode
@node ERROR_23 "ARexxGuide | Error codes (23 of 48) | Error 23"
@{fg highlight}Error 23: Invalid statement in SELECT@{fg text}

   "select; say 'Choosing...';
   +++ Error 23 in line 1: Invalid statement in SELECT

All clauses within a @{" SELECT " link ARx_Instr3.ag/SELECT} instruction (between the SELECT keyword and
the closing @{" END " link ARx_Instr.ag/END}) must be associated with @{" WHEN " link ARx_Instr3.ag/WHEN} or @{" OTHERWISE " link ARx_Instr3.ag/OTHERWISE} clause.

This error is often caused by failure to use a @{" DO/END " link ARx_Instr.ag/DO} construction with
multiple clauses in a WHEN instruction. It might also be generated when
instructions typed on the @{" trace console " link ARx_Cmd.ag/TCO} are interpreted as an invalid
part of a SELECT instruction.


@endnode
@node ERROR_24 "ARexxGuide | Error codes (24 of 48) | Error 24"
@{fg highlight}Error 24: Missing or multiple THEN@{fg text}

   "if foo=boo;
   +++ Error 24 in line 1: Missing or multiple THEN

   "select;otherwise;end;
   +++ Error 24 in line 1: Missing or multiple THEN

The @{" conditional expression " link ARx_Elements3.ag/CONDITIONAL} in each @{" IF " link ARx_Instr.ag/IF} or @{" WHEN " link ARx_Instr3.ag/WHEN} clause must be
followed by the secondary keyword @{" THEN " link ARx_Instr.ag/THEN}, which is a valid keyword only
when associated with IF or WHEN.

An error in the IF conditional is usually trapped as @{" Error 46 " link ERROR_46}.


@endnode
@node ERROR_25 "ARexxGuide | Error codes (25 of 48) | Error 25"
@{fg highlight}Error 25: Missing OTHERWISE@{fg text}

   "select;end;
   +++ Error 25 in line 1: Missing @{" OTHERWISE " link ARx_Instr3.ag/OTHERWISE}

This error is caught only if all @{" WHEN " link ARx_Instr3.ag/WHEN} clauses have been exhausted
without a match.


@endnode
@node ERROR_26 "ARexxGuide | Error codes (26 of 48) | Error 26"
@{fg highlight}Error 26: Missing or unexpected END@{fg text}

   "say 'Hi'; end;
   Hi
   +++ Error 26 in line 1: Missing or unexpected END

The range of each @{" DO " link ARx_Instr.ag/DO} or @{" SELECT " link ARx_Instr3.ag/SELECT} instruction must be closed with the
@{" END " link ARx_Instr.ag/END} secondary keyword, which is valid only when associated with DO or
SELECT.

A DO instruction will enclose all @{" clauses " link ARx_Elements3.ag/CLAUSE} within its range until a
matching END is found or until the end of the script. Failure to include
an END to a SELECT range will cause the following clauses to be
interpreted as part of the @{" OTHERWISE " link ARx_Instr3.ag/OTHERWISE} range.

This error will often occur at the end of a script, indicating that a
larger-than-intended range of clauses was included with one of the block
instructions.

The unmatched DO or SELECT can often be found by stepping backwards in a
@{" TRACE " link ARx_Instr3.ag/TRACE} output. For that purpose, the minimal output of TRACE A is
usually adequate.

A misplaced quotation mark that is not trapped by @{" error 5 " link ERROR_5} or @{" error 9 " link ERROR_9}
is sometimes indicated by this error. That happens when the opening DO or
SELECT keyword or the closing END is enclosed in the spanning literal
string and therefore invisible. A @{" TRACE " link ARx_Instr3.ag/TRACE} of the code will show missing
lines of code or will show a string that includes what should be clauses.


@endnode
@node ERROR_27 "ARexxGuide | Error codes (27 of 48) | Error 27"
@{fg highlight}Error 27: Symbol mismatch@{fg text}

This error is infrequently generated by ARexx, but may be triggered by a
@{" library " link ARx_Elements3.ag/LIBFUNC} function. It indicates that a @{" symbol " link ARx_Elements.ag/SYMBOL} used in a clause is not
of the expected type.


@endnode
@node ERROR_28 "ARexxGuide | Error codes (28 of 48) | Error 28"
@{fg highlight}Error 28: Invalid DO syntax@{fg text}

   "do 5 to 6
   +++ Error 28 in line 1: Invalid DO syntax

The error is often generated by failure to use an @{" index variable " link ARx_Instr.ag/DOOPT2 8} when
the @{" TO " link ARx_Instr.ag/DOOPT2 50} subkeyword is used in a @{" DO " link ARx_Instr.ag/DO} instruction, but other errors in
a @{" DO " link ARx_Instr.ag/DO} instruction will also trigger this error.


@endnode
@node ERROR_29 "ARexxGuide | Error codes (29 of 48) | Error 29"
@{fg highlight}Error 29: Incomplete IF or SELECT@{fg text}

   "if foo=boo then;
   +++ Error 29 in line 1: Incomplete IF or SELECT

The error usually indicates that a @{" clause " link ARx_Elements3.ag/CLAUSE} is not bound to a @{" THEN " link ARx_Instr.ag/THEN}
keyword. Failure to include a @{" conditional expression " link ARx_Elements3.ag/CONDITIONAL} will be trapped by
@{" Error 45 " link ERROR_45}.

During program development, it may be useful to include an incomplete IF
instruction. That can be done by using the @{" NOP " link ARx_Instr.ag/NOP} keyword as the THEN
clause or by using an empty @{" DO/END " link ARx_Instr.ag/DO} block:

   Example:
      if foo=boo then nop;
   or
      if foo=boo then do;end;


@endnode
@node ERROR_30 "ARexxGuide | Error codes (30 of 48) | Error 30"
@{fg highlight}Error 30: Label not found@{fg text}

   signal foo
   +++ Error 30 in line 1: Label not found

The error is almost always generated by a @{" SIGNAL " link ARx_Instr3.ag/SIGNAL} instruction, since
invalid @{" function " link ARx_Elements3.ag/FUNCTION} calls are discovered by other means and generate
@{" Error 15 " link ERROR_15}.

When any of the SIGNAL instructions are used, a @{" label " link ARx_Elements3.ag/LABEL} matching the
signal's name must be included within the script.


@endnode
@node ERROR_31 "ARexxGuide | Error codes (31 of 48) | Error 31"
@{fg highlight}Error 31: Symbol expected@{fg text}

The error occurs when a @{" symbol " link ARx_Elements.ag/SYMBOL} required by an instruction is missing.
It is generated only if the required argument must be a symbol. If the
argument could be a @{" string " link ARx_Elements2.ag/STRINGEXPR} or a @{" keyword " link ARexxGuide.guide/GLOSSARY 135}, then the fault triggered
would be @{" Error 32 " link ERROR_32}, @{" Error 33 " link ERROR_33}, or @{" Error 34 " link ERROR_34}.


@endnode
@node ERROR_32 "ARexxGuide | Error codes (32 of 48) | Error 32"
@{fg highlight}Error 32: Symbol or string expected@{fg text}

   "call
   +++ Error 32 in line 1: Symbol or string expected

Often indicates an incomplete @{" clause " link ARx_Elements3.ag/CLAUSE}. Several keywords require an
@{" expression " link ARx_Elements2.ag/EXPRESSION} and cannot be used in isolation. @{" Error 45 " link ERROR_45} is the more
general form of this error. Error 32 indicates that the missing element
must be either a @{" string " link ARx_Elements2.ag/STRINGEXPR} or a @{" symbol " link ARx_Elements.ag/SYMBOL}.


@endnode
@node ERROR_33 "ARexxGuide | Error codes (33 of 48) | Error 33"
@{fg highlight}Error 33: Invalid keyword@{fg text}

The @{" keyword " link ARexxGuide.guide/GLOSSARY 135} used in the @{" instruction " link ARx_Elements3.ag/INSTRUCTION} is invalid in this context.


@endnode
@node ERROR_34 "ARexxGuide | Error codes (34 of 48) | Error 34"
@{fg highlight}Error 34: Required keyword missing@{fg text}

   "parse value 'Hi world.' Greeting Audience
   +++ Error 34 in line 1: Required keyword missing
   "signal on;
   +++ Error 34 in line 1: Required keyword missing
   "numeric;
   +++ Error 34 in line 1: Required keyword missing

Some @{" instructions " link ARx_Elements3.ag/INSTRUCTION} require a subsidiary @{" keyword " link ARexxGuide.guide/GLOSSARY 135} in certain situations.
This error is generated when one of the expected subkeywords is missing. It
cannot be generated by failure to use a primary keyword since such a clause
would be interpreted as a @{" command " link ARx_Elements3.ag/COMMAND}.

This error is popular with the @{" VALUE " link ARx_Instr2.ag/PARSESRC7} option to @{" PARSE " link ARx_Instr2.ag/PARSE} since that option
requires a sub-subkeyword, WITH. It may also be generated by the @{" NUMERIC " link ARx_Instr2.ag/NUMERIC}
instruction which requires the VALUE subkeyword if a variable is used to
indicate the setting.


@endnode
@node ERROR_35 "ARexxGuide | Error codes (35 of 48) | Error 35"
@{fg highlight}Error 35: Extraneous characters@{fg text}

   options 'Enter a value: '
   +++ Error 35 in line 1: Extraneous characters
   select foo;
   +++ Error 35 in line 1: Extraneous characters
   signal on break_c:;
   +++ Error 35 in line 1: Extraneous characters

This error may indicates a misuse of @{" keywords " link ARexxGuide.guide/GLOSSARY 135} and subkeywords.

In the first example above, the error is generated by failure to include
the required subkeyword, @{" PROMPT " link ARx_Instr2.ag/OPTIONS 12}, with the @{" OPTIONS " link ARx_Instr2.ag/OPTIONS} instruction. In the
second example, an expression is included after the @{" SELECT " link ARx_Instr3.ag/SELECT} keyword which
must stand alone in a clause. (Future extensions to REXX may allow use of
an @{" expression " link ARx_Elements2.ag/EXPRESSION} with SELECT, but it is not yet a valid syntax.) The error
in the third line is generated by the `:' following the error-trap name.
Colons may be used only as part of a @{" label " link ARx_Elements3.ag/LABEL}.

The error will also occur when a @{" token " link ARx_Elements.ag/TOKEN} that is otherwise valid is used
in an improper context:

   say  copies('-', PrdWd-1), copies('-', CdWd-1)
   +++ Error 35 in line 13: Extraneous characters

The extra comma after the first copies() function would be valid as a
@{" continuation token " link ARx_Elements.ag/COMMA} if the line were split into two parts at that point,
but is not valid in this circumstance.


@endnode
@node ERROR_36 "ARexxGuide | Error codes (36 of 48) | Error 36"
@{fg highlight}Error 36: Keyword conflict@{fg text}

Two or more @{" keywords " link ARexxGuide.guide/GLOSSARY 135} that are valid in isolation are combined in an
invalid way in the @{" instruction " link ARx_Elements3.ag/INSTRUCTION}.


@endnode
@node ERROR_37 "ARexxGuide | Error codes (37 of 48) | Error 37"
@{fg highlight}Error 37: Invalid template@{fg text}

   "parse var;
   +++ Error 37 in line 1: Invalid template

The error is always associated with a @{" PARSE " link ARx_Instr2.ag/PARSE} instruction. The various
source-string options impose different requirements on the @{" template " link ARx_Instr2.ag/PARSETMP1}. In
the example above, for instance, a error results from failure to specify a
template with the @{" VAR " link ARx_Instr2.ag/PARSESRC8} source string. It is, on the other hand, valid to
omit the template with the @{" PULL " link ARx_Instr3.ag/PULL} source string keyword.

The error may also result from improper use of @{" template variables " link ARx_Instr2.ag/PARSETMP5}.


@endnode
@node ERROR_38 "ARexxGuide | Error codes (38 of 48) | Error code 38"
   Error code 38 is not used.


@endnode
@node ERROR_39 "ARexxGuide | Error codes (39 of 48) | Error 39"
@{fg highlight}Error 39: Uninitialized variable@{fg text}

This error is not generated by ARexx under any known condition. Use of
uninitialized @{" variable " link ARx_Elements2.ag/VARIABLE} is not normally an error. Even when the SIGNAL ON
@{" NOVALUE " link ARx_Instr3.ag/NOVALUE} trap is set, the interpreter passes control to the NOVALUE:
subroutine without setting this error.

The user code within a NOVALUE subroutine, or an external function library
might make use of this error code and message.


@endnode
@node ERROR_40 "ARexxGuide | Error codes (40 of 48) | Error 40"
@{fg highlight}Error 40: Invalid variable name@{fg text}

This error is rarely generated because the @{" interpreter " link ARexxGuide.guide/GLOSSARY 117} will treat the
value in some other (and probably unintended) way.

`3var = "Hi"' is an invalid @{" assignment clause " link ARx_Elements3.ag/ASSIGNMENT} since `3Var' is not a
valid @{" variable name " link ARx_Elements.ag/VARSYMBOL}, but the interpreter will not trap the error: The
clause would be evaluated as a @{" logical expression " link ARx_Elements3.ag/CONDITIONAL}. The result, 0, would
be sent as a @{" command string " link ARx_Elements3.ag/CMDSTRING} to the default host.

Other situations where an invalid variable name are used are similarly
hidden under different errors:

         "do 3boo = 7 to 9; say 3boo; end
         +++ Error 28 in line 1: Invalid DO syntax

         "parse value 'hi there' with 6greet 6who
         +++ Error 47 in line 1: Arithmetic conversion error


@endnode
@node ERROR_41 "ARexxGuide | Error codes (41 of 48) | Error 41"
@{fg highlight}Error 41: Invalid expression@{fg text}

   "say 2+3+;
   +++ Error 41 in line 1: Invalid expression
   say exists(help:arx/arx_elements.ag)
   +++ Error 41 in line 1: Invalid expression

This error is often associated with an invalid use of @{" operator " link ARx_Elements3.ag/OPERATION}
characters.

The characters representing operators are @{" reserved " link ARexxGuide.guide/GLOSSARY 206}: They can be used
only for their defined purposes and are invalid in other contexts. This
sometimes presents a problem when @{" commands " link ARx_Elements3.ag/COMMAND} are used without enclosing
quotation marks. If operator characters (like the `/' used in Amiga file
names) are included within a clause, ARexx will attempt to perform the
indicated operation and generate error 41 in the process.

The second error occurred because the AmigaDOS file name uses the division
character. To avoid such errors, quotation marks should enclose all
strings -- including command clauses -- that are not meant to be evaluated.

   Also see @{" Error 47     " link ERROR_47}

@endnode
@node ERROR_42 "ARexxGuide | Error codes (42 of 48) | Error 42"
@{fg highlight}Error 42: Unbalanced parentheses@{fg text}

   say right(trunc(Num,2),6
   +++ Error 42 in line 1: Unbalanced parentheses

Each opening @{" parenthesis " link ARx_Elements.ag/PAREN} in ARexx must be paired with a closing
parenthesis. Unlike @{" Error 5 " link ERROR_5}, this error is detected only when ARexx
attempts to interpret the offending expression.


@endnode
@node ERROR_43 "ARexxGuide | Error codes (43 of 48) | Error 43"
@{fg highlight}Error 43: Expression nesting >32@{fg text}

A maximum of 32 @{" expressions " link ARx_Elements2.ag/EXPRESSION} may be nested in a single @{" clause " link ARx_Elements3.ag/CLAUSE}. This
limit applies only to nested expressions and not to the number of terms
that can be used in a single expression.

It is valid, for instance, to add hundreds of numbers or to concatenate
hundreds of strings in a single expression. This error occurs only when
subexpressions (usually indicated by parentheses) are nested within
other expressions.

The error might be caused by a complex set of @{" functions " link ARx_Elements3.ag/FUNCTION} that used the
results of other functions as arguments


@endnode
@node ERROR_44 "ARexxGuide | Error codes (44 of 48) | Error 44"
@{fg highlight}Error 44: Invalid expression result@{fg text}

   "numeric fuzz 10;
   +++ Error 44 in line 1: Invalid expression result

The error is triggered when an otherwise valid @{" expression " link ARx_Elements2.ag/EXPRESSION} yields a
result that is invalid in the current context.

In the example above, the expression, `10', used with @{" NUMERIC " link ARx_Instr2.ag/NUMERIC} FUZZ is
greater than the current setting of NUMERIC DIGITS, which is not allowed.


@endnode
@node ERROR_45 "ARexxGuide | Error codes (45 of 48) | Error 45"
@{fg highlight}Error 45: Expression required@{fg text}

   "if;
   +++ Error 45 in line 1: Expression required
   "signal;
   +++ Error 45 in line 1: Expression required

The error is triggered when an @{" instruction " link ARx_Elements3.ag/INSTRUCTION} requires further information
that is not provided.

A @{" conditional expression " link ARx_Elements3.ag/CONDITIONAL} must be used with @{" IF " link ARx_Instr.ag/IF} and @{" WHEN " link ARx_Instr3.ag/WHEN} instructions.
This error will result if there is no @{" expression " link ARx_Elements2.ag/EXPRESSION} of any kind. @{" Error 46 " link ERROR_46}
results when an expression is included, but it does not yield a @{" Boolean " link ARexxGuide.guide/GLOSSARY 19}
value.


@endnode
@node ERROR_46 "ARexxGuide | Error codes (46 of 48) | Error 46"
@{fg highlight}Error 46: Boolean value not 0 or 1@{fg text}

   "if boo then say hi
   +++ Error 46 in line 1: Boolean value not 0 or 1
   "say boo & foo
   +++ Error 46 in line 1: Boolean value not 0 or 1

The error often occurs when an @{" expression " link ARx_Elements2.ag/EXPRESSION} used with a conditional
statement, such as @{" IF " link ARx_Instr.ag/IF} or @{" WHEN " link ARx_Instr3.ag/WHEN}, is not properly formatted. Only a
@{" conditional expression " link ARx_Elements3.ag/CONDITIONAL} is valid.

Some functions, such as @{" SHOW() " link ARx_Func2.ag/SHOW()} and @{" ARG() " link ARx_Func3.ag/ARG()}, can be used as conditional
expressions, but only if the proper arguments are supplied.


@endnode
@node ERROR_47 "ARexxGuide | Error codes (47 of 48) | Error 47"
@{fg highlight}Error 47: Arithmetic conversion error@{fg text}

   "say boo + foo
   +++ Error 47 in line 1: Arithmetic conversion error

This is a common error in ARexx since the language treats all values as
@{" strings " link ARx_Elements2.ag/STRINGEXPR} until they are used in an @{" arithmetic operation " link ARx_Operator.ag/ARITHMETIC}. If a value
used in an arithmetic operation cannot be translated to a valid @{" number " link ARx_Elements2.ag/NUMBER},
this error is generated.

The error may be triggered by failure to use quotation marks in a filename
since the "/" character in Amiga filenames is the division operator in
ARexx. ARexx will treat the two parts of the filename as @{" variables " link ARx_Elements2.ag/VARIABLE} and
attempt to divide them. It generates this error because the variables
could not be interpreted as valid number.

   Also see: @{" Basic elements: Numbers as text " link ARx_Elements2.ag/NUMASTEXT}


@endnode
@node ERROR_48 "ARexxGuide | Error codes (48 of 48) | Error 48"
@next MAIN
@{fg highlight}Error 48: Invalid operand@{fg text}

   "say 3/0
   +++ Error 48 in line 1: Invalid operand

The error usually indicates a divide-by-zero error. Most arithmetic errors
other than divide-by-zero will be trapped as @{" Error 47 " link ERROR_47}.


@endnode
