|
The length conversion code performs string length constraint checks. It works identically on input and output conversions and has three forms:
| L | Returns the length of the string being converted. |
| Ln | Returns the original string if its length is less than or equal to n. Otherwise it returns a null string. |
| Ln,m | Returns the original string if its length is greater than or equal to n and less than or equal to m. Otherwise it returns a null string. |
| LW | Returns the display length of the string being converted. |
| LWn | Returns the original string if its display length is less than or equal to n. Otherwise it returns a null string. |
| LWn,m | Returns the original string if its display length is greater than or equal to n and less than or equal to m. Otherwise it returns a null string. |
Note that on ECS systems, the default behaviour of the L conversion code checks character counts, not display width. This may be significant if the string includes double width characters. Use of the optional W qualifier after the L causes the conversion code to use the string's display width. On non-ECS systems, the W qualifier is ignored.
Examples
Conversion
|
Data
|
Result
|
L
|
1234
|
4
|
L3
|
A
|
A
|
L3
|
AB
|
AB
|
L3
|
ABC
|
ABC
|
L3
|
ABCD
|
|
L2,3
|
A
|
|
L2,3
|
AB
|
AB
|
L2,3
|
ABC
|
ABC
|
L2,3
|
ABCD
|
|
|