[Closed] Synonym Time Field from DB2 Numeric Field - Closed but Unsolved
I have a iSeries (AS/400) DB2 numeric column/field. I would like to use that as a time field in WebFOCUS. The value might be 142632 which would be 2:26:32PM.
What is the best way to set up the field in the Synonym?
TIAThis message has been edited. Last edited by: bbollmann,
Brian Bollmann Spartan Light Metal Products WebFocus 7.6.4 / iSeries / WebSphere
December 27, 2008, 05:00 PM
FrankDutch
Brian
I would suggest a compute.
It can be done in several ways
Convert to alpha and do an edit on that computed field alphafield=edit(orgfield) edit(alphafield,'99:99:99')
To get the exact coding I need some manuals, but this gives the direction. It also depends on the question if you need to display it only as time or if you also want to do calculations with it.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
December 30, 2008, 09:16 AM
bbollmann
Field USER8H_ITR is A6 and contains '150000'
I've tried to set up an HHIS field with the EDIT function as below.
DEFINE USER8H_ITR_DEF/HHIS WITH RCSTSH=EDIT(USER8H_ITR,'99:99:99'); TITLE='In Time,(Rounded)', DESCRIPTION='In Time - Rounded', $
In the GUI Synonym editor, the Expression turns red, and when I run Check, I get:
No HTML Output! -------------------------------------------------------------------------------- 0 ERROR AT OR NEAR LINE 1 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC36346) INCORRECT USE OF DATE-TIME FIELD OR CONSTANT
Brian Bollmann Spartan Light Metal Products WebFocus 7.6.4 / iSeries / WebSphere
December 30, 2008, 09:53 AM
FrankDutch
Brian
This might work, but only to display it as a time. It will not be a time field this way.
DEFINE USER8H_ITR_DEF/A8 WITH RCSTSH=EDIT(USER8H_ITR,'99:99:99');
TITLE='In Time,(Rounded)', DESCRIPTION='In Time - Rounded', $
There is a way to do this, but you have to wait till I'm back at the office or till someone else is able to help you.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
December 30, 2008, 03:58 PM
bbollmann
Thanks Frank, I had succeeded at creating such a field before I originally posted. Unfortunately, this is Time and Attendance, so I need to subtract time A from time B.
Brian Bollmann Spartan Light Metal Products WebFocus 7.6.4 / iSeries / WebSphere
January 02, 2009, 05:44 AM
FrankDutch
Brian
This might help a bit.
DEFINE FILE CAR
TIME1/A6 WITH COUNTRY=DECODE COUNTRY('ENGLAND' '163045' 'ITALY' '090522' 'FRANCE' '112500' JAPAN '180000' ELSE '210748');
DISPTIME/A8=EDIT(TIME1,'99:99.99');
AHRS/A2=EDIT(TIME1,'99');
AMIN/A2=EDIT(TIME1,'$$99');
ASEC/A2=EDIT(TIME1,'$$$$99');
TIME1SEC/D10=EDIT(AHRS)*3600+EDIT(AMIN)*60+EDIT(ASEC);
END
TABLE FILE CAR
PRINT TIME1 DISPTIME TIME1SEC
COMPUTE ELAPSEDSEC/D10=IF COUNTRY EQ LAST COUNTRY THEN 0 ELSE TIME1SEC-LAST TIME1SEC;
COMPUTE ELAPSEDHOUR/D7.3=ELAPSEDSEC/3600;
COMPUTE EHOUR/I2=ELAPSEDSEC/3600; NOPRINT
COMPUTE EMIN/I2=(ELAPSEDSEC-EHOUR*3600)/60; NOPRINT
COMPUTE ESEC/I2=(ELAPSEDSEC-EHOUR*3600-EMIN*60); NOPRINT
COMPUTE ETIME/A8=EDIT(EHOUR)|':'|EDIT(EMIN)|'.'|EDIT(ESEC);
BY LOWEST TIME1SEC NOPRINT
BY COUNTRY
END
I first converted the alpha time field to an number of seconds since midnight. If you do that with your time fields you can calculate the number of seconds between the two messure points. The difference is the time in seconds. the orher calculated fields are only to display it as a time.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7