That's probably safe advice.

Data from COBOL probably doesn't have useful line-endings in it, so even if the 
data is mostly text characters it may all show up as one giant line in a text 
editor, which may not handle that well.

You can look at zoned data as text. Every byte of it IS a character. E.g, if 
you want to create some zoned text examples, it is possible.

E.g., right here in this email I can create examples of ebcdic and all 4 
textZonedSignStyles for the value -123.450

"123450" is dfdl:encoding="ebcdic-cp-us"
"12345p" is dfdl:encoding="ascii" with dfdl:textZonedSignStyle="asciiStandard"
"12345}" is dfdl:encoding="ascii" with 
dfdl:textZonedSignStyle="asciiTranslatedEBCDIC"
"12345 " is dfdl:encoding="ascii" with 
dfdl:textZonedSignStyle="asciiCARealiaModified" (Note the final 0 digit is a 
space)
"12345€" is dfdl:encoding="iso-8859-1" with 
dfdl:textZonedSignStyle="asciiTandemModified" Note that I switched to 
iso-8859-1 so that the 0x80 for the last character would have a printed 
representation.









________________________________
From: Costello, Roger L. <coste...@mitre.org>
Sent: Monday, April 20, 2020 12:09 PM
To: users@daffodil.apache.org <users@daffodil.apache.org>
Subject: Re: What is a "zoned" textNumberRep?


Thanks Mike. Would it be correct to say that for an instance of a text data 
format that uses zone numbers, you would not use a Notepad (or Notepad++ or any 
other “normal” text editor) to view the instance? That is, you would need a 
special editor that understands zoned numbers to view the instance. Is that 
correct?



/Roger



From: Beckerle, Mike <mbecke...@tresys.com>
Sent: Monday, April 20, 2020 11:57 AM
To: users@daffodil.apache.org
Subject: [EXT] Re: What is a "zoned" textNumberRep?



Ah, a true "data archaeology" topic.



Here's a link.



https://community.microfocus.com/t5/Net-Express-Server-Express/What-is-a-Zoned-Decimal-and-how-is-it-represented-in-COBOL/ta-p/1758317



This is COBOL stuff.  The MicroFocus Cobol online materials are a great source 
of info.



I am dating myself here, but zoned decimal originated on IBM computers in the 
1960s. Honestly I didn't encounter this stuff until like 1985.



The instruction sets of those CPUs support decimal numbers in two forms: 
packed, and zoned.



Zoned is actually just text, in EBCDIC where the numbers 0,2,3... are 
reprpresented by bytes 0xF0, F1, F2, F3.... Those F nibbles are called the 
"zones".



So operating on decimal text just requires that the instruction set ignore the 
F nibble and operate on the base 10 digit part.



Except, there's pesky decimal points, and minus signs to deal with.



So the "implied decimal point" is the way decimal math works. There's no 
decimal point in the text string. Just digits.



And the sign is handled by using the F nibble in the last digit - changing it 
to C for plus, D for minus, and F for unsigned which is equivalent to C 
ultimately.  Since this dates from computers with punch cards, this was called 
"overpunched" sign, but exactly how one does overpunching, I fortunately never 
had to learn.



This data format (zoned, trailing overpunched sign) is still heavily used. It 
is the default you get in COBOL if you don't specify anything specific about a 
number in Cobol.



So, the plot then thickens.



Take a EBCDIC zoned number, overpunched trailing sign like -123.45. That's F1 
F2 F3 F4 D5 bytes. Now treat those as text and it looks like "1234)" The ")" is 
EBCDIC D5. Now translate EBCDIC to ASCII. You get bytes 31 32 33 34 29. That 
last 29 is an ASCII ")". Notice that the zone is not 3, and the decimal value 
nibble is not 5.



This is what DFDL calls dfdl:textZonedSignStyle='asciiTranslatedEBCDIC'.



There are 3 other variants of how zoned numbers work and I won't repeat the 
details here, but the dfdl:textZonedSIgnStyle property has the knarly details.





________________________________

From: Costello, Roger L. <coste...@mitre.org<mailto:coste...@mitre.org>>
Sent: Monday, April 20, 2020 10:38 AM
To: users@daffodil.apache.org<mailto:users@daffodil.apache.org> 
<users@daffodil.apache.org<mailto:users@daffodil.apache.org>>
Subject: What is a "zoned" textNumberRep?



Hi Folks,

textNumberRep :: standard | zoned

"standard" means the number is represented by a sequence of character digits. 
Right?

"zoned" means ??? Can you provide an example of a zoned number? Can you point 
me to a web page that explains zoned numbers?

/Roger

Reply via email to