SEGCNT

Read syntax diagramSkip visual syntax diagram
Syntax

>>-SEGCNT(field_name)------------------------------------------><

Can only be used in criteria for a segmented template.

Returns the number of previous occurrences of the segment identified by the parameter, field_name. The default value of 0 is returned if used with non-segmented processing.

field_name
Must be a valid 01 name in the template being used.

For example, if SEG-A occurs the number of times specified in the header field SEG-NUM-A, the RID criteria shown in Figure 1 can be used to identify SEG-A.

Figure 1. SEGCNT example
Z Data Tools    Related Id expression for SEG-A                    Line 1 of 5

 -------- Criteria - Enter 0 to specify related ID expression by field --------
 0 Rid: segcnt('seg-a') < #2                                                  +
 Offset      0           Enter "/" to OR with related ID
 Cmd Seq SHE Ref  Field Name                          Picture  Type Start Length
                  ****  Top of data  ****
               1  1 SEG-HDR                                     AN      1      4
               2   2 SEG-NUM-A                        9         ZD      1      1
               3   2 SEG-NUM-B                        9         ZD      2      1
               4   2 SEG-NUM-C                        9         ZD      3      1
               5   2 SEG-NUM-D                        9         ZD      4      1
                  ****  End of data  ****
⋮