:PROCESS... :TERM_PROCESS... :ENDPROCESS

Script Statements: They are used to define a loop for the line by line processing of a data sequence such as the content of a sequential file or the text result of a command.

Syntax

:PROCESS Data sequence reference
[Statement]
:TERM_PROCESS
:ENDPROCESS
:CLOSE_PROCESS

Syntax

Description/Format

:PROCESS

The beginning of the loop.

Data sequence reference

The reference to a data sequence that should be processed.
Format: script variable

Statements

One or more statements that will be processed during every processing cycle: script statement

:TERM_PROCESS

A statement to exit the loop.

:ENDPROCESS

The end of the loop.

:CLOSE_PROCESS

Frees the handle after each :PROCESS - :ENDPROCESS loop.

Comments

The script statements :PROCESS and :ENDPROCESS facilitate the line-by-line processing of data sequences. They are provided by the following script elements:

A new line is read in every cycle. This is repeated until the loop is either finished or explicitly terminated using the script statement :TERM_PROCESS.

You can use the script function GET_PROCESS_LINE in order to retrieve the contents of a line.

An empty data sequence does not cause an error message. In this case, the processing of the data sequence that is defined between :PROCESS and :ENDPROCESS does not take place.

Example

The following example retrieves the directories of a disk drive and writes the results to the activation report using the :PRINT statement. It includes a :TERM_PROCESS statement to exit the loop if the value of the USER variable is TSOS.

:SET &HND# = PREP_PROCESS("PC01","WINCMD","*DIR*","CMD=DIR C:")
:
PROCESS &HND#
:   SET &LINE# = GET_PROCESS_LINE(&HND#)
:    IF &USER# = "TSOS" 
:      TERM_PROCESS
:   ENDIF
:   
PRINT &LINE#
:
ENDPROCESS
:CLOSE_PROCESS &HND#

See also:

Script Elements - Data Sequences

Sample Collection
Setting End Status depending on Report Content

Calling an MBean

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function