I have a program that orders tables, but I do not know why in recorrer-tabla
is highlighted in red and says "not a data name". On the other hand, if I place it a few lines above it takes it, but it does not do what I ask it to do is order the table.
This is my code:
program-id. Program1 as "ConsoleApplication2.Program1".
data division
working-storage section.
01 tabla pic 99 occurs 20
indexed by indice.
01 hora.
05 filler pic 9(6).
05 hx pic 99.
01 variable-aux pic 99.
01 variable-paso pic 99.
procedure division.
set indice to 1
perform rellenar-tabla until indice > 20
set indice to 1
perform display-tabla until indice > 20
move 1 to variable-aux
perform ordenar-numeros until variable-aux > 20
stop ' '
display '--------------------------------'
set indice to 1
perform display-tabla until indice > 20
perform recorrer-tabla until indice > 20
set indice to 1
stop ' '
goback.
rellenar-tabla.
display spaces upon crt
display ' ' line 01 column 05
accept hora from time
move hx to tabla(indice)
set indice up by 1
display hx line 02 column 05
stop ' '.
display-tabla.
display tabla(indice)
set indice up by 1.
ordenar-numeros.
set indice to variable-aux
perform recorrer-tabla until indice > 20
add 1 to variable-aux
recorrer-tabla.
if tabla(variable-aux) > tabla(indice)
move tabla(variable-aux) to variable-paso
move tabla(indice) to variable-paso
move variable-paso to tabla(indice)
end-if
set indice up by 1.
end program Program1.