Ver Mensaje Individual
  #27
Antiguo 17 de noviembre de 2019, 21:52
Kuk
Administrador
Última Actividad 21.09.2026 18:24
Posts Posts: 2.500
Likes enviados Enviados: 1037
Likes recibidos Recibidos: 1207

Socavi, lo que tienes es un problema de algoritmo. Es decir, haces

Código COBOL:
  1.            INVOKE Lista 'Add' USING 1 1 RETURNING RETORNO
  2.            MOVE 'ListItems'(RETORNO) OF Lista TO LINEA

fuera del IF, así que por cada registro se crea un nuevo ListItem.

Hazlo así:

Código COBOL:
  1.          move 0 to TOTMUNIPOB TOTMUNISUP
  2.          close munici.
  3.          open input MUNICI.
  4.          INITIALIZE REGMUNI.
  5.          invoke Lista 'Clear'
  6.          move ' ' to finfic move 0 to cuantos
  7.          perform until finfic = 's'
  8.             read MUNICI next record at end move 's' to finfic
  9.                not at end
  10.                IF MUNIPRO = V-COD
  11.                   INVOKE Lista 'Add' USING 1 1 RETURNING RETORNO *> modivo
  12.                   MOVE 'ListItems'(RETORNO) OF Lista TO LINEA *> dentro del IF
  13.                   MOVE MUNICOD TO 'Text'(1) OF LINEA
  14.                   MOVE MUNICP  TO 'Text'(2) OF LINEA
  15.                   move MUNINOM to 'Text'(3) of linea
  16.                   move MUNIGEN TO 'Text'(4) of linea
  17.                   move MUNIPOB to 'Text'(5) of linea
  18.                   move MUNISUP to 'Text'(6) of linea
  19.                   perform calcul thru fi-calcul
  20.                   move MUNIKM  TO 'Text'(8) of linea
  21.                   add 1 to cuantos
  22.                 END-IF
  23.             end-read
  24.          end-perform.
  25.      
  26.          close MUNICI.



NORMAS DEL FORO - para garantizar el buen funcionamiento del Foro.
¿Te han ayudado? NO TE OLVIDES de darle a
¿Quieres dirigirte a alguien en tu post? Notifícale haciendo clic en su Nick
Kuk is offline   Responder Con Cita