Convert STRING to MATH w/out using RPG

Frosty the Coder

Legendary Poster

I have a legacy table where ORDER# is in an alpha field, left justified, zero suppressed.
LINE# is split into two alpha fields, one for each side of the decimal, left justified, zero suppressed.

I have to try to marry this to F4211 and do it quickly.

I've tried using the DIGITS operand, to convert F4211_mnDOCO to an alpha
but this does not zero suppress, and therefore doesn't match Legacy_szDOCO.
Query, and WorldWriter don't have "PAD" or "TRIM" operands to make this easy.

I may be having a "can't see the forest due to the trees" moment, but I can't figure out
how to do this w/out coding an RPG (which I've been told NOT to do).



Well Known Member
Can you only use Query and/or Worldwriter? With SQL it is easy...

(partial solution, if you can't figure out how to deal with the line #, please reply and I'll show you how...)


Create table qtemp/ordchar (ordnbr char(10) not null with default);

insert into qtemp/ordchar values('52465');

with temp (doco) as (select cast(trim(ordnbr) as numeric(8,0)) from ordchar)
select *from f4211
join temp on sddoco = doco;
Last edited: