Longchar and substring

JKampmeijer

New Member
I want to transfer the data stored in a longchar to a character variable(s),
by assigning parts of the longchar.

I'm using substring as adviced in the Progress documentation: Work with LONGCHAR data
But when the substring crosses the 32K limit, i get error 9324.

I use Progress version 11.7
But the ABL Dojo with version 12.6 has the same result.

Is there a way to accomplish this?

Code:
def var lv_long as longchar no-undo.
def var c as int no-undo.
def var i as int no-undo.
def var lv_short as char no-undo.

do i = 1 to 60000:
    assign c = random(30,122)
           lv_long = lv_long + chr(c).
end.


assign lv_short = substring(lv_long,1,20000).
message "1: " length(lv_short).
assign lv_short = substring(lv_long,20001,40000).
message "2: " length(lv_short).

Result:
1: 20000
Attempt to exceed maximum size of a CHARACTER variable. (9324)

Seems that the second substring does not work.
Code:
def var lv_long as longchar no-undo.
def var lv_long2 as longchar no-undo.
def var c as int no-undo.
def var i as int no-undo.
def var lv_short as char no-undo.

do i = 1 to 60000:
    assign c = random(30,122)
           lv_long = lv_long + chr(c).
end.

assign lv_long2 = substring(lv_long,20001,40000).
message "1: " length(lv_long2).

Result:
1: 40000
 
Last edited:
Hi
In the second substring you are tryiong to store 40.000 characters in the CHARACTER variable, hence the error.
I believe you want to store only 20.000, from 20.001 to 40.000, if this is the case:
assign lv_short = substring(lv_long,20001,20000).
++
 
Back
Top