11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PL/I 373ing for many users. PHP can also be linked to user-interfacelibraries (such as GTK+ for Linux/UNIX) to create applicationsthat run on the client machine rather than the server.PHP has a basic set <strong>of</strong> data types plus one called“resource” that represents data processed by special functionsthat return images, text files, database records, <strong>and</strong>so on. Additionally, PHP5 provides full support for objects,including private <strong>and</strong> protected member variables, constructors<strong>and</strong> destructors, <strong>and</strong> other features similar tothose found in C++ <strong>and</strong> other languages.There are numerous libraries <strong>of</strong> open-source objects<strong>and</strong> functions that enable PHP scripts to perform commonInternet tasks, including accessing database servers (such asMySQL) as well as extensions to the language to h<strong>and</strong>le popularWeb formats such as Adobe Flash animation. Programmershave access to a wide range <strong>of</strong> PHP resources throughPEAR (the PHP Extension <strong>and</strong> Application Repository).The combination <strong>of</strong> sophisticated features <strong>and</strong> easyinteractive scripting has made PHP the language <strong>of</strong> choicefor many Web developers, who use it as part <strong>of</strong> the group <strong>of</strong>technologies called LAMP, for Linux, Apache (Web server),MySQL (database), <strong>and</strong> PHP.Further ReadingAchour, Mehdi, et al. PHP Manual. Available online. URL: http://www.php.net/manual/en/. Accessed November 7, 2007.Lerdorf, Rasmus, Kevin Tatroe, <strong>and</strong> Peter MacIntyre. ProgrammingPHP. 2nd ed. Sebastapol, Calif.: O’Reilly Media, 2006.PEAR-PHP Extension <strong>and</strong> Applications Repository. Availableonline. URL: http://pear.php.net/. Accessed November 7,2007.PHP [<strong>of</strong>ficial Web site]. Available online. URL: http://php.net/.Accessed November 7, 2007.Z<strong>and</strong>stra, Matt. PHP Objects, Patterns, <strong>and</strong> Practice. Berkeley, Calif.:Apress, 2004.PL/IBy the early 1960s, two programming languages were inwidespread use: FORTRAN for scientific <strong>and</strong> engineeringapplications <strong>and</strong> COBOL for business computing. However,applications were becoming larger <strong>and</strong> more complex, callingfor a wider variety <strong>of</strong> capabilities. For example, scientificprogrammers needed to provide data-processing <strong>and</strong>reporting capabilities as well as computation. Business programmers,in turn, increasingly needed to work with formulas<strong>and</strong> statistics <strong>and</strong> needed floating-point <strong>and</strong> othernumber formats.Language developers thus began to look toward a general-purposelanguage that could be equally at home withwords, numbers, <strong>and</strong> data files. Meanwhile, IBM was preparingto replace its previously separate scientific <strong>and</strong> businesscomputer systems with the versatile System/360. They<strong>and</strong> one <strong>of</strong> their user groups, SHARE, formed a joint committeeto develop a new language for this new machine.At first the designers thought in terms <strong>of</strong> extendingFORTRAN to provide better text <strong>and</strong> data-processing capabilities,so they designated the new language FORTRANVI. However, their focus soon changed to designing acompletely new language, which was known until 1965 asNPL (New Programming Language). Because this acronymalready stood for Britain’s National Physical Laboratory, thename <strong>of</strong> the language was changed to PL/I (ProgrammingLanguage I).Language FeaturesPL/I has been described as the “Swiss army knife <strong>of</strong> languages”because it provides so many features drawn fromdisparate sources. The basic block structure <strong>and</strong> controlstructures (see loop <strong>and</strong> branching statement) wereadapted from Algol, a relatively small language that hadbeen devised by computer scientists as a model for structuredprogramming (see Algol) <strong>and</strong> is also similar to Pascal(see Pascal). Blocks can be nested, <strong>and</strong> variables declaredwithin a block can be accessed only within that block <strong>and</strong>its nested blocks, unless declared explicitly otherwise.PL/I includes a particularly rich variety <strong>of</strong> data types<strong>and</strong> can specify even the number <strong>of</strong> digits for numeric data.A PICTURE clause similar to that in COBOL can be used tospecify exact layout. However, the language takes a morepragmatic approach than Algol or Pascal; data need notbe declared <strong>and</strong> will be given default characteristics basedon context. Input/Output (I/O) is built into the languagerather than provided in an external library, <strong>and</strong> the flexibleoptions include character, streams <strong>of</strong> characters, blocks,<strong>and</strong> records with either sequential or r<strong>and</strong>om access.In general, PL/I provides more control over the lowleveloperation <strong>of</strong> the machine than Algol or even successorssuch as C. For example, there is an unusual amount <strong>of</strong>control over how variables are stored, ranging from STATIC(present throughout the life <strong>of</strong> the program) to AUTO-MATIC (allocated <strong>and</strong> deallocated as the containing blockis entered <strong>and</strong> exited) to CONTROLLED, where memorymust be explicitly allocated <strong>and</strong> freed. Pointers allow memorylocations to be manipulated directly. PL/I also providedmore elaborate facilities for h<strong>and</strong>ling exceptions (errors)arising from hardware condition, arithmetic, file-h<strong>and</strong>ling,or other conditions.Example ProgramThe following program executes a DO loop <strong>and</strong> counts fromone to the number <strong>of</strong> items specified. It then outputs thetotal <strong>of</strong> the numbers <strong>and</strong> their average.COUNTEM: PROCEDURE OPTIONS (MAIN);DECLARE (ITEMS, COUNTER, SUM, AVG) FIXED;ITEMS = 10;SUM = 0;DO COUNTER = 1 TO ITEMS;SUM = SUM + COUNTER;END;AVG = SUM / ITEMS;PUT SKIP LIST (“TOTAL OF ”);PUT ITEMS;PUT (“ITEMS IS ”);PUT TOTAL;PUT SKIP LIST (“THE AVERAGE IS: ”);PUT AVG;END COUNTEM;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!