EXECUTE

EXECUTE [REPEAT]   program-name   [library-id]

program-name [parameter ...]

This command is used to execute a Natural object module of type program. The object module must have been cataloged (that is, stored in object form) in the Natural system file or linked to the Natural nucleus. The execution of an object module does not affect the source code currently in the editor work area.

This document covers the following topics:


Syntax Explanation

EXECUTE The keyword EXECUTE is optional; it is sufficient to specify program-name, i.e., the name of the program to be executed.
REPEAT If the program being executed produces multiple screen output and you wish the screens to be output one after another without intervening prompts, you specify the keyword REPEAT together with the keyword EXECUTE.
program-name The name of the program to be executed. If you do not specify a library-id, Natural can only execute the specified program if it is stored either in your current library or in the current steplib library (the default steplib is SYSTEM).
library-id

If the program is stored in another library, specify the library-id of that library. In this case, the program can only be executed if it is actually stored in the specified library.

A library-id that begins with SYS must not be specified (except SYSTEM).

parameter

When you execute a program by specifying the program name without the keyword EXECUTE, you may pass parameters to the program. These parameters will be read by the first INPUT statement in the executed program.

You can specify the parameters as positional parameters or as keyword parameters, with the individual specifications separated from one another by blanks or the input delimiter character (as specified with the session parameter ID).

Note:
If one of the parameters passed contains blanks or is a string which contains blanks, the transfer will only be executed if directly after the program name an input delimiter is set.

Examples of EXECUTE Command

EXECUTE PROG1
EXECUTE PROG1 ULIB1
PROG1
PROG1 VALUE1 VALUE2 VALUE3
PROG1 VALUE1, VALUE2, VALUE3
PROG1 PARM1=VALUE1, PARM2=VALUE2, PARM3=VALUE3
PROG1 PARM3=VALUE3 PARM1=VALUE1 VALUE2
PROG1,ab cd ef,gh,de fg,ab