Communicator 3000 MPE/iX Release 6.0 (Platform Software Release C.60.00) (30216-90269)

Chapter 9 135
Year 2000 Enhancements
New Date Intrinsics for MPE/iX
Pascal Example of New Date Intrinsics.
$standard_level 'hp_modcal'$
Program dateintr(input,output);
{Constants for the different date types.}
const
hp_dt_mpe_time_stamp_fmt = 1;
hp_dt_packed_yymmdd_fmt = 2;
hp_dt_packed_yyddd_fmt = 3;
hp_dt_new_calendar_fmt = 4;
hp_dt_posix_time_stamp_fmt = 10;
hp_dt_calendar_fmt = 14;
hp_dt_int_yymmdd_fmt = 15;
hp_dt_int_mmddyy_fmt = 16;
hp_dt_int_ddmmyy_fmt = 17;
hp_dt_int_yyyymmdd_fmt = 18;
hp_dt_ascii_yymmdd_fmt = 25;
hp_dt_ascii_mmddyy_fmt = 26;
hp_dt_ascii_ddmmyy_fmt = 27;
hp_dt_mm3000_yymmdd_fmt = 35;
hp_dt_mm3000_mmddyy_fmt = 36;
hp_dt_mm3000_ddmmyy_fmt = 37;
hp_dt_ascii_yyyymmdd_fmt = 38;
{Type definitions for the program}
type
pac_20 = packed array [1..20] of char;
iptr_type = ^integer;
VAR
date2_pac : pac_20; {Dates in packed character arrays.}
fmt_pac : pac_20;
print_pac : pac_20;
cutoff : integer; {To represent cutoff date.}
date1 : integer; {Working dates.}
date1_18 : integer;
date2_18 : integer;
date3_18 : integer;
i : integer; {temp variables.}
inptype : integer;
j : integer;
outtype : integer;
print_len : integer; {Length of formatted date.}
temp_date : integer; {Another temp variable}
status : integer;
function HPCALENDAR : integer; intrinsic;
procedure HPFMTCALENDAR; intrinsic;
function HPDATEVALIDATE : integer; intrinsic;
procedure HPDATEFORMAT ; intrinsic;
procedure HPDATECONVERT ; intrinsic;
procedure HPDATEOFFSET ; intrinsic;
procedure HPDATEDIFF ; intrinsic;
begin
{Initialize the variables.}
cutoff := 50;
inptype := hp_dt_int_ddmmyy_fmt;
date2_pac := '960121'; {The YYMMDD date in Supported format '25'.}
date1 := 230196; {The DDMMYY date in Supported format '17'.}
{conversion from one non standard formatto another}
HPDATECONVERT(inptype,date1,hp_dt_ascii_yymmdd_fmt,fmt_pac,
status,cutoff);
if( status <> 0) then