Cobol Foro

Cobol Foro (https://www.cobolforo.es/index.php)
-   PowerCOBOL (ActiveX, v4 - v11) (https://www.cobolforo.es/forumdisplay.php?f=9)
-   -   [Sintaxis] ¿Para qué es el PIC 1() BIT ? (https://www.cobolforo.es/showthread.php?t=377)

Kuk 22 de abril de 2016 11:23

¿Para qué es el PIC 1() BIT ?
 
Amigos, pues eso, para qué es el PIC 1? Existe sin BIT y con BIT...

Dasije 23 de abril de 2016 20:28

En base de datos de Microsoft como Access o SQL Server, sería los valores True/False, en COBOL sería un campo numérico de un solo carácter que solo tiene dos números validos 0 y 1.

Código COBOL:
  1. 01 VERDADERO  PIC 1 BIT VALUE  B"1".
  2. 01 FALSO         PIC 1 BIT VALUE  B"0".

Saludos.

Kuk 23 de abril de 2016 22:10

Dasije, según el manual, no es sólo 0 o 1, ùede haber más longitud, es por eso que no me estoy enterando:

Cita:

Example of Insertion of a Slack Bit (1)
Below is an example of a slack bit insertion for the following record description
entry.
Código COBOL:
  1. 01 RECORD-A.
  2. 02 DATA-A1.
  3. 03 DATA-A11 PIC 1(4) BIT.
  4. 03 DATA-A12 PIC 1(3) BIT SYNC.
  5. 03 DATA-A13 PIC 1(5) BIT.
  6. 02 DATA-A2 PIC 1(4) BIT.
DATA-A12 is allocated to a one-byte boundary, so four slack bits are inserted
between DATA-A11 and DATA-A12.
A one-byte area is allocated to DATA-A12, so five slack bits are inserted between
DATA-A12 and DATA-A13.
DATA-A13 is the last internal Boolean data item subordinate to DATA-A1, so three
slack bits are inserted after DATA-A13.
The above record description entry is equivalent to the example shown below.
Código COBOL:
  1. 01 RECORD-A.
  2. 02 DATA-A1.
  3. 03 DATA-A11 PIC 1(4) BIT.
  4. 03 FILLER PIC 1(4) BIT. <-- Slack bit
  5. 03 DATA-A12 PIC 1(3) BIT.
  6. 03 FILLER PIC 1(5) BIT. <-- Slack bit
  7. 03 DATA-A13 PIC 1(5) BIT.
  8. 03 FILLER PIC 1(3) BIT. <-- Slack bit
  9. 02 DATA-A2 PIC 1(4) BIT.
Example of Insertion of a Slack Bit (2)
Below is an example of a slack bit insertion in a group item where an OCCURS clause
has been specified for the following record description entry.
Código COBOL:
  1. 01 RECORD-B.
  2. 02 DATA-B1 OCCURS 10 TIMES.
  3. 03 DATA-B11 PIC 1(5) BIT.
  4. 03 DATA-B12 PIC 1(5) BIT.
DATA-B1 is allocated to begin on a one-byte boundary where DATA-B1 is repeated.
Therefore, six slack bits are inserted after DATA-B12. The slack bits inserting method
is the same as the repetition of DATA-B1.
When an OCCURS clause has been specified in a Boolean data item containing no
SYNCHRONIZED clause, no slack bit is inserted between each table element
occurrence. For example, no slack bit is inserted between each occurrence of DATAC1 in the case shown below.
Código COBOL:
  1. 02 DATA-C1 PIC 1(3) BIT OCCURS 6.



La franja horaria es GMT +2. Ahora son las 14:38.

Powered by: vBulletin, Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.