Ü  %DEC numeric expression {:digits : dec pos}

It is used to convert numeric or character expression to packed decimal format. We can mention the number of digits and the decimal position.

 

Example –%dec built-in function in rpgle


0072.00  * CALCULATE THE TIME FOR THE CURRENT SYSTEM DATE
0073.00 C                   EVAL      TIMESTP=%TIMESTAMP()
0074.00 C                   EVAL      TIME_IS=%TIMESTAMP()
0075.00 C                   EVAL      TIME_ISO=%char(TIME_IS:*iso0)
0076.00 C                   EVAL      CURRYEAR=%dec(%SUBST(TIMe_ISO:1:4):4:0)

 

 

OUTPUT

 

TIME_IS = '2012-05-18-07.11.00.926000'             
TIME_ISO = '20120518071100926000'
CURRYEAR=2012

 

 

 





User Comments:





Copyright © Go4as400.com, 2013-2017. Copyright notice