Date Conversion Utility

Easytrieve Plus provides utilities to convert dates. Unfortunately, it only works when the date fields are numeric. It cannot handle dates in formats such as mm/dd/yy.

This utility encompasses the same features as the Easytrieve Plus DATECONV utility but also includes non-numeric date formats.

Date formats are general, like DATECONV formats, but permit non-numeric formats. Certain format elements are key, and are are searched for by this utility, namely:

Whichever of these elements is used in either an input or output format must be present in the other (output or input) format, with one exception. Century may be part of the output format without being specified as part of the input format.

When finished, the routine issues a return code, indicating the success of the routine.

The routine is useable in Easytrieve Plus or Cobol. Easytrieve Plus uses an Include. Cobol programs can issue a direct call to the routine.

Easytrieve Plus Include

The Include member is IS9045B. It does the actual interface to the conversion program (IS9045A). This include uses the following 5 arguments:

  1. Input Date: This is the date to be reformatted (up to 10 bytes).
  2. Input Date Format: Specifies the format of the date to be reformatted, using DD to indicate which is the day, MM to indicate the month, CC to indicate the century (if any) and YY to indicate the year (minus the century). For example, a date of 01/25/1993 would have a format of MM/DD/CCYY and a date of 199507 would have a format of CCYYMM.
  3. Output date: This is the output date after formatting (up to 10 bytes).
  4. Output Date Format: Specifies the format in which the date is to be returned. Uses the same scheme as input date. For example, an input date of 10/15/98 in MM/DD/YY format would be output as 10-15-98 with an output format of MM-DD-YY and would be 10*15*1998 with an output format of MM*DD*CCYY.
  5. Return Code: Indicates the status of the date conversion effort. The following statuses may be returned:

The IS9045B Include is invoked as follows:

%IS9045B vvv 'www' xxx 'yyy' zzz

where vvv is the variable containing the input date. www is the input date format. xxx is the variable containing the output date. yyy is the output date format and zzz is the variable representing the return variable.

Mechanics

This routine scans the input date format. It seeks the positions of MMDD, CC and YY. It finds the positions of these in the output format as well. It then places the output format into the output date field and proceeds to move data from input date to output date based on the positions (if any) that are found.

JCL Requirements

No special JCL is required to use this routine.

Example

A sample program (call it TEST01) might look as follows:


MACRO
FILE FILE01
   WDATEIN           W           008 A   VALUE '10151998'
   WDATEOUT          W           010 A
   WRTNCD            W           001 A

JOB INPUT NULL
  %IS9045B WDATEIN 'MMDDCCYY' WDATEOUT 'MM%DD%CCYY' WRTNCD
  DISPLAY 'DATE IN= ' WDATEIN
  DISPLAY 'DATE OUT=' WDATEOUT
  DISPLAY 'RETURN CODE=' WRTNCD
  STOP

This is a very simplistic example of use of the IS9045A routine. It will return 10%15%1998 when finished with a return code of 0.

Limitations

Technical

The IS9045B Easytrieve Plus routine calls a Cobol routine called IS9045A.

All variables used by this routine have a suffix of ## to prevent duplicate variable names. Should a program using this routine use the same convention, see the IS9045B Include module for variable definitions.


OIT--Applications Support


Last Modified: Tuesday, 28-Nov-2000 10:34:41 CST

©2000 All Rights Reserved