%EDITW (使用編輯字組來編輯值)

%EDITW(numeric : editword)

此函數會傳回字元結果,代表根據 編輯字組所編輯的數值。 數值及編輯字組的規則與在輸出規格中編輯數值的規則相同。

第一個參數中不接受浮點表示式。 使用 %DEC 將浮點數轉換為可編輯的格式。

編輯字組必須是字元常數。

如需相關資訊,請參閱 轉換作業內建函數

圖 1. %EDITW 範例
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
D*Name++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++
D amount          S             30A
D salary          S              9P 2
D editwd          C                    '$ ,   ,  **Dollars&  &Cents'

 * If the value of salary is 2451.53, then the edited version of
 * (salary * 12) is '$***29,418*Dollars 36 Cents'. The value of
 * amount is 'The annual salary is $***29,418*Dollars 36 Cents'.

 /FREE
   amount = 'The annual salary is '
                 + %editw(salary * 12 : editwd);
 /END-FREE