countprefix

The countprefix option specifies the prefix for the subfields that can receive the number of elements that were set by an XML-INTO operation for a subfield array. The name of the count subfield is formed by adding the array name to the countprefix value. For example, if a data structure has a subfield array meeting.attendees, and countprefix=num was specified, the XML-INTO operation would set meeting.numattendees to the actual number of elements of the meeting.attendees array that were set by the XML-INTO operation. In the subsequent discussion of the countprefix option, subfield meeting.numattendees is referred to as the countprefix subfield and meeting.attendees is referred to as the counted subfield.

The processing for the countprefix option is done after the XML data for a data structure or data structure subfield has been parsed.

Note:
  1. A countprefix subfield must be numeric, and it must be scalar; that is, it cannot be an array or a data structure. If a subfield has a countprefix name, but is not numeric or scalar, that subfield will be processed normally; it will not be considered to be a countprefix subfield.
  2. A counted subfield can be any type of subfield; it is not required to be an array. If a counted subfield is not an array, its countprefix subfield will be set to 0 (zero) if there is no XML data to set the subfield, and it will be set to 1 (one) if there is XML data to set it.
  3. When a subfield is counted by a countprefix subfield, the allowmissing option is not considered for that subfield. Option allowmissing=yes is implied for all subfields that are counted by a countprefix subfield.
  4. If there is too much XML data for a subfield, the countprefix subfield will only reflect the number of array elements that were actually set by the XML-INTO operation. For example, if array arr has ten elements, and there is XML data for eleven elements, the countprefix subfield for arr would have the value 10.
  5. If the XML-INTO operation ends in error, the countprefix subfields may not reflect the exact number of RPG subfields that were updated by the XML-INTO operation. The countprefix processing is done after the XML data for each data structure or data structure subfield has been parsed; if an error occurs during parsing, or during the countprefix processing, the countprefix processing would not be completed.
  6. A countprefix subfield is not considered to be countable. For example, if countprefix=num_ was specified, and the data structure has subfields arr, num_arr and num_num_arr, then num_arr would be considered a countprefix subfield for array arr, but num_num_arr would not be considered a countprefix subfield for num_arr.
  7. A countprefix subfield cannot be explicitly set by XML data. Any XML attributes or XML elements that set a countprefix subfield are considered to be extra.
  8. A countprefix subfield cannot be the same as a datasubf subfield. For example, if countprefix=num_ was specified, and the data structure has subfields arr and num_arr, then num_arr is a countprefix subfield. Option datasubf=num_arr cannot also be specified for this data structure.