Assigns values to a series of variables.


batch_set( data ,[set_delimiter],[element_delimiter],[time_stamp])


datalist of variables and the values to be assigned to these variables

character used in data to separate one set from another In this function, a set is a variable and the value to be assigned to the variable. If the \n character is theset_delimiterdata may look like "/a,5\n/b,7"



character used in data to separate a variable from the value to be assigned to the variable A comma (,) is the default value. See the example for set_delimiter in the above cell, which shows default input values.
time_stamptime that the variable was set PATROL automatically records the time that a variable is set, and it may display the time as a data point in a graph or chart generated by the PATROL Console. The time_stamp parameter gives you the option of overriding the value that PATROL would assign. This parameter is entered as the number of seconds that have elapsed since 00:00:00 GMT, Jan 01, 1970.


This function is similar to the set() function except that batch_set() allows you to assign values to many variables at one time. 
The following table explains the return values for this function.

 Return Values for batch_set() 

Return Value



function completed successfully


function terminated because set_delimiter and element_delimiter have the same value

2\nvariable1,errno1 [... \nvariablen,errnon]

no value was assigned to at least one variable If batch_set() cannot set a variable, it returns error information for that variable and continues setting the remaining variables. The function returns a two (2) to indicate that one or more variables could not be set. For each variable that could not be set, the function also returns the name of the variable and the PSL errno value. For example, a return value of"2\n/ipAddress,60" would mean that the variable/ipAddress could not be set because it is not writable (errno 60).


The following example shows that you can write code that evaluates the return value as a number. Even though a failure of the batch_set() function returns a list, the statement works because it simply tests whether the value is a non-zero number.

if (batch_set(data) != 0)
# handle failure

The following shows two more examples.

data = "/a,1\n/b,2,".time()."\n/c,3\n/ipAddress,hello world"; 
result = batch_set(data);
errno = errno; 
printf("errno=%s\n", save_errno);
printf(">%s<&#92;n", result); 
printf("a=%s&#92;n", get("/a"));
printf("b=%s&#92;n", get("/b")); 
printf("c=%s&#92;n", get("/c")); 
data = "/a|10@/b|20|".time()."@/c|30@/ipAddress|hello world"; 
result = batch_set(data, "@", "\|");
save_errno = errno; 
printf("errno=%s&#92;n", save_errno);
printf(">%s<&#92;n", result); 
printf("a=%s&#92;n", get("/a"));
printf("b=%s&#92;n", get("/b")); 
{{printf("c=%s&#92;n", get("/c"));
Was this page helpful? Yes No Submitting... Thank you