Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
I don't know if this is the most efficient way of doing it, but here is a sample rexx. You can expand it to process the complete dataset.
Code:
/******************rexx*******************/
string = '0M 60M 128K'
parse var string col1 col2 col3 .
do i = 1 to 3
interpret "temp = col"i
select
when pos('K',temp) \= 0 then do
interpret "col"i "=" (substr(temp,1,(pos('K',temp)-1))) * 1024
end
when pos('M',temp) \= 0 then do
interpret "col"i "=" (substr(temp,1,(pos('M',temp)-1))) * 1048576
end
otherwise
end
end
string = left(col1,10) || left(col2,10) || left(col3,10)
say string
ou = ""
sz = 16
do while ( in \= "" )
parse var in tk in
tk = translate(tk)
mf = right(tk,1)
if datatype(mf,"M") then ,
tk = strip(tk,,mf)
else ,
mf = "B"
if ( symbol("mult."mf) = "VAR" ) then ,
ou = ou || left(tk * mult.mf,sz," ")
else ,
ou = ou || copies("*",sz-1)" "
end
say ">>"ou"<<"
(*) it is one of my pet peeves to decouple the real coding from the control data
adding a new multiplier factor will not make the coding to change
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
doing it with sort could be pretty boring ...
I thought of taking up some of that, before I get to my much boring work . There could be better ways, but here is one of them that I can think of now.