RUN [REPEAT ]
operand1
[operand2
[(parameter)]]
40
|
This document covers the following topics:
For explanations of the symbols used in the syntax diagram, see Syntax Symbols.
Belongs to Function Group: Invoking Programs and Routines
The RUN
statement is used to read a Natural source
program from the Natural system file and then execute it.
For Natural RPC: See Notes on Natural Statements on the Server in the Natural RPC (Remote Procedure Call) documentation.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1
|
C | S | A | yes | no | |||||||||||||||
operand2
|
C | S | A | G | A | U | N | P | I | F | B | D | T | L | G | yes | no |
Syntax Element Description:
Syntax Element | Description |
---|---|
REPEAT
|
REPEAT Option:
This feature may be used if the program is to display multiple screens of information without having the user respond to each screen. |
operand1 |
Program Name:
As The program may be stored in the current library or in a
concatenated library (default steplib is The program is read into the source program work area and overlays any current source program. |
operand2
|
Parameters:
The The parameters can be read using an
If more parameters are passed than are read by the next
Note: |
parameter
|
Date Format:
If |
The RUN
statement may be used to dynamically compile
and execute a program for which the source or parts thereof are created
dynamically.
Dynamic source text creation is performed by placing source text
into global variables and then referring to these variables by using an
ampersand (&) instead of a plus sign (+) as the first character of the
variable name in the source text. The content of the global variable will be
interpreted as source text when the program is invoked using the
RUN
statement.
A global variable with index must not be used within a program that
is invoked via a RUN
statement.
It is not allowed to place a comment or an
INCLUDE
statement in a
global variable.
** Example 'RUNEX1': RUN (with dynamic source program creation) ************************************************************************ DEFINE DATA GLOBAL USING RUNEXGDA LOCAL 1 #NAME (A20) 1 #CITY (A20) END-DEFINE * INPUT 'Please specify the search values:' // 'Name:' #NAME / 'City:' #CITY * RESET +CRITERIA /* defined in GDA 'RUNEXGDA' * IF #NAME = ' ' AND #CITY = ' ' REINPUT 'Enter at least 1 value' END-IF * IF #NAME NE ' ' COMPRESS 'NAME' ' =''' #NAME '''' INTO +CRITERIA LEAVING NO END-IF IF #CITY NE ' ' IF +CRITERIA NE ' ' COMPRESS +CRITERIA 'AND' INTO +CRITERIA END-IF COMPRESS +CRITERIA ' CITY =''' #CITY '''' INTO +CRITERIA LEAVING NO END-IF * RUN 'RUNEXFND' * END
** Example 'RUNEXFND': RUN (program executed with RUN in RUNEX1) ************************************************************************ DEFINE DATA GLOBAL USING RUNEXGDA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 NAME 2 CITY END-DEFINE * * &CRITERIA filled with "NAME = 'xxxxx' AND CITY = 'xxxx'" * FIND NUMBER EMPLOY-VIEW WITH &CRITERIA RETAIN AS 'EMP-SET' DISPLAY *NUMBER * END
Global RUNEXGDA Library SYSEXSYN DBID 10 FNR 32 Command > + I T L Name F Length Miscellaneous All -- -------------------------------- - ---------- -------------------------> 1 +CRITERIA A 80