使用concatenate連線時,字串型別(String)要比字元型別(C)快

TolyHuang發表於2007-12-07

Character and String Manipulation:

Depending on the length of the character field,
string operation may be faster.
The concatenate algorithm has to compute the length of
the fixed character fields by scanning the first
non-blank character from the end.

[@more@]

data string1 type string.
data string2 type string.
data string3 type string.

string1 = 'mysap'.
string2 = '.com'.
concatenate string1 string2 into string3.

以上程式碼的速度要比下面的程式碼快:

data c1(200) type c.
data c2(200) type c.
data c3(400) type c.

c1 = 'mysap'.
c2 = '.com'.
concatenate c1 c2 into c3.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9437124/viewspace-989431/,如需轉載,請註明出處,否則將追究法律責任。

相關文章