IBM InfoSphere DataStage, Version 11.3.1
DCOUNT function
Syntax
DCOUNT (string, delimiter)
Description
Use the DCOUNT function to return the number of delimited fields in a data string.
string is an expression that evaluates to the data string to be searched.
delimiter is an expression that evaluates to the delimiter separating the fields to be counted. delimiter can be a character string of 0, 1, or more characters.
DCOUNT differs from COUNT in that it returns the number of values separated by delimiters rather than the number of occurrences of a character string. Two consecutive delimiters in string are counted as one field. If delimiter evaluates to an empty string, a count of 1 plus the number of characters in the string is returned. If string evaluates to an empty string, 0 is returned.
If string evaluates to the null value, null is returned. If delimiter evaluates to the null value, the DCOUNT function fails and the program terminates with a run-time error message.
PICK, IN2, and REALITY Flavors
In PICK, IN2, and REALITY flavors, the DCOUNT function continues the search with the next character regardless of whether it is part of the matched delimiter string. Use the COUNT.OVLP option of the $OPTIONS statement to get this behavior in IDEAL and INFORMATION flavor accounts.
Example
REC="88.9.B.7"
Q=DCOUNT(REC,'.')
PRINT "Q= ",Q
REC=34:@VM:55:@VM:88:@VM:"FF":@VM:99:@VM:"PP"
R=DCOUNT(REC,@VM)
PRINT "R= ",R
This is the program output:
Q= 4
R= 6
Last updated: 2015-03-09
PDF version of this information: