例1:
D p1 S *
D p2 S *
D Result S 1A INZ
D Diff S 5S 0 INZ
C alloc 20 p1
C EVAL %STR(P1:20) ='abcdefghij'
C EVAL Result = %STR(P1:1)
C DSPLY Result
C EVAL P2 = P1 + 8
C EVAL Result = %STR(P2:1)
C DSPLY Result
C EVAL P2 = P2 - 1
C EVAL Result = %STR(P2:1)
C DSPLY Result
C EVAL Diff = P2 - P1
C DSPLY Diff
C DEALLOC P1
C*
C SETON LR
C RETURN
例2:
H DATFMT(*ISO)
D Date S D INZ(D'2010-03-29')
D DatDS DS BASED(PTR)
D YYYY 4 0
D Y_sep 1
D MM 2 0
D D_sep 1
D DD 2 0
D*
D PTR S 16*
D vYear S 4 0
D vMM S 2 0
D vDD S 2 0
C EVAL PTR = %ADDR(Date)
C EVAL vYear = YYYY
C EVAL vMM = MM
C EVAL vDD = DD
C DSPLY vYear
C DSPLY vMM
C DSPLY vDD
C*
C SETON LR
C RETURN
阅读(764) | 评论(0) | 转发(0) |