Entering criteria expressions for an array element

You can enter criteria expressions by field for an array element (a data element with an OCCURS clause in COBOL).

You can refer to a subscripted data item on the "by field" display, and optionally enter a subscript, operator, and one or more values. The expression generated uses the TFLD external REXX function.

Alternatively, you can code a free-form expression that refers to any or all the elements of an array by using the TFLD external REXX function.

Figure 1 shows a record layout containing an array element (MONTH-DETAILS).
Figure 1. Record layout containing an array element
  Process   Options   Help
 ───────────────────────────────────────────────────────────────────────────────
 Z Data Tools                 Field Selection/Edit                 Line 1 of 11

 ----------- Criteria - Enter 1 or 2 to specify expression by field -----------
 1 Id :                                                                       +
 2 Sel:                                                                       +
 Offset      0
 Cmd Seq SHE Ref Field Name                           Picture  Type Start Length
                 ****  Top of data  ****
               1 1 RFM0411                                      AN      1    940
               2  2 REC-TYPE                          X         AN      1      1
               3  2 FILLER                            X(5)      AN      2      5
               4  2 CONTRACTOR                        X(40)     AN      7     40
               5  2 SERIAL-NO                         999999    ZD     47      6
               6  2 MONTH-DETAILS OCCURS 12 TIMES               AN     53     74
               7   3 PAY                              S9(8)     ZD     53      8
               8   3 JOB-LOCATION                     X(20)     AN     61     20
               9   3 CONTRACT-NO                      999999    ZD     81      6
              10   3 FIRST-NAME                       X(20)     AN     87     20
              11   3 SURNAME                          X(20)     AN    107     20
 Command ===>                                                       Scroll CSR 
  F1=Help      F2=Split     F3=Exit      F4=Expand    F5=RFind     F6=RunTemp
  F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
Enter "1" to display the Record Identification Criteria panel shown in Figure 2:
Figure 2. Record Identification Criteria panel
  Process   Options   Help
 ───────────────────────────────────────────────────────────────────────────────
 Z Data Tools           Record Identification Criteria             Line 1 of 11

 Cmd Con ( Field Name                          Op  Value                       )
     <-> - <---+----1----+----2----+----3----> <-> <+----1----+----2----+-- -
 *** ****  Top of data  ****
           RFM0411                                                              
     AND   REC-TYPE                                                             
     AND   FILLER                                                               
     AND   CONTRACTOR                                                           
     AND   SERIAL-NO                                                            
     AND   MONTH-DETAILS()                                                      
     AND   PAY()                                                                
     AND   JOB-LOCATION()                                                       
     AND   CONTRACT-NO()                                                        
     AND   FIRST-NAME()                                                         
     AND   SURNAME()                                                            
 *** ****  End of data  ****

 Command ===>                                                       Scroll CSR 
  F1=Help      F2=Split     F3=Exit      F4=Expand    F5=RFind     F6=RunTemp
  F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel

The fields suffixed "()" are dimensioned fields.

Figure 3 shows criteria expressions specified for some of the dimensioned fields within MONTH-DETAILS:
Figure 3. Subscripted values specified for dimensioned fields
  Process   Options   Help
 ───────────────────────────────────────────────────────────────────────────────
 Z Data Tools           Record Identification Criteria             Line 1 of 11

 Cmd Con ( Field Name                          Op  Value                       )
     <-> - <---+----1----+----2----+----3----> <-> <---+----1----+----2----+-- -
 *** ****  Top of data  ****
           RFM0411                                                              
     AND   REC-TYPE                                                             
     AND   FILLER                                                               
     AND   CONTRACTOR                                                           
     AND   SERIAL-NO                                                            
     AND   MONTH-DETAILS()                                                      
     AND   PAY()                               >   (ALL) 5000                   
     AND   JOB-LOCATION()                      =   (1) 'Kimberly'               
     AND   CONTRACT-NO()                                                        
     AND   FIRST-NAME()                                                         
     AND   SURNAME()                           CO  'SMITH', 'JONES'             
 *** ****  End of data  ****

 Command ===>                                                       Scroll CSR 
  F1=Help      F2=Split     F3=Exit      F4=Expand    F5=RFind     F6=RunTemp
  F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
In Figure 3:
  • The default subscript is (ANY) indicating that at least one element must satisfy the condition.
  • (ALL) indicates that all elements must satisfy the condition.
  • (1) indicates the first element must satisfy the condition.
After entering the criteria as shown in Figure 3, pressing F3 causes Z Data Tools to generate the expression:
TFLD('#7(ALL)','>',5000) & #8(1) = 'Kimberly' & TFLD('#11','CO','SMITH','JONES')
as shown in Figure 4.
Note: The TFLD function is generated (instead of the FLD_CO function) when the CO, or ¬CO operators are specified.
Figure 4. TFLD expression generated for fields in an array
  Process   Options   Help
 ───────────────────────────────────────────────────────────────────────────────
 Z Data Tools                 Field Selection/Edit                 Line 1 of 11

 ----------- Criteria - Enter 1 or 2 to specify expression by field -----------
 1 Id : TFLD('#7(ALL)','>',5000) & #8(1) = 'Kimberly' & TFLD('#11','CO','SMI  +
 2 Sel:                                                                       +
 Offset      0
 Cmd Seq SHE Ref Field Name                           Picture  Type Start Length
                 ****  Top of data  ****
               1 1 RFM0411                                      AN      1    940
               2  2 REC-TYPE                          X         AN      1      1
               3  2 FILLER                            X(5)      AN      2      5
               4  2 CONTRACTOR                        X(40)     AN      7     40
               5  2 SERIAL-NO                         999999    ZD     47      6
               6  2 MONTH-DETAILS OCCURS 12 TIMES               AN     53     74
               7   3 PAY                              S9(8)     ZD     53      8
               8   3 JOB-LOCATION                     X(20)     AN     61     20
               9   3 CONTRACT-NO                      999999    ZD     81      6
              10   3 FIRST-NAME                       X(20)     AN     87     20
              11   3 SURNAME                          X(20)     AN    107     20
 Command ===>                                                       Scroll CSR 
  F1=Help      F2=Split     F3=Exit      F4=Expand    F5=RFind     F6=RunTemp
  F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel

Related topics

Related topics

Related concepts