9 25 CONCAT

LANSA Technical

9.25 CONCAT

Þ Note: Built-In Function Rules.

Concatenates up to five alphanumeric strings to form one string as a return value. No truncation of trailing blanks is performed by this function.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

YES

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

U

Req

1st string to concatenate

1

Unlimited

 

 

2

U

Req

2nd string to concatenate

1

Unlimited

 

 

3

U

Opt

3rd string to concatenate

1

Unlimited

 

 

4

U

Opt

4th string to concatenate

1

Unlimited

 

 

5

U

Opt

5th string to concatenate

1

Unlimited

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

U

Req

Concatenated result string

1

Unlimited

 

 

2

N

Opt

Length of returned string

1

15

0

0

 

 

Technical Notes

This Built-In function contains two consecutive operations:

1. Concatenate the input strings.

   The length of the resulting string then is put into the second returning field (if it is provided). The concatenation goes through all the input strings unless the length of the resulting string is bigger than the maximum possible length of the first returning field type. In this case, the concatenation will stop and the second returning field will have the value of the maximum possible length of the first returning field type.

2. Assign the resulting string into the first returning field.

   If the length of the returning field is smaller that the length of the resulting string, the last will be truncated.

Therefore, the value of the second returning field is not the length of the string in the first returning field.

For the maximum possible length of a field type please refer to Field Type Considerations.

Examples

USE BUILTIN(CONCAT) WITH_ARGS(#VAL1 #VAL2 #VAL3 #VAL4 #VAL5) TO_GET(#VAL6 #SIGN150)
 

Example number

#VAL1 length

#VAL2  length

#VAL3 length

#VAL4 length

#VAL5 length

#VAL6 max length

#VAL6 type

#SIGN150 returned value

Example 1

2

2

2

2

2

7

Alpha

10

Example 2

256

2

2

2

2

7

Alpha

256

 

 

In Example 1, all 5 input fields contain 2 characters strings. Even the #VAL6 can take up to only 7 bytes, the #SIGN150 gets back 10, which is 2 +2 +2 +2 +2.

In Example 2, the concatenation stops at #VAL2 because the resulting string length is bigger than 256, which is the maximum possible length of an Alphanumeric field (#VAL6 type). #The SIGN150 value is 256.

In both examples #VAL6 returns only 7 characters.