Hello all!
One of my programs goes into a strange error on NAT 6.1.1
I reduced the code to the following:
define data local
1 testview view SAG-TOURS-G-PERSON
2 nachname /* (A20)
2 vorname-1 /* (A20)
2 titel /* (A20)
2 anrede /* (A8)
1 #a50 (A50) init <'INIT'>
1 #i2 (I2)
1 #array(1:1)
2 #a15 (A15)
2 #a4 (A4)
2 #N5 (N5)
end-define
*
#i2 := 1
write 'before compress' #i2 #a50
compress numeric #array(#i2) testview into #a50
with all delimiters ";"
write 'after compress' #i2 #a50
#array.#a4(#i2) := "X" /* NAT1316
*
end
Output on Solaris:
before compress 1 INIT
after compress 15153 INIT
Output on Natural for Windows:
before compress 1 INIT
after compress 12603 INIT
Error 1: The compress fails
Error 2: #i2 was changed
:shock:
Regards
Matthias
Maybe you got the English sample-views in your Natural-Installation…
define data local
1 testview view SAG-TOURS-E-PERSON
2 surname /* (A20)
2 first-name-1 /* (A20)
2 title /* (A20)
2 form-of-address /* (A8)
1 #a50 (A50) init <'INIT'>
1 #i2 (I2)
1 #array(1:1)
2 #a15 (A15)
2 #a4 (A4)
2 #N5 (N5)
end-define
*
#i2 := 1
write 'before compress' #i2 #a50
compress numeric #array(#i2) testview into #a50
with all delimiters ";"
write 'after compress' #i2 #a50
#array.#a4(#i2) := "X" /* NAT1316
*
end
Looks like you need to upgrade! Works in v6.3.2:
before compress 1 INIT
after compress 1 ;;0;;;;
Thank you!
Yes, we really need to upgrade. It’s no surprise to me that I get that answer from Software AG.
BTW: It look’s like the compress statement writes something into #i2.
define data local
1 testview view SAG-TOURS-E-PERSON
2 surname /* (A20)
2 first-name-1 /* (A20)
2 title /* (A20)
2 form-of-address /* (A8)
1 #a50 (A50) init <'INIT'>
1 #i2 (I2)
1 redefine #i2
2 #a2 (A2)
1 #array(1:1)
2 #a15 (A15)
2 #a4 (A4)
2 #N5 (N5)
end-define
*
#i2 := 1
compress numeric #array(#i2) testview into #a50
with all delimiters 'X'
write '=' #i2 '=' #a2
#i2 := 1
compress numeric #array(#i2) testview into #a50
with all delimiters ';'
write '=' #i2 '=' #a2
*
end
output:
#I2: 12632 #A2: X1
#I2: 12603 #A2: ;1
Matthias1
(Matthias)
5
Now at home on my PC with Natural 6.2.3@Win2k (community edition)
before compress 1 INIT
after compress 12603 INIT
Hi Matthias;
Like Douglas, I cannot “play” with the problem since I am on 6.3.7, and the bug does not exist there.
Have you tried COMPRESS without NUMERIC?
If not, see what it gives you.
steve
Matthias1
(Matthias)
7
No - good idea.
before compress 1 INIT
after compress 12603 INIT
… on Nat6.2.3 PL0
But it works, if you compress the single fields of the view. Like that:
compress numeric #array(#i2)
testview.surname
testview.first-name-1
testview.title
testview.form-of-address
into #a50 with all delimiters ";"
Matthias1
(Matthias)
8
And this results in a NAT0938:
compress numeric #array(1) testview into #a50
… we talked about an update today.