Otros temas que te pueden interesar
|
||||
| Tema | Autor | Foro | Respuestas | Último post |
| [Sintaxis] Campos numericos en SQL Server | Fito | PowerCOBOL (ActiveX, v4 - v11) | 4 | 17 de septiembre de 2020 09:02 |
| [Sintaxis] Campos tipo BLOB mysql | atncasiello | PowerCOBOL (ActiveX, v4 - v11) | 2 | 8 de diciembre de 2018 13:25 |
| Equivalente COBOL a campos Numeric(15,6) | Hrmcobol | Bases de datos | 7 | 3 de febrero de 2016 08:53 |
| [Sintaxis] Campos VARBINARY ó BLOB en COBOL | Josber | COBOL - General | 4 | 3 de diciembre de 2015 13:26 |
| [Sintaxis] Valores numericos y editados | Breew | PowerCOBOL (ActiveX, v4 - v11) | 18 | 31 de marzo de 2015 16:33 |
![]() |
|
Forero Junior
![]()
|
Hola.
Hace un tiempo, en mis añorados foros de ESCOBOL alguien publicó una gran aportación: la equivalencia de los campos numéricos BYTE, SINGLE, DOUBLE, INTEGER, LONG, etc. en COBOL. Si alguien tuvo la precaución de guardar esta información o sabe donde puedo encontrarla, estoy interesado en conseguirla. Un saludo. ---------- Post añadido : 18:55 ---------- Post anterior : 18:09 ---------- Vale, yo mismo me respondo. Debería de haber consultado primero en Internet. Mea culpa. En la página http://documentation.microfocus.com/...BBD971DA4.html he encontrado una tabla de conversión. En el sitio de Microsoft, esta es la información que se puede encontrar: Supported COBOL Data Types COMP-1 A 4-byte, single precision, floating-point Real data type that specifies internal floating-point items. The sign is contained in the first bit of the leftmost byte, and the exponent is contained in the remaining seven bits of that byte. The remaining three bytes hold the mantissa. COMP-2 An 8-byte, double precision, floating-point Real data type that specifies internal floating-point items. The sign is contained in the first bit of the leftmost byte, and the exponent is contained in the remaining seven bits of the first byte. The remaining seven bytes hold the mantissa. COMP-3 Packed Decimal A packed decimal data type that specifies internal decimal items stored in packed decimal format. In the packed decimal format, each byte in a field represents two numeric digits except for the rightmost byte. The rightmost byte holds one digit and the sign. In other words, there are two digits in each character position except for the trailing character position that is occupied by the low-order digit and sign. The item can contain any of the digits from 0 through 9, plus a sign, to represent a value not exceeding 18 decimal digits. For example, the decimal value +123 is represented in two bytes as 0001 0010 0011 1100 in packed decimal format. For more information see, Zoned Decimal or Packed Decimal Data Types. DISPLAY Zoned Decimal An unpacked decimal data type that specifies internal decimal items stored in zoned decimal format. Zoned decimal format is synonymous with unpacked decimal format, which is a format for representing numbers where each digit is contained in bits 4 through 7 and the sign is contained in bits 0 through 3 of the least significant byte. Bits 0 through 3 of all bytes other than the least significant byte contain 1s (hex F). For example, the decimal value +123 is represented in three bytes as 1111 0001 1111 0010 1100 0011 in zoned decimal format. For more information see, Zoned Decimal or Packed Decimal Data Types. DATE and TIME Specifies a date and time by using group item of two PIC 9(7) COMP-3 Packed Decimal value. TIME only Specifies a time by using a PIC 9(7) COMP-3 Packed Decimal value. DATE only Specifies a date by using a PIC 9(7) COMP-3 Packed Decimal value. PIC X Specifies a single character in an Extended Binary Coded Decimal Interchange Code (EBCDIC) character string. EBCDIC is the native representation for character data on mainframes and AS/400s. Unicode is the native representation for character data on Windows-based platforms. PIC X No Translation Specifies a single COBOL character in an EBCDIC character string that is handled as if it were binary data. In other words, there is no translation from EBCDIC to Unicode or from Unicode to EBCDIC. PIC G Specifies a double-byte EBCDIC string. PIC S9(4) COMP (Integer 16-bit) Specifies an integer that is 16 bits, or 2 bytes, in length. PIC S9(9) COMP (Integer 32-bit) Specifies an integer that is 32 bits, or 4 bytes, in length. |
||||||||
|
|
|
|
Administrador
![]()
|
A todo esto puedo añadir lo siguiente: COMP y COMP-4 equivalen y son campos binarios independientes de la máquina. Pero hay una diferencia entre los binarios COBOL y el binario "nativo" que es el COMP-5 y sí es dependiente de la máquina. A diferencia de binarios COBOL, el binario "nativo" puede contener cifras superiores al valor PIC.
Por ejemplo, un PIC S9(4) COMP puede contener de -9999 hasta 9999. Sin embargo PIC S9(4) COMP-5 puede contener de -32768 hasta 32767. Para comunicarnos con el SO u otro software como rutinas C/C++ etc., normalmente se debe usar el binario nativo COMP-5. Resumiendo: Código COBOL:
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 |
||||||||
|
|
|
![]() |
|
|
| Archivo - Cobol Foro | Contactar con Nosotros - Cobol Foro | |||||||