ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/CEESECS.htm

446 lines
13 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Convert Timestamp to Number of Seconds (CEESECS) API</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- ILE4A SCRIPT A converted by B2H R4.1 (346) (CMS) by NLJONES at -->
<!-- RCHVMX on 25 Feb 1999 at 10:53:17 -->
<!--Edited by Kersten Oct 2001 -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>Convert Timestamp to Number of Seconds (CEESECS) API</h2>
<div class="box" style="width: 65%;">
<br>
&nbsp;&nbsp;Required Parameter Group:<br>
<!-- iddvc RMBR -->
<br>
<table width="100%">
<tr>
<td align="center" valign="top" width="10%">1</td>
<td align="left" valign="top" width="40%">input_timestamp</td>
<td align="left" valign="top" width="25%">Input</td>
<td align="left" valign="top" width="25%">VSTRING</td>
</tr>
<tr>
<td align="center" valign="top">2</td>
<td align="left" valign="top">picture_string</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">VSTRING</td>
</tr>
<tr>
<td align="center" valign="top">3</td>
<td align="left" valign="top">output_seconds</td>
<td align="left" valign="top">Output</td>
<td align="left" valign="top">FLOAT8</td>
</tr>
</table>
<br>
&nbsp;&nbsp;Omissible Parameter:<br>
<!-- iddvc RMBR -->
<br>
<table width="100%">
<tr>
<td align="center" valign="top" width="10%">4</td>
<td align="left" valign="top" width="40%">fc</td>
<td align="left" valign="top" width="25%">Output</td>
<td align="left" valign="top" width="25%">FEEDBACK</td>
</tr>
</table>
<br>
&nbsp;&nbsp;Service Program Name: QLEAWI<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The Convert Timestamp to Number of Seconds (CEESECS) API converts a string
representing a timestamp into a number representing the number of seconds since
00:00:00 14 October 1582. This API makes it easier to do time calculations,
such as the elapsed time between two timestamps.</p>
<!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. -->
<!-- Instead, use the commented out coding below to indicate NONE. -->
<h3>Authorities and Locks</h3>
<!-- Use this if there are no authorities and locks. -->
<p>None.</p>
<br>
<h3>Required Parameter Group</h3>
<dl>
<dt><strong>input_timestamp (input by descriptor)</strong></dt>
<dd>A character string representing a date or timestamp in the format shown by
<strong>picture_string</strong>. The field width is 5 through 255 characters.
<strong>Input-timestamp</strong> may contain leading or trailing blanks. After
a valid date or timestamp is parsed, remaining characters are ignored. Valid
dates are in the range 15 October 1582 to 31 December 9999. A full date must be
specified. Valid times are in the range 00:00:00.000 to 23:59:59.999.
<p>If any part or all of the time value is omitted, zeros are substituted for
the remaining values. For example,</p>
<pre>
1988-05-17-19:02 is equivalent to 1988-05-17-19:02:00
1988-05-17 is equivalent to 1988-05-17-00:00:00
</pre>
</dd>
<dt><strong>picture_string (input by descriptor)</strong></dt>
<dd>A character string indicating the format of the date or timestamp value in
<strong>input_timestamp</strong>, for example
<pre>
YY/MM/DD
HH.MI.SS.
</pre>
Each character in <strong>picture_string</strong> represents a character in
<strong>input_timestamp</strong>. If delimiters such as the slash (/) appear in
the picture string, leading zeros may be omitted. For example, these calls
assign the same value to the variable <em>secs</em>.
<pre>
CALL CEESECS('88/06/03 15.35.03',
'YY/MM/DD HH.MI.SS', secs, fc);
CALL CEESECS('88/6/3 15.35.03' ,
'YY/MM/DD HH.MI.SS', secs, fc);
CALL CEESECS('88/6/3 3.35.03 PM',
'YY/MM/DD HH.MI.SS AP', secs, fc);
CALL CEESECS('88.155 3.35.03 pm',
'YY.DDD HH.MI.SS AP', secs, fc);
</pre>
<p>See <a href="CEEDAYS.htm#TBLPICHAR">Picture Characters Used in Picture
Strings</a> for a list of valid picture characters, and <a href=
"CEEDAYS.htm#TBLPICXMP">Examples of Picture Strings Recognized by ILE Date and
Time APIs</a> for examples of valid picture strings.</p>
<p>If <strong>picture_string</strong> is null or blank, CEESECS obtains
<strong>picture_string</strong> based on the current job value for the country
or region ID (CNTRYID). For example, if the current job value for CNTRYID is US
(United States), the date format is <samp>MM/DD/YYYY</samp>. If the current job
value for CNTRYID is FR (France), the date format is <samp>DD.MM.YYYY</samp>.
<p>This default mechanism makes it easy not only for translators to specify the
preferred date format, but also for application programs and library routines
to automatically use this format.</p>
</dd>
<dt><strong>output_seconds (output)</strong></dt>
<dd>A 64-bit double floating-point number representing the number of seconds
since 00:00:00 on 14 October 1582. For example, 00:00:01 on 15 October 1582 is
second 86&nbsp;401 (24*60*60 + 01). 19:00:01.12 on 16 May 1988 is second
12&nbsp;799&nbsp;191&nbsp;601.12. The largest value that can be represented is
23:59:59.999 on 31 December 9999, which is second
265&nbsp;621&nbsp;679&nbsp;999.999.
<p><strong>Note:</strong> A 64-bit double floating-point value can accurately
represent approximately 16 significant decimal digits without loss of
precision. Therefore, accuracy is available to the nearest millisecond (15
decimal digits).</p>
<p>If <strong>input_timestamp</strong> does not contain a valid date or
timestamp, <strong>output_seconds</strong> is set to 0 and CEESECS ends with a
nonzero feedback code.</p>
</dd>
</dl>
<br>
<h3>Omissible Parameter</h3>
<dl>
<dt><strong>fc (output)</strong></dt>
<dd>A 12-byte feedback code passed by reference. If specified as an argument,
feedback information (a condition token) is returned to the calling routine. If
not specified, and the requested operation was not successfully completed, the
condition is signaled to the condition manager.</dd>
</dl>
<br>
<h3>Feedback Codes and Conditions</h3>
<table cellpadding="3">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top">CEE0000</td>
<td align="left" valign="top">The API completed successfully</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 00</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE0501</td>
<td align="left" valign="top">The operational descriptor data type is not
valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE0502</td>
<td align="left" valign="top">Missing operational descriptor</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 00</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2508</td>
<td align="left" valign="top">The value for day is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2509</td>
<td align="left" valign="top">The value for era is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2510</td>
<td align="left" valign="top">The value for hour is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2513</td>
<td align="left" valign="top">The value for Lilian date is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2515</td>
<td align="left" valign="top">The value for millisecond is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2516</td>
<td align="left" valign="top">The minute value is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2517</td>
<td align="left" valign="top">The value for month is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2518</td>
<td align="left" valign="top">The picture string specification is not
valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2519</td>
<td align="left" valign="top">The value for second is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2521</td>
<td align="left" valign="top">The value for year is not valid</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE2525</td>
<td align="left" valign="top">Timestamp picture mismatch</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">CEE9902</td>
<td align="left" valign="top">Unexpected user error occurred in &amp;1</td>
</tr>
<tr>
<td align="left" valign="top">Severity: 30</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
</table>
<br>
<h3>Usage Notes</h3>
<ul>
<li>
<p>The inverse of CEESECS is CEEDATM. The CEEDATM API converts <strong>
output_seconds</strong> to character format.</p>
</li>
<li>
<p>Elapsed time calculations can be performed easily on the <strong>
output_seconds</strong>, because it represents elapsed time. Leap year and
end-of-year anomalies are avoided.</p>
</li>
<li>
<p>See <a href="CEESCEN.htm">Set Century (CEESCEN) API</a> and <a href=
"CEEQCEN.htm">Query Century (CEEQCEN) API</a> for information on 2-digit
years.</p>
</li>
<li>
<p>If <strong>picture_string</strong> includes a Japanese era symbol <em>
&lt;JJJJ&gt;</em>, the <em>YY</em> position in <strong>input_timestamp</strong>
is assumed to contain the year within Japanese era. See <a href=
"CEEDAYS.htm#TBLPICXMP">Examples of Picture Strings Recognized by ILE Date and
Time APIs</a> for an example. See <a href="CEEDAYS.htm#TBLERANAME">Japanese
Eras Used by ILE Date and Time APIs When &lt;JJJJ&gt; Specified</a> for a list
of the Japanese eras recognized by CEESECS.</p>
</li>
<li>
<p>If <strong>picture_string</strong> includes an ROC era symbol <em>
&lt;CCCC&gt;</em> or <em>&lt;CCCCCCCC&gt;</em> , the <em>YY</em> position in
<strong>input_timestamp</strong> is assumed to contain the year within ROC era.
See <a href="CEEDAYS.htm#TBLPICXMP">Examples of Picture Strings Recognized by
ILE Date and Time APIs</a> for an example. See <a href="CEEDAYS.htm#TBLROCERA">
Republic of China Eras Used by ILE Date and Time APIs When &lt;CCCC&gt; or
&lt;CCCCCCCC&gt; Specified</a> for a list of the ROC eras recognized by
CEESECS.</p>
</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<ul>
<li>
<p>Calculate the difference between two timestamps, in hours:</p>
<pre>
CALL CEESECS ('19880516190001','YYYYMMDDHHMISS',
secs1, fc);
CALL CEESECS ('1988-05-17-03.00.01',
'YYYY-MM-DD-HH.MI.SS', secs2, fc);
diff = (secs2 - secs1) / 3600;
/* Assume floating-point division */
</pre>
</li>
<li>Convert a timestamp to number of seconds, to calculate the date and time 36
hours ago:
<pre>
now = '1988/07/26 19:55:00';
CALL CEESECS (now, 'YYYY/MM/DD HH:MI:SS', secs, fc);
secs = secs - 36*60*60;
CALL CEEDATM (secs, 'YYYY/MM/DD HH:MI:SS', before,
fc);
</pre>
</li>
</ul>
<br>
<hr>
API introduced: V2R3
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"ile1a1.htm">ILE CEE APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>