Note that the suffixes “-num” and “-cont” have a special meaning to the Web Services Assistant. The value in the -num field is the number of entries that were in the MY-TABLE table (i.e., the value in the field referenced by the OCCURS DEPENDING ON). The value in the -cont field is the name of the container CICS created to hold the actual table entry data for the MY-TABLE table. The actual data contained in the table entries for the MY-TABLE table isn’t included in this data definition and doesn’t exist in this container.
Second, the DFHWS2LS utility creates a separate data definition for the MY-TABLE table data. This definition would contain all the data in the table entry (see Figure 5). If an incoming request arrived that had four MY-TABLE entries, DATA-AREA would consist of My-Table-num (containing +4), My-Table-cont (containing a constant such as “DFHPI00000000001”), and whatever data value was in OTHER-DATA. Using the information in the -num and -cont fields, the program knows there are four entries, and these entries can be found in the container whose name is contained in My-Table-cont. To create the data structure as defined by the original DATA-AREA, the program must loop through this container, moving each entry into the appropriate MY-TABLE-ELEMENT slot.
This same process applies if a CICS program is to ship variable array data to the Web, either to request a service or return data to a requester. The programmer must place a container name in the My-Table-cont field, create a unique container to hold the table, then place the number of entries in the Table-num field. The value placed in the -cont field must be a valid container name and can’t start with the letters DFH.
While the process the Web Services Assistant uses to manage variable array data is complex, it follows a series of fixed steps that remain consistent for all tables:
1. Remove the actual data contained in the variable table from the original data structure.
2. Replace this data with control information that describes the container used to hold the actual data.
3. Create a container that holds all the entries of actual data.
Nested Variable Size Tables
The next step is to see how these three steps are used to handle a situation where variable arrays are defined in a variable array. Let’s enhance our earlier example to include a second array in the first (see Figure 6).
As with the previous example, MY-TABLE-ELEMENT can occur up to five times. For each occurrence, there will be two data elements called NESTED-ELEMENT-1 and NESTED-ELEMENT-2, which can occur up to 10 times. Because these two data elements are defined as part of an OCCURS DEPENDING ON, they will be treated in the same way MY-TABLE-ELEMENT was. The only twist is that the NESTED-ELEMENTs can occur multiple times for each occurrence of MY-TABLE-ELEMENT.
In the previous example of a single variable array, the data definition was broken into two parts. The original definition of the fixed portion of the data remains intact. The definition of MY-TABLE is expanded to include the control information for the nested OCCURS DEPENDING ON by adding the appropriate -num and -cont fields (see Figure 7). Finally, a new group definition is added with the description of the fields in the nested table (see Figure 8).