Automation Engine Script Guide > Ordered by Function > Data Sequences > WRITE_PROCESS

WRITE_PROCESS

Script Function: It writes the content of a data sequenceAn internal listing of Console outputs or lines of Variable objects, etc. The lines of a data sequence can be accessed by using a PROCESS loop or the script element GET_PROCESS_LINE. The script elements PREP_PROCESS* generate data sequences. 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.
Format: script variable

File

The path and the name of the file.
Format: script variableA placeholder for a value within a script. or scriptA particular Automation Engine object type. literal

Agent

The name of the agentA program that enables the de-centralized execution of processes (such as deployments) on target systems (computers or business solutions) or a service that provides connectivity to a target system (such as for databases or middleware). An agent is also an object type in the Automation Engine. [Formerly called "Executor."] See also: host whose hostComputer, target system. should be used to store the file.

Format: AE name, script variable or script variable

Login The name of the Login objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task 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.
Format: AE name, script variable or script variable

Allowed values:
CANCEL (default) - Script processing will be canceled.
OVERWRITE - The file will be overwritten.
APPEND - The existing file will be extended for the new lines.

CodeTable

The name of a CodeTable object that should be used for coding the file.
Format: AE name, script variable or script variable

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.
Format: script literal, script variable, a number without inverted commas

Allowed values:
ALL (default) - All columns
The number of columns you required (e.g.: 2).

Delimiter

The delimiter that is used when you define several columns.
Format: script literal, script variable, a number without inverted commas

This is only relevant when you export all the columns of the data sequence.

Return Codes

0 - The file has successfully been exported.
20554 - The agent is currently not active.

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 listShows entities in a grid view 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 codeThe value that represents the result of tasks and script functions. of WRITE_PROCESS > 0), an error message will be written and sent to the responsible AE userIn the Automation Engine, a user is an instance of a User object, and generally the user is a specific person who works with Automic products. The User object is assigned a user ID and then a set of access rights to various parts of the Automation Engine system and product suite. These access rights come in the form of Automation Engine authorizations and privileges, Decision user roles and EventBase rights and ARA web application object rights. You can manage all these centrally in the ECC user management functions. See also, Unified user management..

: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 functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… uses specific Job objects (eventAction that is triggered if particular conditions apply. It can be an Automation Engine object type or an entry in a Policy Orchestrator EventBase. 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).

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH