Q: We want to pass an edit word and nine-digit decimal value with two decimal places to a program and receive back an edited string. The called program uses the QECCVTEW and QECEDT APIs to carry out the editing.
We would like the capability of choosing whether or not the edited string includes a floating dollar sign. Here's our problem: Edit words that include a floating dollar sign have to be one character larger than those that do not include the dollar sign. Passing an edit word that is too long or too short generates a CPF27AF error.
Is it possible to include a dollar sign sometimes and omit it other times? -BeckyBryning A: An edit word has to have a blank for each digit. Since you're passing in a nine-digit number, you'll need nine blanks. A zero (to end zero suppression) can count for one of the digits. So the edit word must be 12 characters long (nine for the digits, one for the decimal point, and two for the commas.)
If you want a floating dollar sign, you'll have to make the edit word one character larger. Otherwise, one of the digits won't fit when the first digit is not zero.
If you want to be able to pass in a dollar sign sometimes and not pass one in at other times, use two different edit words. One will have the dollar sign, and the other will have a leading or trailing ampersand (&), which forces a blank. So your two 13-byte edit words would be as shown below:
'bb,bbb,b$0.bb'
and
'b,bbb,bbb.bb&'
So you don't need two different-sized edit words.
-TedHolt
LATEST COMMENTS
MC Press Online