Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Information on testing programs with user-defined types

AID V3.1A supports the TYPEDEF clause and type-specific pointers in COBOL2000.

A dereferencing operator and an address operator now supplement the familiar AID operators (refer to the “AID” manual [8]).

The dereferencing operator is used to access the date addressed by a pointer. It is represented by an asterisk and can be combined with the COBOL qualification (IN, OF) and the COBOL subscripting.

The address operator supplies the address of a date for providing a value of a pointer or for further use in low-level AID. For this purpose AID supports the COBOL syntax ADDRESS OF.

  • Access to data names

    The data names of the TYPEDEF clause are not used in the AID command.

    • The input of simple, qualified and indexed symbols in AID takes place in the same way as in COBOL. This means that partial qualifications in particular are permitted provided they are unambiguous. For performance reasons it is advisable to qualify an input symbol completely for programs with a very large number of groups (structures). This expedites the search process and obviates the need for a uniqueness test. Complete qualification is always required for symbols with a dereferenced component 
      (e.g. %D NAME IN *ADDRESS-START). Furthermore, index information must always be specified exactly.

    • The following rules apply for complex data accesses arising from the combination of qualification, subscripting and dereferencing:

      • Processing always takes place from right to left. The operator on the farthest right is processed first.

      • If an operand is grouped with an operator, the operator in parentheses has priority when processing from right to left.

  • Adress selector

    Just as in COBOL, the keyword of the address selector is ADDRESS OF. It is reserved and does not apply in the setting %AID SYMCHARS=NOSTD.

  • Assignments and comparisons

    • Assignments and comparisons of variables with the same TYPEDEF clause without a STRONG specification can, similarly to groups, only be performed at low level, i.e. through explicit conversion of the groups to hexadecimal strings.

    • In the case of assignments and comparisons of variables with the same TYPEDEF clause and with a STRONG specification, explicit conversion to hexadecimal strings in the AID command entry is not required. AID checks whether the source and target have the same1 TYPEDEF clause with the STRONG specification and then carries out the assignment or comparison. However, during execution the string is converted internally to the variable as a whole and not to the individual components.

    • In the case of assignments and comparisons of type-specific pointers, a check is made to see whether the pointers have the same reference type. If the reference type is a group (structure) with the TYPEDEF clause, the STRONG specification is also required in the declaration of the type. If the pointer is assigned an address via the address selector, or if a pointer is compared with an address selector, the analogous type check is performed between the reference type of the pointer and the argument type of the address selector.

Example 7-2

01 PT-TYP TYPEDEF USAGE POINTER TO PERSON.
01 PERSON TYPEDEF STRONG.
   02 NAME PIC X(30).
   02 VORNAME PIC X(30).
01 VERWEIS TYPE PT-TYP.
01 PERS1 TYPE PERSON.
01 PERS2 TYPE PERSON.

Possible entry in AID:

%SET ADDRESS OF PERS1 INTO VERWEIS.
%D *VERWEIS        
%D NAME IN *VERWEIS                               (1)
%D ADDRESS OF PERS1                               (2)
%SET PERS1 INTO PERS2                             (3)

(1)

Shows the content of the data item to which VERWEIS refers as a group of the type PERSON or the element field NAME in this group.

(2)

Specifies the address of PERS1 (in hexadecimal format) for further use in low-level AID.

(3)

In COBOL corresponds to: MOVE PERS1 TO PERS2.

1 Please note: AID does not treat equivalent types as “identical” types (see the “COBOL2000 Reference Manual” [1]).