Difference between revisions of "DO"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Purpose==
+
''[[DO Commands|DO ... commands]]''
Execute a Recital procedure, program or stored procedure
+
  
 +
==Purpose==
 +
Execute a Lianja procedure, program or stored procedure
  
 
==Syntax==
 
==Syntax==
Line 9: Line 10:
  
 
[WITH <array> [,<array>]...]
 
[WITH <array> [,<array>]...]
 
  
 
==See Also==
 
==See Also==
[[ALIAS]], [[CERROR()]], [[COMPILE]], [[DEBUG]], [[DO CASE]], [[DO WHILE]], [[LINK]], [[MODIFY COMMAND]], [[PARAMETERS]], [[PCOUNT()]], [[PROCEDURE]], [[Recital Linker]], [[SET CLIPPER]], [[SET COMPATIBLE]], [[SET PATH]], [[SET PSHARE]]
+
[[CERROR()]], [[COMPILE]], [[DO CASE]], [[DO FORM]], [[DO WHILE]], [[PARAMETERS]], [[PCOUNT()]], [[PROCEDURE]], [[SET PATH]]
 
+
  
 
==Description==
 
==Description==
The DO command is used to execute the Recital/4GL program <.prg filename> or procedure <procedure-name>.  The filename or procedure name can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.  If no file extension is specified then '.prg' is used.  If the full path is not given, the file is assumed to be in the current directory.  The path (SET PATH) will also be searched it the file is not found in the current directory.  When a program encounters an end of file or a RETURN statement, control returns back to the calling program.  Control returns back to the keyboard if the <.prg filename> was called from interactive command mode.
+
The DO command is used to execute the Lianja program <.prg filename> or procedure <procedure-name>.  The filename or procedure name can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.  If no file extension is specified then '.prg' is used.  If the full path is not given, the file is assumed to be in the current directory.  The path (SET PATH) will also be searched it the file is not found in the current directory.  When a program encounters an end of file or a RETURN statement, control returns back to the calling program.  Control returns back to the keyboard if the <.prg filename> was called from interactive command mode.
 
+
Program files can be linked together if required, using the LINK command or the 'dbl' Recital linker utility.
+
  
 
====WITH <parameter> | <array>====
 
====WITH <parameter> | <array>====
 
You may optionally pass parameters including arrays to the called program.  Parameters passed using the DO WITH <parameters> syntax are passed by reference and can be changed by the called procedure.  Procedures can also be called using function syntax procedure(parameter1,parameter2…), in which case the parameters are passed by value and cannot be changed by the called procedure.   
 
You may optionally pass parameters including arrays to the called program.  Parameters passed using the DO WITH <parameters> syntax are passed by reference and can be changed by the called procedure.  Procedures can also be called using function syntax procedure(parameter1,parameter2…), in which case the parameters are passed by value and cannot be changed by the called procedure.   
  
Procedures expecting parameters should have a PARAMETERS statement as the first executable statement after the procedure declaration.  The number of parameters passed to a procedure can be checked using the PCOUNT() function. If CLIPPER is set ON and not all parameters are passed, the variables in the PARAMETERS command not passed will be defined as undefined, type "U" instead of logical .F..
+
Procedures expecting parameters should have a PARAMETERS statement as the first executable statement after the procedure declaration.  The number of parameters passed to a procedure can be checked using the PCOUNT() function.
 
+
  
 
==Example==
 
==Example==
Line 38: Line 34:
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
[[Category:Applications]]
+
[[Category:Libraries]]
[[Category:Applications Commands]]
+
[[Category:User Defined Functions]]

Latest revision as of 10:00, 3 August 2016

DO ... commands

Purpose

Execute a Lianja procedure, program or stored procedure

Syntax

DO <.prg filename> | <procedure-name> | (<expC>)

[WITH <parameter> [,<parameter>]...]

[WITH <array> [,<array>]...]

See Also

CERROR(), COMPILE, DO CASE, DO FORM, DO WHILE, PARAMETERS, PCOUNT(), PROCEDURE, SET PATH

Description

The DO command is used to execute the Lianja program <.prg filename> or procedure <procedure-name>. The filename or procedure name can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename. If no file extension is specified then '.prg' is used. If the full path is not given, the file is assumed to be in the current directory. The path (SET PATH) will also be searched it the file is not found in the current directory. When a program encounters an end of file or a RETURN statement, control returns back to the calling program. Control returns back to the keyboard if the <.prg filename> was called from interactive command mode.

WITH <parameter> | <array>

You may optionally pass parameters including arrays to the called program. Parameters passed using the DO WITH <parameters> syntax are passed by reference and can be changed by the called procedure. Procedures can also be called using function syntax procedure(parameter1,parameter2…), in which case the parameters are passed by value and cannot be changed by the called procedure.

Procedures expecting parameters should have a PARAMETERS statement as the first executable statement after the procedure declaration. The number of parameters passed to a procedure can be checked using the PCOUNT() function.

Example

procedure name
  parameters a,b,c
  a = b*c
return
//
name(a,10,20)
// is equivalent to
do name with a,10,20