Communicator e3000 MPE/iX Release 6.0 Express 1 (C.60.01) (30216-90286)

Chapter 3 23
Technical Articles
CI Enhancements
WORDCNT
Syntax: WORDCNT ( string[,delims][,start] )
Defn: A CI evaluator function that returns the number or words (tokens) defined
by “delims” in “string”, starting at “start”. The default delimiters are the
same as for the WORD and DELIMPOS functions: a space, a comma, a
semicolon, an equals sign, left and right parentheses, left and right
brackets, single quote, double quote, and tab. The default start is 1.
Type: Integer
Example: :calc WORDCNT(‘file a=bb,old;rec=40,,f,ascii’)
Result: 9
New CI Variables
HPDATETIME A CI variable containing the current date and time in a string formatted
as “YearMonthDateHourMinuteSecondMillisecond”. For consistency, if
HPDATETIME is referenced more than once for a “logical” (or atomic)
operation, such as extracting the date and the time, it is very important to
store HPDATETIME into a user-defined variable and extract from that
variable. For example, to accurately separate the date and time from
HPDATETIME the code below should NOT be used:
setvar mydate lft(hpdatetime,8) /* Don’t do this! */
setvar mytime rht(hpdatetime,9) /* Don’t do this! */
The problem above is that “MYDATE” could be set a millisecond before
midnight, and “MYTIME could be set a millisecond past midnight, with the
result being:
MYDATE = 19990314 /* Mar 14 just before midnight */
MYTIME = 000000100 /* Mar 15 just past midnight */
Instead, create a variable that contains HPDATETIME and extract from that
variable. For example:
setvar date_time HPDATETIME /* This is correct! */
setvar mydate lft(date_time,8)
setvar mytime rht(date_time,9)
NOTE
Current time resolution is only tenths-of-a-second so the last two string
characters will both be “0”.
Type: String, read-only.
Example: if the current date and time is Feb 21, 1999 at
14:08:15:2, HPDATETIME equals “19990221140815200”
HPDOY A CI variable containing the day number in the current year, with Jan 1
being day 1.
Type: Integer, read-only.
Example: On Feb, 7, 1999 HPDOY equals: 38