Ü SUBDUR (Subtract Duration)
·
SUBDUR operation code
is used to perform arithmetic difference of duration in factor-2 from DATE,
TIME, or TIMESTAMP value in factor-1. The result is placed in result field.
·
Valid
duration codes are *YEARS, *MONTHS, *DAYS, *HOURS, *MINUTES, *SECONDS,
*MSECONDS.
·
Abbreviated
duration codes can also be used: *Y, *M, *D, *H, *MN, *S, *MS.
Factor 1
|
OpCode
|
Factor 2
|
Result Field
|
Resulting Indicators
HI LO EQ
|
DATE, TIME, or TIMESTAMP
value
|
SUBDUR(E)
|
Duration value : Duration code
|
Difference of
factor-1 from factor-2
|
|
Error Indicator
|
|
Example
Columns . . . : 6 80 Browse AMINEM/QRPGLESRC
SEU==> DATE_TIME2
FMT D DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ***********************************************************
0001.00 DDATE0 S D 130124
0002.00 DDATE1 S D 130124
0003.00 DDATE2 S D 130124
0004.00 DDATE3 S D 130124
0005.00 DTIME0 S T 130124
0006.00 DTIME1 S T 130124
0007.00 DTIME2 S T 130124
0008.00 DTIME3 S T 130124
0009.00 DTIMESTP0 S Z 130124
0010.00 DTIMESTP1 S Z 130124
0011.00 C MOVEL *DATE DATE0 130124
0012.00 C DATE0 SUBDUR 01:*Y DATE1 130124
0013.00 C DATE0 SUBDUR 01:*M DATE2 130124
0014.00 C DATE0 SUBDUR 01:*D DATE3 130124
0015.00 C TIME TIME0 130124
0016.00 C TIME0 SUBDUR 01:*H TIME1 130124
0017.00 C TIME0 SUBDUR 01:*MN TIME2 130124
0018.00 C TIME0 SUBDUR 01:*S TIME3 130124
0019.00 C TIME TIMESTP0 130124
0020.00 C TIMESTP0 SUBDUR 11111:*MS TIMESTP1 130124
0021.00 C DATE0 DSPLY 130124
0022.00 C DATE1 DSPLY 130124
0023.00 C DATE2 DSPLY 130124
0024.00 C DATE3 DSPLY 130124
0025.00 C TIME0 DSPLY 130124
0026.00 C TIME1 DSPLY 130124
0027.00 C TIME2 DSPLY 130124
0028.00 C TIME3 DSPLY 130124
0029.00 C TIMESTP0 DSPLY 130124
0030.00 C TIMESTP1 DSPLY 130124
0031.00 C SETON LR 130124
****************** End of data *********************************************************
OUTPUT
2013-01-24
2012-01-24
2012-12-24
2013-01-23
06.42.30
05.42.30
06.41.30
06.42.29
2013-01-24-06.42.30.275000
2013-01-24-06.42.30.263889
Ü SUBDUR opcode used to
find the no. of duration between two dates.
Factor 1
|
OpCode
|
Factor 2
|
Result Field
|
Resulting Indicators
HI LO EQ
|
DATE, TIME, or
TIMESTAMP value
|
SUBDUR(E)
|
DATE, TIME, or
TIMESTAMP value
|
Duration: Duration code
|
|
Error Indicator
|
|
Example
Columns . . . : 6 80 Browse AMITCC/QRPGLESRC
SEU==> DATE_TIME5
FMT D DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ************************************************************
0001.00 DDATE1 S D INZ(D'2013-12-11') 130206
0002.00 DDATE2 S D 130206
0003.00 DTIME1 S T INZ(T'12.11.10') 130206
0004.00 DTIME2 S T 130206
0005.00 DTIMESTP1 S Z INZ(Z'2013-12-24-06.42.30.263889') 130206
0006.00 DTIMESTP2 S Z 130206
0007.00 C MOVEL *DATE DATE2 130206
0008.00 C DATE1 SUBDUR DATE2 DAYSDIFF:*D 5 0 130206
0009.00 C TIME TIME2 130206
0010.00 C TIME1 SUBDUR TIME2 HOURDIFF:*H 5 0 130206
0011.00 C TIME TIMESTP2 130206
0012.00 C TIMESTP1 SUBDUR TIMESTP2 MICRODIFF:*MS 5 0 130206
0013.00 C DATE1 DSPLY 130206
0014.00 C DATE2 DSPLY 130206
0015.00 C DAYSDIFF DSPLY 130206
0016.00 C TIME1 DSPLY 130206
0017.00 C TIME2 DSPLY 130206
0018.00 C HOURDIFF DSPLY 130206
0019.00 C TIMESTP1 DSPLY 130206
0020.00 C TIMESTP2 DSPLY 130206
0021.00 C MICRODIFF DSPLY 130206
0022.00 C SETON LR 130124
****************** End of data ***************************************************************
OUTPUT
2013-12-11
2013-02-06
308
12.11.10
07.52.34
4
2013-12-24-06.42.30.263889
2013-02-06-07.52.34.244000
19889