Focal Point
[SOLVED] Current Date and Time

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

August 21, 2009, 11:40 AM
Amber
[SOLVED] Current Date and Time
I'm trying to get the current date and time using the code below:
-SET &TODAY=EDIT(&YYMD, '99999999');
-SET &TIME=HHMMSS('A8');
DEFINE FILE CONTACT
TODAY/YYMD=&TODAY;
TIME1/A8=&TIME;
END
TABLE FILE CONTACT
PRINT
TODAY
TIME1
END

But I receive this error every time:
0 ERROR AT OR NEAR LINE 5 IN PROCEDURE mav_ext_manual_lca
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: 10.39.59
0 ERROR AT OR NEAR LINE 10 IN PROCEDURE mav_ext_manual_lca
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: TIME1
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT

What am I doing wrong?

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


WebFOCUS 768
OS/400
HTML, also quite a few active reports and excel.
August 21, 2009, 11:46 AM
Tom Flynn
Alpha columns require quotes...

TIME1/A8='&TIME';


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
August 21, 2009, 01:59 PM
GamP
You may also have to add quotes for the yymd field ( TODAY/YYMD='&TODAY'; ).


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 21, 2009, 02:14 PM
Tom Flynn
Hey Gamp,

DM treats the TODAY output the same; actually, the answer comes via multiple paths up the WebFOCUS mountain:

You can do this:
 
-SET &TODAY=EDIT(&YYMD, '99999999');
-SET &TIME= '''' || HHMMSS('A8') | '''';
DEFINE FILE WHATEVER
   TIME1/A8      = &TIME;


OR, my response above,

OR

  
DEFINE FILE WHATEVER
 CUR_DATE/A10  = '&DATEYYMD';
 TIME1/A8      = HHMMSS('A8');


Whatever floats your boat!!!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
August 21, 2009, 02:29 PM
GamP
Yeah Tom, I know, there are many ways to do something right (or wrong of course).
As long as the bottom line is that the problem gets solved ....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 21, 2009, 06:55 PM
Frans
Do you really want to get the date and time separately? If not, you can use the HGETC function.


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
August 24, 2009, 08:44 AM
Amber
HGETC worked great! Thanks!!


WebFOCUS 768
OS/400
HTML, also quite a few active reports and excel.