Robert Prins
2023-03-09 16:37:16 UTC
I've got this little piece of code, that just collects some data from a file,
and it's supposed to print it in sorted order. It just doesn't, all cn. stem
values come out as the highest value in the nc. stem.
What am I doing wrong?
regina: REXX-Regina_3.9.3(MT) 5.00 5 Oct 2019 (64 bit). All rights reserved.
OS: W7-Pro 64.
/* REXX */
address system "type lift.dat" with output stem l.
naco = ''
nc. = ''
!nc = 0
do ! = 1 to l.0
if substr(l.!, 66, 1) = '!' |, -- 4125
left(l.!, 1) = '{' |, -- 3917
l.! = '' |, -- 3692
substr(l.!, 66, 1) = '#' then -- 428
iterate !
nat = left(strip(space(substr(l.!, 43, 4), 0), 'T', ','), 5, '.')
cnty = left(strip(space(substr(l.!, 54, 3), 0), 'T', ','), 5, '.')
if pos(nat, naco) = 0 then
do
naco = naco || nat
!nc = !nc + 1
nc.!nc = nat
end
if cnty \= '*....' &,
pos(cnty, naco) = 0 then
do
naco = naco || cnty
!nc = !nc + 1
nc.!nc = cnty
end
end
nc.0 = !nc
address path "sort.exe" with input stem nc. output stem cn.
do ! = 1 to !nc
say right(!, 3) cn.!nc
end
and it's supposed to print it in sorted order. It just doesn't, all cn. stem
values come out as the highest value in the nc. stem.
What am I doing wrong?
regina: REXX-Regina_3.9.3(MT) 5.00 5 Oct 2019 (64 bit). All rights reserved.
OS: W7-Pro 64.
/* REXX */
address system "type lift.dat" with output stem l.
naco = ''
nc. = ''
!nc = 0
do ! = 1 to l.0
if substr(l.!, 66, 1) = '!' |, -- 4125
left(l.!, 1) = '{' |, -- 3917
l.! = '' |, -- 3692
substr(l.!, 66, 1) = '#' then -- 428
iterate !
nat = left(strip(space(substr(l.!, 43, 4), 0), 'T', ','), 5, '.')
cnty = left(strip(space(substr(l.!, 54, 3), 0), 'T', ','), 5, '.')
if pos(nat, naco) = 0 then
do
naco = naco || nat
!nc = !nc + 1
nc.!nc = nat
end
if cnty \= '*....' &,
pos(cnty, naco) = 0 then
do
naco = naco || cnty
!nc = !nc + 1
nc.!nc = cnty
end
end
nc.0 = !nc
address path "sort.exe" with input stem nc. output stem cn.
do ! = 1 to !nc
say right(!, 3) cn.!nc
end
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html