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

The :PROCESS and :END PROCESS script statements define the beginning and end of a loop for processing a data sequence line by line. Data sequences are contents of a sequential file, or the text result of a command. A new line is read in each cycle until the loop finishes or is explicitly terminated with the :TERM_PROCESS statement.

Use the following script functions to create data sequences:

Syntax

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

Parameters

Important! An empty data sequence means that the processing in the loop (between the :PROCESS and :ENDPROCESS statements) is not performed. You do not receive an error message.

Note: To reuse the script variable that contains the data sequence reference, discard the data sequence with the :CLOSE_PROCESS script statement before you assign a new value to the script variable.

Tip: Use the GET_PROCESS_LINE script function to retrieve the content of a particular line in the process.

Example

The following example retrieves the directories of a disk drive and writes the results to the activation report. This script includes a condition that terminates the loop if the &USER# script variable has a particular value.

: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:

seealso

Script Elements for Data Sequences