Related articles |
---|
Re: Parser generator drb@msu.edu (2012-01-08) |
Re: Parser generator gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-01-08) |
Re: Parser generator arnold@skeeve.com (2012-01-11) |
Re: programming in PL/I compilers@is-not-my.name (2012-01-12) |
Re: programming in PL/I robert@prino.org (Robert AH Prins) (2012-01-14) |
Re: programming in PL/I derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2012-01-14) |
Re: programming in PL/I gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-01-15) |
Re: programming in PL/I gah@ugcs.caltech.edu (glen herrmannsfeldt) (2012-01-15) |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Sun, 15 Jan 2012 11:36:56 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
References: | 12-01-009 12-01-010 12-01-013 12-01-017 12-01-020 12-01-023 |
Keywords: | PL/I, design, comment |
Posted-Date: | 16 Jan 2012 00:42:43 EST |
glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote:
(snip, I wrote)
> I do remember Picture format and Picture variables, though maybe I
> never tried them. I liked the idea of picture format, but thought that
> picture variables were strange.
(snip)
> [Those came straight from Cobol. For what they're intended for, printing tidy
> columns of numbers in reports, they work very well. -John]
Hopefully discussions on internal data representation by compilers
aren't too far off topic.
As I understood it, picture variables stored the value as a text
representation, what IBM calls unpacked decimal. I still have not run
even one COBOL program, though recently I was scanning some COBOL
manuals to send to bitsavers.
You can write tidy columns with Fortran FORMAT, but you don't get so
much choice in how they come out. There is currently a discussion in
comp.lang.fortran on optional leading zeros that the standard allows,
(or allowed in older versions of the standard) and that different
compilers implement differently.
Picture allows you to specify, for example, exactly how many leading
zeros you want. C allows for zero padding or blank padding, but
nothing in between. (And I don't remember what it does for leading
zeros with %f format.)
-- glen
[I'm way ahead of you, I wrote one program in Cobol, but a lot of
programs in PL/I. Picture variables specify the display format and
computational behavior of variables, not the internal representation.
IBM's implementation, the one I know the best, has a USAGE keyword
that lets you tell it what representation to use, e.g. USAGE
PACKED-DECIMAL. Pictures are a lot more powerful than Fortran
formats, since they can insert commas, CR and DB codes, and the
like. There is also surprisingly modern stuff like REDEFINES
to get the effect of unions in C, and SYNCHRONIZED to do
alignment padding in structures and arrays. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.