Focal Point
[SOLVED] Convert alpha date and time fields for date subtraction

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7567061326

August 14, 2012, 09:03 AM
Tomsweb
[SOLVED] Convert alpha date and time fields for date subtraction
In my master file I have a date field (Recdate) stored as an A6. Recdate: 800801

And there is a time field (Rectime) stored as an A4 Rectime: 0314

In a define I have converted the Recdate field to a I6YMD field and used DATECVT to arrive at the full year w slashes.

quote:

DEFINE FILE MMEXT
IDATE/I6YMD WITH WO = EDIT(RECDATE);
ITIME/I6 WITH WO = EDIT(RECTIME);
DATE2/YYMD = DATECVT(IDATE,'I6YMD','YYMD');
DATE3/A8YYMD = DATE2;
ATDT/A14 = RECDATE || (' ' | RECTIME);
ATDTA/A14 = DATE3 || (' ' | RECTIME);
END


I am trying to concat the recdate and rectime fields together into one variable to subtract it from another date/time field.

I have been away from WF for some time and I am trying to get up to speed without much grief from the alpha date / smart date grind.

Can anyone give me some pointers?

Thanks!

This message has been edited. Last edited by: Tomsweb,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
August 16, 2012, 02:58 PM
Kerry
Hi Tom,

Glad to see this issue is resolved, would you mind to share your solution please? Thanks in advance.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
August 17, 2012, 09:02 AM
jgelona
Here's one solution.
DEFINE FILE MACGYVER
  ADATE/A6YMD='800801';
  ADATE2/A8YYMD=DATECVT(ADATE,'A6YMD','A8YYMD');
  ATIME/A4='0314';
  ADTTM/A12=ADATE2 | ATIME;
  HDATE/HYYMDS=HINPUT(12,ADTTM,8,'HYYMDS');
END
TABLE FILE MACGYVER
PRINT HDATE
IF COUNTER EQ 1
END


produces: 1980/08/01 03:14:00


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.