Kbase 17706: accessing -yy value from the 4gl
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
accessing -yy value from the 4gl
INTRODUCTION:
=============
Accessing the value of the -yy parameter in V8 is very simple, You
simply access the Session:YEAR-OFFSET attribute. In earlier releases
where the YEAR-OFFSET is not available, a code example to do this is
in the dlc/src/prodict/_dctyear.p procedure.
_dctyear.p is a procedure that is used by the data administration/data
dictionary tool. The source for this procedure is supplied with your
progress installation.
Essentially the code needed is as follows:
======================================================================
DEFINE VAR yy as INTEGER INITIAL ? NO-UNDO. DEF VAR i as INT NO-UNDO.
/* Check the current century first */
DO i = 1900 to 2000 while yy = ?:
IF LENGTH(STRING(DATE(1,1,i))) = 8 AND
LENGTH(STRING(DATE(1,1,i + 99))) = 8
THEN yy = i.
END.
/* if not the current century then check 1000 through 1900 */
DO i = 1000 TO 1900 while yy = ?:
IF LENGTH(STRING(DATE(1,1,i))) = 8 AND
LENGTH(STRING(DATE(1,1,i + 99))) = 8
THEN yy = i.
END.
/* if not between 1000 and 2000 then check numbers through 9900 */
DO i = 2000 TO 9900 WHILE yy = ?:
IF LENGTH(STRING(DATE(1,1,i))) = 8 AND
LENGTH(STRING(DATE(1,1,i + 99))) = 8
THEN yy = i.
END.
MESSAGE "The value of the current century is " yy.
======================================================================
Accurate as of (2/1998)
Progress Software Technical Support Note # 17706