可変長フィールドの長さを設定するために使用する %LEN

この関数を式の左側で使用すると、可変長フィールドの現在の長さが設定されます。 設定する長さが現在の長さより大きい場合、 古い長さと新しい長さの間のフィールド内の文字数は ブランクに設定されます。
注: パラメーターが可変長である場合、および *MAX が指定されていない場合、%LEN は式の左側でしか 使用できません。
図 1. 可変長フィールドに %LEN を使用する例
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
D*Name++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++
 *
D city            S             40A   varying inz('North York')
D n1              S              5i 0

 * %LEN used to get the current length of a variable-length field:
 /FREE
    n1 = %len(city);
    // Current length, n1 = 10
 
    // %LEN used to set the current length of a variable-length field:
    %len (city) = 5;
    // city = 'North' (length is 5)
 
    %len (city) = 15;
    // city = 'North          '  (length is 15)
 /END-FREE