%MSECONDS Built-In Functions in rpgle
%MSECONDS converts a number into a duration that can be added to a time or timestamp value to affect its no. of microseconds.
Format of the function is %MSECONDS (Number of Microseconds).
Example –%msseconds built-in function in rpgle
Columns . . . : 6 80 AMIT/QRPGSRC
SEU==> TESTRPG
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
*************** Beginning of data *****************************************
0001.00 DTIMESTP0 S Z
0002.00 DTIMESTP1 S Z
0003.00 DTIMESTP2 S Z INZ(Z'2011-02-01-01.48.46.72800')
0004.00 DTIMESTP3 S Z
0005.00 C TIME TIMESTP0
0006.00 C EVAL TIMESTP1=TIMESTP0 + %MSECONDS(2)
0007.00 C TIMESTP0 DSPLY
0008.00 C TIMESTP1 DSPLY
0009.00 C EVAL TIMESTP3=TIMESTP2 - %MSECONDS(2)
0010.00 C TIMESTP2 DSPLY
0011.00 C TIMESTP3 DSPLY
0012.00 C SETON LR
****************** End of data ********************************************
Output
2013-02-01-01.57.17.492000
2013-02-01-01.57.17.492002
2011-02-01-01.48.46.728000
2011-02-01-01.48.46.727998