On Thu, 12 Mar 2020 13:58:14 -0000, Daniel James
declaimed the following:
>In article , Martin Gregorie wrote:
>> Think how much code you'd need in any other language to get the
>> same print formatting as the single COBOL declaration:
>>
>> 05 INVOICE-TOTAL PIC "Z(4)9.99CR" BLANK WHEN ZERO.
>>
>> For those who don't know the COBOL: zero would produce a blank, 0.5
>> becomes, " 0.50 ", -0.5 becomes " 0.50CR" and, of course 1024
>> becomes " 1024.00 ".
>
>I've never used COBOL, but I do appreciate what's happening here.
>
>The data division in COBOL is one of the very few forward-looking
>features of that language -- a declarative description of the variables
>used in the program. The clever bit, from the point of view of your
>example, is that this declaration included the external representation
>of the variable. Not always what you want but, for the sort of thing
>that COBOL got used for, occasionally very useful.
>
Take into account that, for much of COBOL (especially the early stuff),
numeric data was stored as BCD. Later editions offered options for machine
floating point and native integers (usage is comp). So... the PIC
description wasn't just defining the print-format, it also defined the
internal storage format (other than the nature of the sign representation
-- the sign indicator itself may have been special code in the place-holder
for the decimal point in the BCD...)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|