This procedure formats a date, specified in DATE_ARY, according to the convention specified in CNV_NAME. The formatted date is returned in FD_ARY in the language specified by LANG_NAME.
Example
This example formats the date in numeric form using the Netherlands convention. The system default language is specified.
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/CNVFMTDATE.");
DEFINE MAX_NAME_LEN = 17#; % Maximum length of convention
% name
EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], DATE_ARY[0:7], FD_ARY[0:9],
LANG_NAME[0:MAX_NAME_LEN - 1];
INTEGER FD_LEN, RESULT;
REPLACE DATE_ARY BY "17760704";
REPLACE CNV_NAME BY "NETHERLANDS";
RESULT := CNV_FORMATDATE(CS_NDATEV, DATE_ARY, CNV_NAME, LANG_NAME,
FD_LEN, FD_ARY);
WRITE(OUT,<"RESULT = ",J4>,RESULT);
IF RESULT EQL CS_DATAOKV THEN
WRITE(OUT,<"FD_ARY = ",C10>,FD_ARY);
CLOSE(OUT,LOCK);
END.Output
RESULT = 1 FD_ARY = 4.7.76
In this call, the parameters have the following meanings:
CS_NDATEV represents an integer that requests a numeric date format to be returned. It is one of three date format 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. |
DATE_ARY is an EBCDIC array passed to the procedure. It contains the date to be formatted. The date must be in the form YYYYMMDD, 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 date value. The maximum length of each name is 17 characters. 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. The maximum length of each name is 17 characters. 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 and an explanation of the hierarchy.
FD_LEN is an integer returned by the procedure. It contains the length of the formatted date.
FD_ARY is an EBCDIC array returned by the procedure that contains the formatted date.
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_YEAR_YYV (3045) |
|
CS_BAD_ARRAY_DESCRIPTIONV (3000) |
CS_CONVENTION_NOT_FOUNDV (2002) |
|
CS_BAD_DATA_LENV (3002) |
CS_DATAOKV (1) |
|
CS_BADDATEINPUTV (3012) |
CS_FAULTV (1001) |
|
CS_BAD_DAYOFYEARV (3058) |
CS_FIELD_TRUNCATEDV (2003) |
|
CS_BAD_DAYV (3048) |
CS_LANGUAGE_NOT_FOUNDV (2001) |
|
CS_BAD_MONTHV (3047) |
CS_MISSING_MONTH_COMPONENTV (3057) |
|
CS_BAD_TYPE_CODEV (3006) |
CS_MISSING_DATE_COMPONENTV (3059) |
|
CS_BAD_YEARV (3046) |
CS_SOFTERRV (1002) |

