Re: programming in PL/I

glen herrmannsfeldt <>
Sun, 15 Jan 2012 11:36:56 +0000 (UTC)

          From comp.compilers

Related articles
Re: Parser generator (2012-01-08)
Re: Parser generator (glen herrmannsfeldt) (2012-01-08)
Re: Parser generator (2012-01-11)
Re: programming in PL/I (2012-01-12)
Re: programming in PL/I (Robert AH Prins) (2012-01-14)
Re: programming in PL/I (Derek M. Jones) (2012-01-14)
Re: programming in PL/I (glen herrmannsfeldt) (2012-01-15)
Re: programming in PL/I (glen herrmannsfeldt) (2012-01-15)
| List of all articles for this month |

From: glen herrmannsfeldt <>
Newsgroups: comp.compilers
Date: Sun, 15 Jan 2012 11:36:56 +0000 (UTC)
Organization: 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 <> 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.

> [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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.