Application Tools

In this section:

An application program may be as simple as a TABLE FILE ... END request or as elaborate as a series of replaceable variables (know as amper variables) controlled by dynamic inputs, goto statements, and/or looping logic (known collectively as Dialogue Manager). While Dialogue Manager is fully detailed in the Stored Procedure Reference manual, a limited set of these commands and tools are also noted here due to their integral use in APP management.


Top of page

x
EX Procedure and Amper Variables

In this section:

The EX procedure executes another procedure, as found on the application path. The procedure extension (on non-PDS platforms) is not required, and is assumed to be .fex. The full syntax is:

EX[EX] [appname/]procedure[.fex] [parameter=value[,parameter=value][,...]

Parameters may be names (such as LASTNAME) or numeric (such as 1), and may be mixed within the list. A specific APP name can be referenced and does not require the APP to be on the application path prior to execution. Numerics can also be assumed positionally, as in this example:

EX mytest DETAIL=ALL,QUARTERLY,PERSON=JAMES MADISON,5=MANAGER

and the procedure would contain amper variables (parameters) for &DETAIL, &2, and &PERSON, and would use the context of:

TABLE FILE ...
WHERE PERSON IS '&PERSON' AND PERIOD EQ '&2' 
...
END

Amper variables names may be up to 100 characters. There are two types of amper variables, single and double. Single amper variables are only active within the procedure they are created in. Double amper variables are good for the life of the session. Additionally, there are predefined, single amper variables, such as &LINES (records returned from a request), &FOCUSER (current user ID), &FOCFOCEXEC (name of the current executing procedure), &FOCCODEPAGE (the server NLS code page), and many others. See the Stored Procedure Reference manual for a detailed listing of other pre-defined amper variables.



x
EX EDADEL

EDADEL deletes the first found instance of a file. It is useful when the specific APP name is not known.

The syntax is:

EX EDADEL filetype,filename[,IFEXIST]

The IFEXIST option checks for the existence of the file before attempted to delete in order to suppress not found error messages. A failure to delete while using the IFEXIST option usually means that a permission problem occurred during the attempted deletion.



x
EX EDAPUT

EDAPUT allows you to insert text in a file. The text may be a static string or a string containing one or more amper variables, and it may extend onto any number of lines. This is useful in a number of situations, such as dynamically creating metadata or forming the body of an e-mail in a text file for use with the EDAMAIL feature.

The syntax is:

EX -LINES {n|*} EDAPUT filetype,[app/]filename,format,location,
...
[EDAPUT*]

where:

n

Denotes the number of lines, including the EDAPUT Line and excluding blank lines (deprecated feature). Do not use with the EDAPUT* option.

*

Denotes that all lines are inserted in the specified file until EDAPUT* is encountered.

filetype

Is the type of file, for example MASTER, FOCEXEC, ACCESS, and so on.

app

Is the APP directory (optional).

filename

Is the name of the file without the extension.

format

Is the format. The values are:

CV. Create variable.

C. Create fixed.

A. Append.

location

Is the location. The values are:

FILE. Write to disk location.

MEM. Write to memory.

EDAPUT*

Required syntax when using the -LINES * option (all lines until EDAPUT* encountered).



x
EX EDAMAIL

E-mails can be sent from a procedure with the content of a specific file included in the e-mail body or as an attachment. This is useful for sending e-mail alerts for events ranging from special error conditions to simple report completion. EDAMAIL requires a configured e-mail SMTP Server node for the server workspace.

The syntax is:

EX EDAMAIL to, from, subject, [flag], filetype, data

where:

to

Is the e-mail recipient. Use a semi-colon as a separator for multiple recipients.

from

Is the e-mail sender.

subject

Is the e-mail subject.

flag

If set to a or A, the file is sent as an attachment. Otherwise, it is included as the body of the e-mail. All other values are ignored. The value is also ignored if filetype is empty.

filetype

Defines the data file type for an e-mail message body that uses a file. Any application file type is valid, including MASTER, FOCEXEC, HTML, TEXT, and so on. Leave the parameter empty to use the inline e-mail message body feature.

data

Is the inline e-mail message body or [app/]filename file containing the e-mail message body. The EDAMAIL feature may also be used with the -LINES {n|*} feature to spread an inline e-mail message body on to multiple lines with the procedure, but use of this feature also requires that the filetype parameter be empty.

If an inline message body is spread across multiple lines in the procedure, the resulting email is a single line of output. Multi-line message bodies are respected when the message body from a file option is used.



Example: Mailing an HTML File as Message Body
TABLE FILE foo
PRINT A B C
ON TABLE HOLD AS MYFILE FORMAT HTML
END
EX EDAMAIL  foo@foocorp.com, foo@foocorp.com, Foo Report,,HTML, MYFILE


Example: Mailing an HTML File as a Message Attachment
TABLE FILE foo
PRINT A B C
ON TABLE HOLD AS MYFILE FORMAT HTML
END
EX EDAMAIL  foo@foocorp.com, foo@foocorp.com, Foo Report,a,HTML, MYFILE


Example: Mailing a Multi-line Inline Message
...
EX -LINES * EDAMAIL foo@foocorp.com, foo@foocorp.com, &SUBJECT,,, 
    Run result for &TESTNAME is:
&RESULT
EDAMAIL*

iWay Software