Referencing Logical Data Structures from NCL

An NCL programmer can connect a data structure to a map in a number of ways. For example, during retrieval from a file:

&FILE GET ID=CUSTFIL MDO=NEXTREC MAP=CUSTOMER

The user supplies a local name to the MDO (in this case, NEXTREC) when reading it from the file, and nominates the map to be used to define the record contents (in this case, CUSTOMER). If you continue with the sample map described above, this record is defined as a CHOICE type. This means that you can refer to either NEXTREC.CUSTOMER, if the record is of type CustomerDetail, or NEXTREC.ORDER, if the record is of type OrderDetail.

You might know what type to expect (for example by understanding the key used to retrieve the record) and can immediately reference the inner structure. Otherwise, assuming that the records can be distinguished by Mapping Services due to some physical characteristic in the record itself, the component name of the choice within a particular record can be determined by using a query function.

In either case, reference to subsequent structures can proceed. The rules are simple. If a component is defined as a constructed type, (one of SEQUENCE, SEQUENCE OF, SET, SET OF, or CHOICE), then the one or more components within that construction are referenced by using the constructed component name, followed by a period, then the inner component names.

Hence in the example, the following logical components of a CustomerDetail record can be referenced from NCL:

NEXTREC.CUSTOMER.NAME
NEXTREC.CUSTOMER.ADDRESS.NUMBER
NEXTREC.CUSTOMER.ADDRESS.STREET
NEXTREC.CUSTOMER.ADDRESS.SUBURB
NEXTREC.CUSTOMER.OPENORDERS


Copyright © 2008 CA. All rights reserved.