CENTSPLT parameter: Difference between revisions
(Automatically generated page update) |
m (→Description: minor formatting) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:CENTSPLT parameter subtitle}} | |||
==Summary== | ==Summary== | ||
<dl> | <dl> | ||
Line 10: | Line 11: | ||
<dd>All | <dd>All | ||
<dt>Introduced | <dt>Introduced | ||
<dd><var class="product">Model 204 | <dd><var class="product">Model 204 V4.1</var> | ||
</dl> | </dl> | ||
==Description== | ==Description== | ||
<p>The CENTSPLT parameter computes the value of the base century, the BASECENT parameter, used by the date processing routines, specifically $ | <p> | ||
The <var>CENTSPLT</var> parameter computes the value of the base century, the <var>[[BASECENT parameter|BASECENT]]</var> parameter, used by the date processing routines, specifically <var>[[$DateCnv|$DateCnv]]</var> and <var>[[$DateDif|$DateDif]]</var>, when a 2-digit year (<var>YY</var> value) is converted to a 4-digit year. </p> | |||
<ul> | <ul> | ||
<li> | <li>If a <var>YY</var> value is greater than or equal to the <var>CENTSPLT</var> value, the the <var>YY</var> value is assumed to be in the base century (whose calculation is described below). | ||
If a | |||
< | <li>If the <var>YY</var> value is less than the <var>CENTSPLT</var> value, the the <var>YY</var> value is assumed to be in the <code>base+1</code> century.</li> | ||
</ul> | |||
<p> | |||
The value of <var>CENTSPLT</var> is decimal in the range of 00 to 99. </p> | |||
<p> | |||
The combined parameters, <var>CENTSPLT</var> and <var>BASECENT</var>, are mutually exclusive with the <var>[[DEFCENT parameter|DEFCENT]]</var> parameter. If neither is specified, the default is <var>DEFCENT</var>, which is set to the century when the system was started.</p> | |||
<p> | |||
The following is an explanation of how the <var>CENTSPLT</var> parameter affects the base century in a 2-digit to a 4-digit year conversion:</p> | |||
<ul> | |||
<li>The base century is initially set to the century prefix of the current system date.</li> | |||
<li>Then, if the last two digits of the current system date are less than the <var>CENTSPLT</var> value, the base century value is decremented by one.</li> | |||
<li>The new base century is stored.</li> | |||
</ul> | </ul> | ||
< | <p> | ||
Some examples follow: </p> | |||
<ul> | <ul> | ||
<li>If the current date is May 23, 1996 with <var>CENTSPLT</var> at 50, <var>BASECENT</var> starts at 19 and, because 96 is greater than 50, <var>BASECENT</var> stays at 19.</li> | |||
<li> | <li> | ||
If the current date is May 23, 2006 with <var>CENTSPLT</var> at 50, <var>BASECENT</var> starts at 20, but because 06 is less than 50, <var>BASECENT</var> is decremented to 19.</li> | |||
< | |||
< | |||
</ul> | </ul> | ||
<p> | <blockquote class="warn"> | ||
<p><b>Attention:</b> Because of the way the base century is calculated, you can get unexpected results if <var>CENTSPLT</var> is set to a value higher than the current year. If you want to maintain the current century, do not set <var>CENTSPLT</var> to a value higher than the current year. </p> | |||
<p> | |||
Consider the following scenario: The current date is May 23, 1996 with <var>CENTSPLT</var> at 97. <var>BASECENT</var> starts at 19, but because 96 is less than 97, <var>BASECENT</var> is decremented to 18.</p> | |||
<p> | |||
The rule of thumb here is: if the current year is in the lower century of the range split, do not set <var>CENTSPLT</var> to a value higher than the current 2-digit year. In this example, 1996 is in the lower century, so it is very unlikely that you will want to set <var>CENTSPLT</var> higher than the current year (96).</p> | |||
</blockquote> | |||
==Usage== | |||
The following examples show usage of the CENTSPLT parameter: | |||
<ul> | <ul> | ||
<li> | <li>The current date is May 23, 1996 with CENTSPLT=50; BASECENT=19 (from the current | ||
date, 1996). The date 11/23/90 needs conversion. Because 90 is greater than 50, the date expands to 11/23/1990, because BASECENT is unchanged. If the date were 11/23/05, | |||
<li> | because 05 is less than 50, so the date expands to 11/23/2005, because BASECENT is | ||
incremented.</li> | |||
<li>The date 11/23/98 needs conversion. Because 98 is greater than 50, the date expands to 11/23/1998, because BASECENT is unchanged. If the date were 11/23/02, then 02 is less than 50, so the date expands to 11/23/2002, because BASECENT is incremented.</li> | |||
</ul> | </ul> | ||
<p | <p>The <var>[[$DateCnv]]</var> and <var>[[$DateDif]]</var> functions have been modified to use these parameters. By default, they use whichever parameter is active.</p> | ||
<p> | <p>Alternatively, both these functions have two additional optional arguments (for <var>$DateCnv</var>, arguments 4 and 5, for <var>$DateDif</var>, arguments 5 and 6) that allow the specification of either a DEFCENT value or a CENTSPLT value (in that order) that are in effect for that one function call. Like the parameters, the arguments are mutually exclusive, so you can specify only one of them on a call. For example, to specify a CENTSPLT argument to <var>$DateCnv</var>, the call is:</p> | ||
< | <p class="syntax">%A = $DateCnv(fmt1,fmt2,datei,,%CENTSPLT)</p> | ||
[[Category:User parameters]] | [[Category:User parameters]] | ||
[[Category:Parameters]] | [[Category:Parameters]] |
Latest revision as of 22:42, 25 January 2018
Century year split
Summary
- Default value
- None
- Parameter type
- User
- Where set
- On User 0's parameter line or by any user
- Related products
- All
- Introduced
- Model 204 V4.1
Description
The CENTSPLT parameter computes the value of the base century, the BASECENT parameter, used by the date processing routines, specifically $DateCnv and $DateDif, when a 2-digit year (YY value) is converted to a 4-digit year.
- If a YY value is greater than or equal to the CENTSPLT value, the the YY value is assumed to be in the base century (whose calculation is described below).
- If the YY value is less than the CENTSPLT value, the the YY value is assumed to be in the
base+1
century.
The value of CENTSPLT is decimal in the range of 00 to 99.
The combined parameters, CENTSPLT and BASECENT, are mutually exclusive with the DEFCENT parameter. If neither is specified, the default is DEFCENT, which is set to the century when the system was started.
The following is an explanation of how the CENTSPLT parameter affects the base century in a 2-digit to a 4-digit year conversion:
- The base century is initially set to the century prefix of the current system date.
- Then, if the last two digits of the current system date are less than the CENTSPLT value, the base century value is decremented by one.
- The new base century is stored.
Some examples follow:
- If the current date is May 23, 1996 with CENTSPLT at 50, BASECENT starts at 19 and, because 96 is greater than 50, BASECENT stays at 19.
- If the current date is May 23, 2006 with CENTSPLT at 50, BASECENT starts at 20, but because 06 is less than 50, BASECENT is decremented to 19.
Attention: Because of the way the base century is calculated, you can get unexpected results if CENTSPLT is set to a value higher than the current year. If you want to maintain the current century, do not set CENTSPLT to a value higher than the current year.
Consider the following scenario: The current date is May 23, 1996 with CENTSPLT at 97. BASECENT starts at 19, but because 96 is less than 97, BASECENT is decremented to 18.
The rule of thumb here is: if the current year is in the lower century of the range split, do not set CENTSPLT to a value higher than the current 2-digit year. In this example, 1996 is in the lower century, so it is very unlikely that you will want to set CENTSPLT higher than the current year (96).
Usage
The following examples show usage of the CENTSPLT parameter:
- The current date is May 23, 1996 with CENTSPLT=50; BASECENT=19 (from the current date, 1996). The date 11/23/90 needs conversion. Because 90 is greater than 50, the date expands to 11/23/1990, because BASECENT is unchanged. If the date were 11/23/05, because 05 is less than 50, so the date expands to 11/23/2005, because BASECENT is incremented.
- The date 11/23/98 needs conversion. Because 98 is greater than 50, the date expands to 11/23/1998, because BASECENT is unchanged. If the date were 11/23/02, then 02 is less than 50, so the date expands to 11/23/2002, because BASECENT is incremented.
The $DateCnv and $DateDif functions have been modified to use these parameters. By default, they use whichever parameter is active.
Alternatively, both these functions have two additional optional arguments (for $DateCnv, arguments 4 and 5, for $DateDif, arguments 5 and 6) that allow the specification of either a DEFCENT value or a CENTSPLT value (in that order) that are in effect for that one function call. Like the parameters, the arguments are mutually exclusive, so you can specify only one of them on a call. For example, to specify a CENTSPLT argument to $DateCnv, the call is:
%A = $DateCnv(fmt1,fmt2,datei,,%CENTSPLT)