COUNT


The COUNT primary command enables you to count segments, extract concatenated keys of segments, or both. Multiple COUNT primary commands can be specified in a single execution.

image2021-7-29_17-15-16.png

OPTION

Identifies 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 only the specified segment name is provided. When specified with the CHILD object keyword, the concatenated key for all the segments under the current parent is provided.

MAXIMUM

Defines the number of selected database segments to process, not counting segments that are skipped. See MAXIMUM Keyword for a complete description of this keyword.

  • number Number of segments to be processed.
  • ALL Process all segments at that level or within parent.

START

Defines the occurrence number of the selected segment where processing is to begin. See START Keyword for a complete description of this keyword.

  • number Occurrence number of the selected segment where processing is to begin.

SKIP

Alters the processing sequence. See SKIP Keyword for a complete description of this keyword.

  • number1 Number of selected segments to process.
  • number2 Number of selected segments to skip.

Examples

The following COUNT command statement causes all segments in the customer database to be counted:

TYPE  RUN;
PSB   DBNAME=CUSTPDBD;
TITLE LINE01=’COUNT ALL SEGMENTS’;
COUNT SEGMENT=$ROOT MAX=ALL
              CHILD MAX=ALL;

The following COUNT command statement causes all customer segments to be scanned and the concatenated keys to be written to an output PDS dataset member CUSTKEYS. A count of the total customer and customer remarks segments is given.

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

Following is an example of the format of an output dataset.

Column

Length

Description

1

8

segment name

9

1

unused

10

1-n

concatenated key

In this example, the COUNT command statement extracts the concatenated key of every hundredth customer segment and all the concatenated keys of the segment’s children. The data is written to an output dataset member (CUSTKEYS).

TYPE  RUN;
PSB   PCB=2;
SET   OUTPUT=CUSTKEYS;
TITLE LINE01=’CONCATENATED KEY OF EVERY 100TH CUSTOMER’;
COUNT SEGMENT=CUSTOMER MAX=ALL OPTION=CKEY START=100 SKIP=(1,99)
      CHILD            MAX=ALL OPTION=CKEY; 

Related topics

 

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

BMC AMI DevX File-AID for IMS 23.01