Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: glen herrmannsfeldt Newsgroups: comp.compilers Subject: Re: programming in PL/I Date: Sun, 15 Jan 2012 11:36:56 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 41 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-01-027@comp.compilers> References: <12-01-009@comp.compilers> <12-01-010@comp.compilers> <12-01-013@comp.compilers> <12-01-017@comp.compilers> <12-01-020@comp.compilers> <12-01-023@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1326692563 34512 64.57.183.58 (16 Jan 2012 05:42:43 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 16 Jan 2012 05:42:43 +0000 (UTC) Keywords: PL/I, design, comment Posted-Date: 16 Jan 2012 00:42:43 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:426 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. (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]