CNV_FORMATTIME

This procedure formats a user-supplied time and identifies the kind of template to be retrieved from the named convention and used to format time. The formatted time is returned in the user-specified language.

Example

This example formats the time in numeric form using the Belgium convention. The formatted time is returned in FT_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/CNVFMTTIME.");
  DEFINE MAX_NAME_LEN        = 17#;    % Maximum length of convention
                                       % name
  EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], FT_ARY[0:7],
               LANG_NAME[0:MAX_NAME_LEN - 1], TIME_ARY[0:9];
  INTEGER FT_LEN, RESULT;

  REPLACE TIME_ARY BY "114958";
  REPLACE LANG_NAME BY "ENGLISH";
  REPLACE CNV_NAME BY "BELGIUM";
  RESULT := CNV_FORMATTIME(CS_NTIMEV, TIME_ARY, CNV_NAME, LANG_NAME,
                           FT_LEN, FT_ARY);
  WRITE(OUT,<"RESULT = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
    WRITE(OUT,<"FT_ARY = ",C8>,FT_ARY);
  CLOSE(OUT,LOCK);
END.

Output

RESULT = 1
FT_ARY = 11:49:58

In this call, the parameters have the following meanings:

CS_NTIMEV represents an integer that requests the numeric time format be returned. This integer is one of two options:

Value

Value Name

Meaning

3

CS_LTIMEV

Use the long time format.

4

CS_NTIMEV

Use the numeric time format.

TIME_ARY is an EBCDIC array passed to the procedure. It contains the time to be formatted in the form HHMMSS, left justified. The fields of the array have fixed positions. Blanks or zeros must be used in any fields that are omitted.

CNV_NAME is an EBCDIC array passed to the procedure. It contains the name of the convention to be used to edit the 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 time. 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.

FT_LEN is an integer that contains the length of FT_ARY.

FT_ARY is an EBCDIC array returned by the procedure. It contains the time value formatted according to the specified convention and language.

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_12HOURV (3052)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_BAD_TYPE_CODEV (3006)

CS_BAD_DATA_LENV (3002)

CS_CONVENTION_NOT_FOUNDV (2002)

CS_BAD_HOURV (3051)

CS_DATAOKV (1)

CS_BAD_MINUTEV (3053)

CS_FAULTV (1001)

CS_BAD_PSECONDV (3055)

CS_FIELD_TRUNCATEDV (2003)

CS_BAD_SECONDV (3054)

CS_LANGUAGE_NOT_FOUNDV (2001)

CS_BAD_TEMPCHARV (3011)

CS_SOFTERRV (1002)

CS_BADTIMEINPUTV (3013)