SetArray Method (JSONDATA)


10.8, PLBCMP GUI Only

 

The SetArray method is used to create a JSON array field and place it into the current JSONDATA object. This method uses the following format:

 

 

[label]

{object}.SetArray

[GIVING {return}] USING [*NAME=]{name}[:

 

 

[*VALUE="]{value}[:

 

 

[*INDEX1=]{index1}][:

 

 

[*INDEX2=]{index2}][:

 

 

[*INDEX3=]{index3}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A JSONDATA object previously declared.

return

Optional. A Numeric Variable that returns a pass (0) or fail (!0) value.

name

Required. A Character String Variable or literal that specifies a JSON field name for a JSONDATA object.

value

Required. A Character String Variable or literal that specifies the string value for a JSON field with the JSON array type.

index1

Optional. A Numeric Variable, decimal number, or Numeric expression that defines the first index of a JSON array that is being accessed.

index2

Optional. A Numeric Variable, decimal number, or Numeric expression that defines the second index of a JSON multi-dimensioned array that is being accessed.

index3

Optional. A Numeric Variable, decimal number, or Numeric expression that defines the third index of a JSON multi-dimensioned array that is being accessed.

Flags Affected: EOS, OVER, ZERO

Notes:

  1. The EOS flag is always cleared.

  2. The ZERO flag is set if the return value is zero. Otherwise, the ZERO flag is cleared for non-zero values.

  3. The OVER flag is set if the return value must be truncated.

  4. At runtime, the tokens $1, $2, and $3 that appear in the {name} parameter are replaced with the numeric values of the corresponding {index1}, {index2}, or {index3} parameters.

  5. The error values returned in {return} are defined as follows:

  6.  

    Error

    Description

    1

    Memory allocation error.

    2

    JSON parse error. Check SyntaxError method!

    5

    JSON error type mismatch.

    6

    JSON parse id error. Check SyntaxError method!

    7

    JSON method input is null or invalid.

     

  7. If an error occurs, the JSONDATA object method 'SyntaxError' can be used to retrieve that last error that was generated.

  8. The {value} character string must be a properly formatted JSON array string that starts with the leading '[' character. Otherwise, an error occurs.

 

 

See Also: Method Syntax, JSONDATA Methods



PL/B Language Reference