Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
function ECENTURY_METHOD,^val a_data ,a a_type ,n a_today ,n a_year ,n a_month ,n a_day ,n
The two‑digit century to use by default (for example, 19 or 20). (n)
The data being decoded. (a)
One of the following date formats: (n)
The default to today flag. (n)
The two‑digit year entered. (n)
The month entered. (n)
The day entered. (n)
%ECENTURY_METHOD is a function that you write and name. The name of your function is registered with UI Toolkit using the E_METHOD subroutine. Your %ECENTURY_METHOD function must be declared as a ^VAL function.
%ECENTURY_METHOD is called whenever UI Toolkit needs to supply a default century.
You will never call %ECENTURY_METHOD directly; it is called only by UI Toolkit.
A_data is the string passed to U_DCDDAT. For input processing, a_data is the string typed in by the user.
A_type is one of the definitions defined in tools.def.
If a_today is true, the date defaults to today’s date.
A_year, a_month, and a_day are the decoded year, month, and day entered. Note that a_year is a two‑digit year.
The following example shows the default century method behavior when SYNCENTURY is used.
function mycentury,^val, reentrant ; ; Description: Century method implementing SYNCENTURY behavior ; ; Arguments: a_data ,a ;The date as entered a_type ,n ;The type of date field a_today ,n ;The "default to today" flag a_year ,n ;The two-digit year parsed from input a_month ,n ;The month parsed a_day ,n ;The day parsed ; Return value: ; The two-digit century ; .align stack record length ,i4 ;Length of contents of SYNCENTURY logical syncentury ,d2 ;Value contained in SYNCENTURY first_century ,d2 ;First of the two centuries in our sliding range group todays_ds ,a20 ;%datetime group today ,d8 ;The date portion thereof group yyyy ,d4 ;The year out of that cc ,d2 ;The century part yy ,d2 ;The year (non-century) endgroup mm ,d2 ;The month dd ,d2 ;The day endgroup endgroup string ,a80 ;String buffer for SYNCENTURY contents proc todays_ds = %datetime ;Load the current date to get the year ;Is SYNCENTURY defined? xcall getlog("SYNCENTURY", string, length) if (length) then ;Yes, use it begin onerror ($ERR_DIGIT) nosyncentury ;Catch conversion errors syncentury = string ;Convert from alpha to numeric end else ;No, SYNCENTURY is not defined begin ; or is defined non-numeric nosyncentury, clear syncentury ;Default to zero end offerror if (yy .ge. syncentury) then ;Are we on or after SYNCENTURY? first_century = cc ;Yes, later numbers are in this century else first_century = cc - 1 ;No, later numbers are in previous century if (a_year .ge. syncentury) ;Entered a year on or after? freturn first_century ;Yes, return the earlier century freturn (first_century + 1) ;No, return the later century endfunction