Skip to main content

erropt

erropt

Specifying a value for this argument suppresses errors associated with invalid or out of range hdate values. Instead of generating <ILLEGAL VALUE> or <VALUE OUT OF RANGE> errors, the $ZDATE function returns the erropt value.

  • Validation: InterSystems IRIS performs canonical numeric conversion on hdate. Parsing of an hdate string halts at the first non-numeric character. Therefore, an hdate string such as 64687AD is the same as 64687. A non-numeric date (including the null string) evaluates to 0. Thus an empty string hdate returns the $HOROLOG initial date: December 31, 1840. However, if hdate does not evaluate to an integer (contains a non-zero fractional number) it generates an <ILLEGAL VALUE> error.

  • Range: hdate must evaluate to an integer within the mindate/maxdate range. By default, date values greater than 2980013 or less than 0 generate a <VALUE OUT OF RANGE> error. By setting mindate to a negative number, you can extend the range of valid dates before December 31, 1840. However, for dformat 18, 19, 20, or 21 (Hijri Islamic calendar) dates, any date prior to -445031 generates an <ILLEGAL VALUE> error, even if mindate is set to an earlier date.

The erropt argument only suppresses errors generated due to invalid or out of range values of hdate. Errors generated due to invalid or out of range values of other arguments will always generate errors whether or not erropt has been supplied. For example, an <ILLEGAL VALUE> error is always generated when $ZDATE specifies a sliding window where endwin is earlier than startwin. Similarly, an <ILLEGAL VALUE> error is generated when maxdate is less than mindate.

Invalid Date Handling with ZDateNull

The behavior of $ZDATE when given an invalid value for hdate can be set using ZDateNull. To set this behavior for the current process, use the ZDateNull()Opens in a new tab method of the %SYSTEM.ProcessOpens in a new tab class. The system-wide default behavior can be established by setting the ZDateNullOpens in a new tab property of the Config.MiscellaneousOpens in a new tab class. $ZDATE can either issue an error, or return a null value.

The system-wide default behavior is configurable. Go to the Management Portal, select System Administration, Configuration, Additional Settings, Compatibility. View and edit the current setting of ZDateNull. The default is “false”, meaning that $ZDATE returns an error.

FeedbackOpens in a new tab