CNV_CONVERTDATE_STAR

This procedure converts a formatted numeric date passed as a parameter to the procedure to the format YYYYMMDD. The numeric date must be formatted according to the numeric date format template defined in the designated convention set.

Example

This example converts a date from ASERIESNATIVE numeric form to standard input form. The ASERIESNATIVE ccsversion is used.

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/CNVCONVERTDATSTAR.");
  DEFINE MAX_NAME_LEN        = 17#;    % Maximum length of convention
                                       % name
  EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], CD_ARY[0:9], DATE_ARY[0:7];
  INTEGER VSN_NUM, CD_ARY_SIZE, CNV_NAME_SIZE, DATE_ARY_SIZE, RESULT;

  VSN_NUM := 0;
  REPLACE CD_ARY BY "09/15/1990";
  REPLACE CNV_NAME BY "ASERIESNATIVE";
  CD_ARY_SIZE := SIZE(CD_ARY);
  CNV_NAME_SIZE := SIZE(CNV_NAME);
  DATE_ARY_SIZE := SIZE(DATE_ARY);
  RESULT := CNV_CONVERTDATE_STAR(VSN_NUM, CD_ARY, CD_ARY_SIZE,
                                 CNV_NAME, CNV_NAME_SIZE,
                                 DATE_ARY, DATE_ARY_SIZE);
  WRITE(OUT,<"RESULT   = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
    WRITE(OUT,<"DATE_ARY = ",C8>,DATE_ARY);
  CLOSE(OUT,LOCK);
END.

Output

RESULT   = 1
DATE_ARY = 19900915

In this call, the parameters have the following meanings:

VSN_NUM is an integer passed to the procedure. It contains the ccsversion number that was in effect when date was formatted. If the input string contains alternate digits, then they will be translated to their corresponding 0-9 numbers. Refer to the MultiLingual System Administration, Operations, and Programming Guide for a list of the ccsversion numbers.

The values allowed for VSN_NUM and the meanings of the values are as follows:

Value

Meaning

Greater than or equal to 0

Use the specified ccsversion number.

–2

Use the system default ccsversion. If the system default ccsversion is not available, an error is returned.

CD_ARY is an EBCDIC array passed to the procedure. It contains the formatted date.

CD_ARY_SIZE is an integer that contains the total number of bytes in CD_ARY.

CNV_NAME is an EBCDIC array passed to the procedure. It contains the name of the convention from which the date formatting templates are retrieved.

CNV_NAME_SIZE is an integer that contains the total number of bytes in CNV_NAME.

DATE_ARY is an EBCDIC array returned by the procedure. It contains the converted date in the form YYYYMMDD.

DATE_ARY_SIZE is an integer that contains the total number of bytes in DATE_ARY.

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_BAD_YEARV (3046)

CS_BAD_DATA_LENV (3002)

CS_CONVENTION_NOT_FOUNDV (2002)

CS_BADDATEINPUTV (3012)

CS_DATA_NOT_FOUNDV (4002)

CS_BAD_DATESEPARATORV (3044)

CS_DATAOKV (1)

CS_BAD_DAYV (3048)

CS_FAULTV (1001)

CS_BAD_MONTHV (3047)

CS_FILE_ACCESS_ERRORV (1000)

CS_BAD_TEMPCHARV (3011)

CS_NO_DATEINPUTV (3049)

CS_BAD_TYPE_CODEV (3006)

CS_SOFTERRV (1002)