11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ArgumentspcAn optional postconditional expression that can make the command conditional. If the postconditionalexpression is appended to the GOTO command keyword, <strong>Caché</strong> executes theGOTO command if the postconditional expression is true (evaluates to a non-zero numericvalue). <strong>Caché</strong> does not execute the GOTO command if the postconditional expression isfalse (evaluates to zero). If the postconditional expression is appended to an argument, <strong>Caché</strong>executes the argument if the postconditional expression is true (evaluates to a non-zeronumeric value). If the postconditional expression is false (evaluates to zero), <strong>Caché</strong> skips thatargument and evaluates the next argument (if there is one) or the next command. For furtherdetails, refer to Command Postconditional Expressions in Using <strong>Caché</strong> <strong>ObjectScript</strong>.locationThe point to which control will be transferred. It is required in routine code. It is optionalfrom the programmer prompt. You can specify location as a single value or as a commaseparatedlist of values (with postconditionals) and can take any of the following forms:label+offset specifies a line label within the current routine. The optional +offset is a nonnegativeinteger that specifies the number of lines after the label at which execution is to start.label+offset^routine specifies a line label within the named routine, which resides on disk.<strong>Caché</strong> loads the routine from disk and continues execution at the indicated label. The optional+offset is a nonnegative integer that specifies the number of lines after the label at whichexecution is to start.^routine specifies a routine that resides on disk. <strong>Caché</strong> loads the routine from disk and continuesexecution at the first line of executable code within the routine. If you specify a nonexistentroutine, <strong>Caché</strong> issues a error message. For more information, referto the $ZERROR special variable.You can also reference location as a variable containing any of the above forms. In this case,though, you must use name indirection. location cannot specify a subroutine label that isdefined with a formal parameter list or the name of a user-defined function or procedure. Ifyou specify a non-existent label, <strong>Caché</strong> issues a error message. For more information,refer to Indirection in Using <strong>Caché</strong> <strong>ObjectScript</strong>.ExampleGOTOIn the following example, the GOTO directs execution to one of three locations dependingon the user-supplied age value. The location is a subroutine label that is stored in variableloc and then referenced by means of name indirection (@loc).<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!