Sie sind auf Seite 1von 5

Tablas

Nro Nivel nombre pic _ _ occurs nroentero1 [TO nroentero2] [TIMES]

DEPPENDING ON variable2

01 Reg_Alumnos

05 NIF PIC x(9)

05 nro-asig-present PIC 9

05 Asignaturas occurs 2 to 6 DENDING nro-asig-present

10 nota PIC 99.

10 cod-asig PIC xxx.

NIF nro Asig1 Asig2 Asig3 Asig6

11x 2 5 10

11xy 4 7 9 3 2

222J 6 1 2 3 4 5 6

331P 7

Working

01 Medias

05 Media-asig OCCURS 2 TO 6 DEPENDING total-asig-pres

01 total-asig-pres PIC 9

***

SENTENCIA OCCURS.-

También permite decir si los datos de esa tabla estarán o no ordenados

Nro Nivel nombre pic _ _ occurs nroentero1 [TO nroentero2] [TIMES]

[DEPPENDING ON variable2]

[ASCENDING/DESCENDING [KEY IS] key_tab_va_ordenado ]

[INDEXED [BY] índice ]

01 Reg_Alumnos

05 NIF PIC x(9)


05 nro-asig-present PIC 9

05 Asignaturas occurs 2 to 6 DEPENDING nro-asig-pres

ASCENDING cod-asig

INDEXED by Ind.

10 cod-asig PIC xxx.

10 Nota PIC 99.

SALIDA:

Cod1 Asig1 Cod2 Asig2 Cod6 Asig6


……………

ALG 5 Cal 7 Rel 10

***

Perform

Varying ind-asig from 1 by 1

Until ind-asig > 6

Or cod-asig(ind-asig) = ‘Fis’

End-Perform

If ind-asig > 6

No encontrado.

Else

End-if.

En working debo tener def el índice :

01 ind-asig PIC 9.

****

[INDEXED [BY] índice ]

Donde índice .- se autodefine, cobol la define.

Similar a esta definición :


01 ind2 Pic 9.

01 ind-asig USAGE index.

[USAGE display] .- x defecto el uso de all var es de uso display

 Cod-asig(ind) indexacion
X Cod-asig(ind-asig)

X Cod-asig(ind2) => subscripcion

Como se asignas valores a variables USAGE INDEX :

No se puede usar move para asignar valores

Se hace con

SET índice TO => entero/variable/Indice2

 SET ind TO 3
 SET ind To ind2
 SET ind To índice
 SET ind2 To 1 (ERROR)

SENTENCIA DE BUSQUEDA SEARCH:

BUSQUEDA SECUENCIAL:

SINTAXIS:

SEARCH nomb-tabla

[AT END instrucx….instrucn]

WHEN cond1 instrc1

WHEN cond2 instrc2

WHEN condn instrcn

END-SEARCH

***

SET ind-asig TO 4

SEARCH ASIGN

AT END Display ‘No existe Asig’


WHEN cod-asig(ind-asig)=’Fis’

DISPLAY Nota(ind-asig)

END-SEARCH

BUSQUEDA BINARIA.- cuando los datos esta ordenado, evita realizar preguntas. .. es esto?,no , el sgte…

SEARCH ALL nomb-tabla

[AT END instrucx….instrucn]

WHEN cond1 instrc1

END-SEARCH

SET ind-asig TO 4

SEARCH ALL ASIGN

AT END Display ‘No existe Asig’

WHEN cod-asig(ind-asig)=’Fis’

DISPLAY Nota(ind-asig)

END-SEARCH

http://www.escobol.com/modules.php?name=Sections&op=viewarticle&artid=25

https://www.lawebdelprogramador.com/foros/Cobol/1326434-TABLAS-COBOL.html

https://medium.com/enredando-con-programacion/cobol-tablas-6547425e5a9

https://www.tutorialspoint.com/es/cobol/cobol_table_processing.htm

http://www.mundohost.es/2016/04/12/busqueda-secuencial-en-una-tabla-cobol/

http://www.dinoland.com.ar/phpBB3/viewtopic.php?t=900

https://cobolcics.wordpress.com/2010/12/14/tabla-bidimensional/

https://studylib.es/doc/5978395/manual-b%C3%A1sico-cobol.txt
https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tptbl
20.htm

http://jlbv.com/cobol2005.pdf

http://coboleross.foroactivo.com/t21-estandar-de-estructura-de-un-programa-cobol

https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tptbl
27.htm

Das könnte Ihnen auch gefallen