Tech Talk: Variable-length Edit Words?

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: