A Critique of the Proposed National Education Policy Reform
as400 built in function- %CHAR
1. Find many more at website: www.go4as400.com
A programming guide to learn AS400
%CHAR
It converts date, time, timestamp, or numeric expression to character data type.
Examples
I.
Conversion from TIMESTAMP format to character string.
0072.00
0073.00
0074.00
0075.00
0076.00
0077.00
0078.00
* CALCULATE THE TIME FOR THE CURRENT SYSTEM DATE
EVAL
TIMESTP=%TIMESTAMP()
EVAL
TIME_IS=%TIMESTAMP()
EVAL
TIME_ISO=%char(TIME_IS:*iso0)
EVAL
CURRYEAR=%dec(%SUBST(TIMe_ISO:1:4):4:0)
EVAL
CURRMONTH=%dec(%SUBST(TIMe_ISO:5:2):2:0)
EVAL
CURRDAY=%dec(%SUBST(TIMe_ISO:7:2):2:0)
C
C
C
C
C
C
OUTPUT
TIME_IS = '2012-05-18-07.11.00.926000'
TIME_ISO = '20120518071100926000'
CURRYEAR=2012
CURRMONTH=05
CURRDAY=18
II.
Conversion of packed decimal to alphanumeric type
Find many more at website: www.go4as400.com
A programming guide to learn AS400