WRITE_PROCESS
Script Function: It writes the content of a data sequence to a file.
Syntax
WRITE_PROCESS (Data-Sequence Reference, File, Agent, Login,[Mode],[CodeTable], [File Attributes], [Column])
WRITE_PROCESS (Data-Sequence Reference, File, Agent, Login,[Mode],[CodeTable], [File Attributes], [ALL], [Delimiter])
Syntax |
Description/Format |
---|---|
Data-Sequence Reference |
This is the reference to the data sequence whose content should be exported to a file. |
File |
The path and the name of the file. |
Agent |
The name of the agent whose host should be used to store the file. Format: AE name, script variable or script variable |
Login | The name of the Login object that is used for logging on to the host of the specified agent. Format: AE name, script variable or script variable |
Mode |
The further procedure when the specified file already exists. Allowed values: |
CodeTable |
The name of a CodeTable object that should be used for coding the file. The default CodeTable UC_CODE is used when you do not specify this parameter. |
File Attributes |
Additional file attributes for the generated file. Format: script variable or script literal Depending on the agent's INI file, you can specify the attributes that can also be used for file transfers. Note that several attributes must be separated by commas. |
Column |
The column(s) of the data sequence that should be written to the file. Allowed values: |
Delimiter |
The delimiter that is used when you define several columns. This is only relevant when you export all the columns of the data sequence. |
Return Codes |
---|
0 - The file has successfully been exported. |
Comments
This script element exports the content of any data sequence to a text file. You must specify a reference to the corresponding data sequence which is stored when you create the data sequence in a script variable.
Each line of the data sequence is a line in the file.
You can define whether all or only a specific column of the data sequence should be written to the file. The parameter Column is used for this purpose. By default, all columns will be exported.
The parameter Delimiter is only relevant when you export all columns. In this parameter, you determine the character that is used to separate the data-sequence lines in columns.
Examples
The following example creates a data sequence that stores a list of the file names of a certain directory. Subsequently, the content of this data sequence is stored in a file on a different host. In the case that an error occurs (return code of WRITE_PROCESS > 0), an error message will be written and sent to the responsible AE user.
:SET &HND# = PREP_PROCESS_FILENAME("WIN01","c:\AUTOMIC\server\bin\*.exe",,,,"COL=DELIMITER","DELIMITER=*\*")
:SET &RET# = WRITE_PROCESS(&HND#,"C:\temp\export.txt",WIN02, LOGIN.GLOBAL,OVERWRITE)
:IF &RET# > 0
: SET &ERRNR# = SYS_LAST_ERR_NR()
: SET &ERRINS# = SYS_LAST_ERR_INS()
: SET &MESSAGE# = GET_MSG_TXT(&ERRNR#,&ERRINS#)
: SEND_MSG &$USER#, &$DEPARTMENT#, &MESSAGE#
:ENDIF
See also:
Script Elements | Description |
---|---|
CREATE_PROCESS | Creates a new data sequence. |
GET_PROCESS_LINE | Retrieves the current line content of a data sequence. |
LOAD_PROCESS | Loads a stored data sequence. |
PREP_PROCESS | This script function uses specific Job objects (event jobs) in order to process commands on a computer and it returns the Console output that can be used for further processing as an internal list ( data sequence). |
Script Element - Data Sequences
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function