PUT

Function

Moves data into an array.

Syntax

PUT {src_any_lit|_var|_col}...
INTO dst_array_name(element)[field[(occurs)]]...

Arguments

src_any_lit|_var|_col

Source variable or literal to move into the array. Numeric variables, literals, and database columns can be put into number (decimal, float, integer) fields. String variables, literals, and database columns can be put into char, text, or date fields. Date variables can be put into date, char, or text fields.

When a date variable or column is moved into a text or char array field, the date is converted to a string according to the following rules:

When a string variable, column, or literal is moved to a date array field, the string must be in the format specified by SQR_DB_DATE_FORMAT, one of the database-dependent formats in Table 61, Default Formats by Database, or the database-independent format 'SYYYYMMDD[HH24[MI[SS[NNNNNN]]]]'.

dst_array_name(element)

If array fields are listed, data is placed into each field in the sequence it is listed, in the occurrence specified of that field.

If array fields are not listed, data is placed into consecutive fields in the order they were defined in CREATE-ARRAY; data is copied into occurrence zero of each field of the element specified in the array.

field[(occurs)]

Array element and field occurrence numbers can be numeric literals (123) or numeric variables (#j).

If no occurrence is specified, occurrence zero is used.

Description

Columns retrieved from the database and Production Reporting variables or literals can be moved into an array. The array must have been created previously using CREATE-ARRAY.

Examples

In the following example, the four variables &name, #count, $date1, and $code is placed into the first four fields defined in the names array. The data is put into the #j'th element of the array.

put  &name  #count $date1  $code  into  names(#j)

The following command places #j2, #j3, and #j4 into the zero through 2nd occurrences of the tot field in the #j'th element of the totals array.

put  #j2  #j3  #j4  into  totals(#j)  tot(0)  tot(1)  tot(2)

The following command copies #count into the #j2'th occurrence of the count field in the #j'th element of the states array.

put  #count  into  states(#j)  count(#j2)