CNV_SYSTEMDATETIME

This procedure obtains the current system date and time and formats them according to the specified convention. Date and time components are translated to the natural language designated in LANG_NAME. The system computes both the date and time from the result of a single TIME(206) function call. Thus, the possibility that the date and time are split across midnight does not exist.

Example

This example formats system date and time according to formatting definitions in the ASERIESNATIVE convention. The form of date and time is specified by CS_LDATENTIMEV (long date and numeric time). Formatted date and time are translated to English and returned in SDT_ARY.

BEGIN

 $ INCLUDE INTL="*SYMBOL/INTL/ALGOL/PROPERTIES." 10000000 - 49999999

  FILE OUT(KIND=DISK,UNITS=CHARACTERS,MYUSE=IO,FILETYPE=0,NEWFILE,
           MAXRECSIZE=80,TITLE="OUT/ALGOL/CNVSYSDATETIME.");
  DEFINE MAX_NAME_LEN        = 17#;    % Maximum length of convention
                                       % name
  EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], SDT_ARY[0:59],
               LANG_NAME[0:MAX_NAME_LEN - 1];
  INTEGER DATE_LEN, RESULT, SDT_LEN;

  REPLACE CNV_NAME BY "ASERIESNATIVE";
  REPLACE LANG_NAME BY "ENGLISH";
  RESULT := CNV_SYSTEMDATETIME(CS_LDATENTIMEV, CNV_NAME, LANG_NAME,
                                  DATE_LEN, SDT_LEN, SDT_ARY);
  WRITE(OUT,<"RESULT  = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
    WRITE(OUT,<"SDT_ARY = ",C60>,SDT_ARY);
  CLOSE(OUT,LOCK);
END.

Output

RESULT  = 1
SDT_ARY = Friday, November 9, 1990 10:31:30

In this call, the parameters have the following meanings:

CS_LDATENTIMEV represents an integer that requests the long date and time format to be returned. It is one of eleven options:

Value

Value Name

Meaning

0

CS_LDATEV

Use the long date format.

1

CS_SDATEV

Use the short date format.

2

CS_NDATEV

Use the numeric date format.

3

CS_LTIMEV

Use the long time format.

4

CS_NTIMEV

Use the numeric time format.

5

CS_LDATELTIMEV

Use the long date and long time format.

6

CS_LDATENTIMEV

Use the long date and numeric time format.

7

CS_SDATELTIMEV

Use the short date and long time format.

8

CS_SDATENTIMEV

Use the short date and numeric time format.

9

CS_NDATELTIMEV

Use the numeric date and long time format.

10

CS_NDATENTIMEV

Use the numeric date and numeric time format.

CNV_NAME is an EBCDIC array passed to the procedure. It contains the name of the convention to be used to edit the date and time value. If this parameter contains all blanks or zeros, the procedure uses the hierarchy to determine the convention to be used. Refer to the MultiLingual System Administration, Operations, and Programming Guide for the list of convention names and the explanation of the hierarchy.

LANG_NAME is an EBCDIC array passed to the procedure. It contains the language to be used in formatting the date and time value. If this parameter contains all blanks or zeros, the procedure uses the hierarchy to determine the language to be used. Refer to the MultiLingual System Administration, Operations, and Programming Guide for information about determining the valid language names on the system being used and the explanation of the hierarchy.

DATE_LEN is an integer returned by the procedure. It specifies the length of the formatted date portion of the date and/or time. If this parameter is 0 (zero), there is no formatted date in the output. If both date and time are presented in the output, the formatted date is separated from the formatted time by a blank. The extra character is reflected in the length of the formatted date.

SDT_LEN is an integer returned by the procedure that specifies the total length of the formatted date and/or time.

SDT_ARY is an EBCDIC array returned by the procedure that contains the formatted date and/or time. The recommended size of this array is 96 characters.

RESULT is an integer returned by the procedure. It indicates whether or not an error occurred during the execution of the procedure. An explanation of the error result values and messages can be found at the end of this section. The values returned by this procedure include:

CS_ARRAY_TOO_SMALLV (3001)

CS_BAD_YEARV (3046)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_BAD_YEAR_YYV (3045)

CS_BAD_DAYOFYEARV (3058)

CS_CONVENTION_NOT_FOUNDV (2002)

CS_BAD_DAYV (3048)

CS_DATAOKV (1)

CS_BAD_HOURV (3051)

CS_FAULTV (1001)

CS_BAD_MINUTEV (3053)

CS_FIELD_TRUNCATEDV (2003)

CS_BAD_MONTHV (3047)

CS_INCOMPLETE_DATAV (2004)

CS_BAD_PSECONDV (3055)

CS_LANGUAGE_NOT_FOUNDV (2001)

CS_BAD_SECONDV (3054)

CS_MISSING_DATE_COMPONENTV (3059)

CS_BAD_12HOURV (3052)

CS_MISSING_MONTH_COMPONENTV (3057)

CS_BAD_TYPE_CODEV (3006)

CS_SOFTERRV (1002)