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.

<strong>Caché</strong> <strong>ObjectScript</strong> Commandsthe DO command. Exponent references num and powr and places the calculated value inresult. When Exponent executes the QUIT command, control returns to the WRITE commandimmediately after the DO. The WRITE command outputs the calculated value by referencingresult.Start ; Raise an integer to a specified power.READ !,"Integer= ",num QUIT:num=""READ !,"Power= ",powr QUIT:powr=""DO ExponentWRITE !,"Result= ",result!QUITExponentSET result=numFOR i=1:1:powr-1 { SET result=result*num }QUITIn the following example, DO invokes the Admit() method on the object referred to by pat.The method does not receive parameters or return a value.DO pat.Admit()In the following example, the DO command calls, in succession, the subroutines Init andRead1 in the current routine and the subroutine Convert in routine Test.DO Init,Read1,Convert^TestDO and GOTOThe DO command can be used to invoke a subroutine (with or without parameter passing),a procedure, or an extrinsic function. At the completion of the call, <strong>Caché</strong> executes the nextcommand following the DO command.The GOTO command can only be used to invoke a subroutine without parameter passing.At the completion of the call, <strong>Caché</strong> issues a QUIT, ending execution.DO with Parameter PassingWhen used with parameter passing, DO entryref explicitly passes one or more values to thecalled subroutine, procedure, extrinsic function or object method. The passed values arespecified as a comma-separated list with the param option. With parameter passing, you mustmake sure that the called subroutine is defined with a parameter list. The subroutine definitiontakes the form:>label( param)where label is the label name of the subroutine, procedure, extrinsic function or object method,and param is a comma separated list of one or more unsubscripted local variable names. Forexample,28 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!