Bonjour,
Il parait que la représentation interne des données numériques packées (COMP-3) est différente en COBOL entre GCOS7 et Z/OS : existe-t-il quelque part une table de conversion ou de correspondance ?
Merci d'avance.
Bonjour,
Il parait que la représentation interne des données numériques packées (COMP-3) est différente en COBOL entre GCOS7 et Z/OS : existe-t-il quelque part une table de conversion ou de correspondance ?
Merci d'avance.
Tu es sûr de cela ?
Voici ce que dit la documentation COBOL z/OS (V6R3) :
PACKED-DECIMAL and COMP-3 are synonyms. Packed-decimal items occupy 1 byte of storage for every
two decimal digits you code in the PICTURE description, except that the rightmost byte contains only one
digit and the sign. This format is most efficient when you code an odd number of digits in the PICTURE
description, so that the leftmost byte is fully used. Packed-decimal items are handled as fixed-point
numbers for arithmetic purposes.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 PIC S9999 PACKED DECIMAL + 1234 01 23 4C PIC S9999 COMP-3 - 1234 01 23 4D
Que dit la documentation GCOS7 ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 PIC 9999 PACKED DECIMAL 1234 01 23 PIC 9999 COMP-3
Bonjour,
Si on en croit cette documentation page 154, c'est effectivement différent du Z/OS :
https://support.bull.com/ols/product...et_language=en
Le signe en Z/OS c'est C (positif), D (négatif), voire F (non signé, rarement usité) alors qu'ici, les valeurs A à F sont légales
J'ai vu du F à plein d'endroits, mais on m'avait dit "C pour crédit, D pour débit, c'est une bonne mnémotechnie". Le peu que j'avais regardé sur OpenCobolIDE suivait la même norme, C, D, F, et c'est tout.
COBOL z/OS V6R3 :
etSign representation affects the processing and interaction of zoned decimal and internal decimal data.
Given X'sd', where s is the sign representation and d represents the digit, the valid sign representations
for zoned decimal (USAGE DISPLAY) data without the SIGN IS SEPARATE clause are:
Positive:
C, A, E, and F
Negative:
D and B
The COBOL NUMPROC compiler option affects sign processing for zoned decimal and internal decimal
data. NUMPROC has no effect on binary data, national decimal data, or floating-point data.
NUMPROC(NOPFD)
When the NUMPROC(NOPFD) compiler option is in effect, the compiler accepts any valid sign
configuration. The preferred sign is always generated in the receiver. NUMPROC(NOPFD) is less
efficient than NUMPROC(PFD), but you should use it whenever data that does not use preferred signs
might exist.
@Luc : ce serait une évolution récente de COBOL d'accepter ces marqueurs de signe ?
J'en étais resté aux valeurs "canal historique" C, D et F comme mentionné dans ces documentations :
http://www.simotime.com/datapk01.htm
http://www.3480-3590-data-conversion...ed-fields.htmlIn an IBM mainframe, the sign is indicated by the last nibble of the last byte (or high memory address). For explicitly signed fields the "C" indicates a positive value and "D" indicates a negative value. For unsigned (or implied positive) fields the "F" indicates a positive value.
."C" hex is positive, "D" hex is negative, and "F" hex is unsigned
Partager