: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:
- PREP_PROCESS
- PREP_PROCESS_AGENTGROUP
- PREP_PROCESS_COMMENTS
- PREP_PROCESS_DOCU
- PREP_PROCESS_FILE
- PREP_PROCESS_FILENAME
- PREP_PROCESS_PROMPTSET
- PREP_PROCESS_REPORT
- PREP_PROCESS_REPORTLIST
- PREP_PROCESS_VAR and PREP_PROCESS_VAR_XML
Syntax
:PROCESS Data sequence reference
[Statement]
:TERM_PROCESS
:ENDPROCESS
:CLOSE_PROCESS
            
Parameters
- 
                    :PROCESS 
 Begins the processing loop
- 
                    Data sequence reference 
 Reference to the data sequence to process
- 
                    Statements 
 One or more script statements that are processed during every cycle
- 
                    :TERM_PROCESS 
 Exits the processing loop
- 
                    :END_PROCESS 
 Ends the processing loop
- 
                    :CLOSE_PROCESS 
 Discards the data sequence
 For more information, see :CLOSE_PROCESS.
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#
                
:    IF &USER# = "TSOS" 
:      TERM_PROCESS
:   ENDIF
:   PRINT &LINE#
:ENDPROCESS
                    
:CLOSE_PROCESS &HND#
                
See also: