foreach-tmp.p
1 |
define temp-table udftest |
---|---|
2 |
field id as integer |
3 |
field fdate as date |
4 |
field fmt as character |
5 |
field fstr-result as character |
6 |
index pk as primary id |
7 |
. |
8 |
|
9 |
create udftest. id = 1. fdate = date(07, 19, 2021). fmt = '999999'. fstr-result = "071921". |
10 |
create udftest. id = 2. fdate = date(07, 19, 2021). fmt = '99999999'. fstr-result = "07192021". |
11 |
create udftest. id = 3. fdate = date(07, 05, 2021). fmt = '9.9.99'. fstr-result = "7.5.21". |
12 |
create udftest. id = 4. fdate = date(07, 05, 2021). fmt = '99999'. fstr-result = ?. |
13 |
create udftest. id = 5. fdate = date(07, 15, 2021). fmt = '99.999.9999'. fstr-result = "10.015.2021". |
14 |
create udftest. id = 6. fdate = date(07, 15, 2021). fmt = '99.9999.9999'. fstr-result = "10.0015.2021". |
15 |
|
16 |
OUTPUT TO foreach-tmp.txt. |
17 |
def var err-flag as logical no-undo. |
18 |
|
19 |
outer: |
20 |
do on stop undo, leave outer: |
21 |
FOR EACH udftest NO-LOCK WHERE string(fdate, fmt) = fstr-result : |
22 |
message 'inside loop'. |
23 |
err-flag = false. |
24 |
message udftest.id ERROR-STATUS:ERROR ERROR-STATUS:NUM-MESSAGES AVAILABLE udftest. |
25 |
END. |
26 |
end. |
27 |
message 'done' err-flag. |
28 |
|
29 |
OUTPUT CLOSE. |