Skip to main content
mejoras de formato y código
Origen Enlace
Alvaro Montoro
  • 49.8k
  • 28
  • 109
  • 190

Problema con Error: not a data name en programa cobol

program-id. Program1 as "ConsoleApplication2Tengo un programa que ordena tablas, pero no sé por qué en recorrer-tabla se me subraya en rojo y dice "not a data name".Program1" En cambio, si lo ubico unas lineas más arriba lo toma, pero no hace lo q pido q es ordenar la tabla.

Éste es mi código:

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.

Hola que tal quisiera saber si alguien sabe porqe en "recorrer-tabla" se me subraa en rojo y dice no a data name, en cambio si lo ubico unas lineas mas arriba lo toma, pero no hace lo q pido q es ordenar la tabla ,

Problema con cobol

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.

Hola que tal quisiera saber si alguien sabe porqe en "recorrer-tabla" se me subraa en rojo y dice no a data name, en cambio si lo ubico unas lineas mas arriba lo toma, pero no hace lo q pido q es ordenar la tabla ,

Error: not a data name en programa cobol

Tengo un programa que ordena tablas, pero no sé por qué en recorrer-tabla se me subraya en rojo y dice "not a data name". En cambio, si lo ubico unas lineas más arriba lo toma, pero no hace lo q pido q es ordenar la tabla.

Éste es mi código:

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.
Origen Enlace

Problema con cobol

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.

Hola que tal quisiera saber si alguien sabe porqe en "recorrer-tabla" se me subraa en rojo y dice no a data name, en cambio si lo ubico unas lineas mas arriba lo toma, pero no hace lo q pido q es ordenar la tabla ,