COUNT sub-command


Defines the segment and special processing options for the purpose of counting selected segments, extracting the concatenated keys of selected segments, or both.

image2021-7-29_19-27-36.png


OPTION

Defines special processing.

  • CKEY Writes the segment concatenated key to an output dataset. File-AID for IMS can only create members into an existing PDS.

    When specified with the SEGMENT object keyword, the concatenated key for the specified segment is provided. When specified with the CHILD object keyword, the concatenated key for all the segments under the current parent is provided.

  • ALWAYS Process for either PATH or NOPATH condition.
  • PATH Process only if the specified path exists.
  • NOPATH Process only if the specified path does not exist.

For more information, see Processing-paths.

Examples

The following COUNT sub-command statement counts all customer and customer remarks segments and writes out the concatenated key for the customer segment.

TYPE   RUN;
PSB    DBNAME=CUSTPDBD;
SET    OUTPUT=CUSTKEYS;
TITLE  LINE01=’COUNT ALL CUSTOMER AND REMARKS SEGMENTS’;
SELECT SEGMENT=CUSTOMER MAX=ALL
       SEGMENT=CUSTRMKS MAX=ALL
  COUNT  SEGMENT=CUSTOMER OPT=CKEY
         SEGMENT=CUSTRMKS; 

In the following example, the COUNT sub-command statement counts and writes the concatenated key of every 100th customer segment to an output dataset PDS member.

TYPE   RUN;
PSB    PCB=2;
SET    OUTPUT=CUSTKEYS;
SELECT SEGMENT=CUSTOMER MAX=ALL START=100 SKIP=(1,99)
  COUNT  SEGMENT=CUSTOMER OPT=CKEY; 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*