Operations on alphanumeric fields
= Assignment
This assigns an alphanumeric field, hexadecimal fixed value or Null value to an alphanumeric field.
FieldR = Field1/Constant/Null
FieldR receive the content of Field1.
On AS/400 IBMi, if the alphanumeric nature of Field1 and FieldR are different (CHAR and NCHAR), the content is automatically translated to the nature of the FieldR.
O.DESCRIPTION = I.DESCR
O.DESCRIPTION(10:1) = ‘@’
O.DESCRIPTION(11:1) = X’09’
LTRIM – Trim left blanks (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It trims the leading blanks in a string and places the result in another string.
LTRIM b.Field1/Constant TO b.Field2
DCL W.Field_1 CHAR 15
DCL W.Field_2 CHAR 15
W.Field_1 = ‘ TEST ’
LTRIM W.Field_1 TO W.Field_2
TRACE W.field_2
'TEST' trace
RTRIM – Trim right blanks (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It trims the trailing blanks in a string and places the result in another string.
RTRIM b.Field1/Constant TO b.Field2
DCL W.Field_1 CHAR 15
DCL W.Field_2 CHAR 15
W.Field_1 = ‘ TEST ’
RTRIM W.Field_1 TO W.Field_2
TRACE W.field_2
'TEST' trace
TRIM – Trim left and right blanks (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It trims the leading and trailing blanks in a string and places the result in another string.
TRIM b.Field1/Constant TO b.Field2
DCL W.Field_1 CHAR 15
DCL W.Field_2 CHAR 15
W.Field_1 = ‘ TEST ’
TRIM W.Field_1 TO W.Field_2
TRACE W.field_2
'TEST' trace
CONCAT – Concatenate (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It concatenates the contents of two strings and places the result in a third string.
CONCAT b.Field1/Constant WITH b.Field2/Constant TO b.Field3
DCL W.Field_1 CHAR 10
DCL W.Field_2 CHAR 10
DCL W.Field_3 CHAR 20
W.Field_1 = ‘ TEST ’
W.Field_2 = ‘ 1234 ’
CONCAT W.Field_1 WITH W.Field_2 TO W.Field_3
TRACE W.field_3
'TEST 1234' trace
LEN – String length (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It sends the length of the contents of a string to a numeric field.
LEN b.Field1/Constant TO b.Field2/N@n
DCL W.Field_1 CHAR 10
DCL W.Field_2 NUMERIC 5
W.Field_1 = ‘ TEST ’
LEN W.Field_1 TO W.Field_2
TRACE W.Field_2
'6' trace
VAL – Convert alpha to numeric (non-AS/400 IBMi)
This is available only on non-AS/400 IBMi sources or targets.
It places the result of an alpha to numeric conversion in a field.
STR b.Field1/N@n TO b.Field2/N@n
DCL W.Field_1 CHAR 15
DCL W.Field_2 NUMERIC 9,2
W.Field_1=‘ -15.2’
VAL W.Field_1 TO W.Field_2
TRACE W.field_2
-15.20 trace