Invoking a NATURAL Program

How to:

To invoke a Natural program, you issue a Data Manipulation Language (DML) request, also known as a TABLE command, or an SQL SELECT statement. (DML is the WebFOCUS internal retrieval language.) For information about the Data Manipulation Language, see the Stored Procedure Reference manual.


Top of page

x
Syntax: How to Invoke a NATURAL Program Using TABLE

The syntax for invoking a Natural program using a TABLE command is

TABLE FILE synonym 
PRINT [parameter [parameter] ... | *]
[IF in-parameter EQ value]
  .
  .
  .
END

where:

synonym

Is the synonym of the Natural program you want to invoke.

parameter

Is the name of a parameter whose values you want to display. You can specify input parameters, output parameters, or input and output parameters.

If the stored procedure does not require parameters, enter an * in the syntax. This displays a dummy segment, created during metadata generation, to satisfy the structure of the SELECT statement.

*

Indicates that you want to display all indicated parameters.

IF/WHERE

Is used if you want to pass values to input parameters.

in-parameter

Is the name of an input parameter to which you want to pass a value.

value

Is the value you are passing to an input parameter.



Example: Invoking the Natural Program NATTST Using TABLE
TABLE FILE NATTST
 PRINT PERSONNEL_ID NAME BIRTH SALARY
 IF PERSONNEL_ID_FROM EQ '11111111'
 IF PERSONNEL_ID_TO EQ '11211111'
 IF SALARY NE 0
END

Top of page

x
Syntax: How to Invoke a NATURAL Program Using SELECT

The syntax for invoking a Natural program using a SELECT statement is

SQL
SELECT [parameter [,parameter] ... | *] FROM synonym 
[WHERE in-parameter = value]
  .
  .
  .
END

where:

synonym

Is the synonym of the Natural program you want to invoke.

parameter

Is the name of a parameter whose values you want to display. You can specify input parameters, output parameters, or input and output parameters.

If the stored procedure does not require parameters, enter an * in the syntax. This displays a dummy segment, created during metadata generation, to satisfy the structure of the SELECT statement.

*

Indicates that you want to display all indicated parameters.

WHERE

Is used if you want to pass values to input parameters.

You must specify the value of each parameter on a separate line.

in-parameter

Is the name of an input parameter to which you want to pass a value.

value

Is the value you are passing to an input parameter.



Example: Invoking the Natural Program NATTST Using SQL SELECT
SQL
 SELECT PERSONNEL_ID, NAME, BIRTH, SALARY
  FROM NATTST
  WHERE PERSONNEL_ID_FROM = '11111111' AND 
  PERSONNEL_ID_TO = '11211111' AND
  SALARY != 0;
END

Top of page

x
Syntax: How to Invoke a NATURAL Program Using EX
EX [app_name_space/]synonym  1=parm1_val,..., N=parmN_val 
EX [app_name_space/]synonym parm1_name=parm1_val,... ,
                            parmN_name=parmN_val 
EX [app_name_space/]synonym [, parm1_val [,...[, parmN_val]]]

where:

app_name_space

Is the apps directory name under which the synonyms are stored. This value is optional.

synonym

Is the user-friendly name of a repository entry that represents the object to be executed in the vendor environment.

parm_name

Is the name of the parameter taken from the input metadata description.

1=parm1_val
N=parmN_val
parm1_name
parm1_val
parmN_val

Are the parameter values that match the input metadata description.

Note:



Example: Invoking the Natural Program NATTST Using EX
SET EXORDER=PGM/FEX
EX NATTST 11111111, 11211111

WebFOCUS