Copyright © 2008 by Robin Vowels. All rights reserved for the authors.
  1. Editorial
  2. Generating file names
  3. Games
  4. HEX and HEXIMAGE Built-in functions
  5. Long Strings
  6. Announcement: PL/I for OS/2
  7. e, the base of natural logarithms
  8. New PL/I book
  9. Usefulle Webbe Lynx ...

  1. Editorial

    We welcome your contributions to this newsletter. It will continue only through your efforts. Thank you in advance.
    Please send any comments and contributions for the next newsletter to
    r|o|b|i|n|5|1 at dodo dot com dot au

    The ninth issue may be downloaded from: The PL/I Newsletter, No. 9, April 2006.
    The eighth issue may be downloaded from: The PL/I Newsletter, No. 8, January 2005.
    The seventh issue may be downloaded from: The PL/I Newsletter, No. 7, December 2004.
    The sixth issue may be downloaded from: The PL/I Newsletter, No. 6, December 2003.
    The fifth issue may be downloaded from: The PL/I Newsletter, No. 5, August 2002.
    The fourth issue may be downloaded from: The PL/I Newsletter, No. 4, November 2001.
    The third issue may be downloaded from: The PL/I Newsletter, No. 3, June 2001.
    The second issue may be downloaded from: The PL/I Newsletter, No. 2, September 2000.
    The first issue may be downloaded from: The PL/I Newsletter, No. 1, July 2000.

  2. Generating file names

    by Robin Vowels
    From time to time, it is necessary to generate a number of files having similar names, for example, F01.DAT, F02.DAT, F03.DAT, and so on. This can be done simply as follows: DECLARE OUT FILE OUTPUT; DECLARE 1 FILENAME STATIC, 2 STUB CHARACTER (5) INITIAL ('/FILE'), 2 SERIAL PICTURE '99', 2 SUFFIX CHARACTER (4) INITIAL ('.DAT'); DO SERIAL = 1 TO 10; OPEN FILE (OUT) TITLE ( STRING(FILENAME) || ', TYPE(TEXT), RECSIZE(120)'); << write to file >> CLOSE FILE (OUT); END; which will generate file names FILE01.DAT, FILE02.DAT, FILE03.DAT, ..., FILE10.DAT
    It is unnecessary to supply SET commands for files created in this way.
    Note that if the file type and record size are common to all the files, these values and associated text can be included in the declaration of FILENAME.
  3. Games

    by Robin Vowels

    The popular board game of chess has been added to our repertoire of games. You may care to try that and any of the others.

    • This chess program was written by Dean Menezes in Fortran, now it's been converted to PL/I.
    • For those game puzzle problems, there's J. R. Manning's White to move and mate in n moves. Set up the board, and the program will find the key move (or moves if there are alternatives).
    • Greg Price contributed the "Worm" program, which runs in an OS/2 (DOS-type) window under OS/2. You'll need to type MODE 80,33 prior to execution, which will give 33 lines on the screen.
      Download and run the Worm executable program.
      Download the Worm PL/I source.
    • Why not give pentominoes by Manny Juan a try?

    You may like to contribute a game program. If so, please contact the editor.
  4. HEX and HEXIMAGE Built-in Functions

    HEX always shows a variable as if it were declared bigendian, regardless of how it is declared. In other words, in the case of integers, the bytes are displayed with the most significant byte on the left. The result of this function is therefore portable, in that big-endian and little-endian systems return the same result.
    On the other hand, HEXIMAGE displays the bytes in the same order as they are in memory. This is a result of it being provided only with an address and length of the storage area, with no type information. Thus, different results are prodced on big-endian and little-endian systems.
  5. Long Strings

    by R. A. Vowels

    It is sometimes convenient to process long strings - those longer than 32767 characters - particularly with the high speed XML parser that is part of the IBM compilers.

    The string search built-in functions that return integer values return FIXED BINARY (31) values. As well, the STRING and SUBSTR functions handle strings longer than 32767 characters.

    Put them together and strings longer than 32767 can be searched using the INDEX, VERIFY, SEARCH, VERIFYR, SEARCHR functions. Substrings can be taken of long strings.

    The only requirement is that the variable used to hold the long strings be an array of single characters.

    Consider the statements:

    DECLARE A(100000) CHARACTER (1); K = INDEX(STRING(A)); Supposing that A(50000) through A(50019) holds the characters 'ABCDEFGHIJKLMNOPQRST' (remaining characters being blanks), then the assignment statement above will assign 50,000 to K.

    Assignments of an ordinary string can be made to a long string. Assignments of another array of characters can be made to a long string. This is done with the help of the STRING pseudo-variable. Thus, given

    DECLARE S CHARACTER (32000); then the following is permissible: STRING(A) = S; Should S be an array of strings - e.g. DECLARE S(9) CHARACTER (15); the total length of which is lesser than, equal to, or greater than the length of the array A, then characters will be assigned, and array A will be padded with blanks on the right, will be assigned all the characters in S, or will have HBOUND(A,1) characters assigned (excess characters being truncated), respectively.

    Substring operations using the built-in function are performed in the usual way. It's necessary only to add STRING, thus:

    T = SUBSTR(STRING(A), J, K); where J and K can take any values in the range 1 to HBOUND(A,1). In this example, T is an ordinary character string variable. It could, of course, be another array of CHARACTER(1), if required.

    Note: Always remember to declare integer variables that hold lengths and positions as FIXED BINARY (31).

  6. Announcement: PL/I for OS/2

    9 Jun, 2008:
    A new ALPHA version of the Iron Spring PL/I compiler for OS/2 is now available for free download at: http://www.iron-spring.com
    This is the sixth alpha version. It is still missing many features, but is working well enough to compile itself and its runtime library. The "release notes" included in the package document some, but not all, of the current restrictions. The 1.0 release is expected to be roughly a "Subset G" compiler. Eventually the compiler will handle the full PL/I language plus extensions from other compilers.
    Following the OS/2 version a Linux version is planned.
    Version 0.6a implements the %REPLACE preprocessor statement, adds the FROMALIEN procedure option to allow calls to PL/I from other languages, and packages the runtime library as a DLL and import library in addition to the previously distributed static object library.
  7. e, the base of natural logarithms

    Here's an interesting program. It computes e, the base of natural logarithms, to as many decimal places as you wish (well, up to 2,147,483,646 places). It's an ingenious algorithm devised by A. H. J. Sale, and it produces decimal digits one after the other beginning with the one after the decimal point.
  8. New PL/I book

    A new edition of Eberhard Sturm's PL/I book in German language has recently been published.
  9. Usefulle Webbe Lynx ...

    Peter Flass is building a resource at: Peter Flass's PL/I home page.

    The spring 2000 edition of the COBOL and PL/I newsletter has some topics about PL/I. The specific PL/I topics may be viewed separately, or the entire newsletter in PDF format may be downloaded.
    Of particular interest is the use of PL/I as a programming language for the Common Gateway Interface (CGI).

    The PL/I Connection newsletter.

    The PL/I Connection Newsletter No. 11 , December 1997.

    The PL/I Connection Newsletter No. 10 , April 1997.

  10. Current IBM PL/I offerings in the U.S.

    IBM has enhanced VisualAge® PL/I with powerful features to increase development productivity, simplify the maintenance of your legacy code, and provide seamless portability from your host to your workstation. It also provides the tools needed to identify your Year 2000 date-related fields on both OS/2 and Windows NT.

    VisualAge PL/I Enterprise Edition Version 2.1 combines the two separate offerings from the previous release of VisualAge PL/I (Standard and Professional) into a single offering available on both the OS/2 and Windows NT platforms. By doing so, it provides these productivity features:

    • remote edit/compile
    • redevelopment tools
    • cross platform development
    • year 2000 assessment strategies, find and fix, and test capabilities

    Also included as an extra bonus offering is VisualAge CICS® Enterprise Application Development, which enables CICS host application development on the workstation.

    • Product number 04L6564: VisualAge PL/1 Enterprise V2.1
    • 04L6565: VisualAge PL/I Enterprise V2.1 Upgrade from Prior IBM PL/I Workstation or Competitive Products Program Package CD-ROM
    • 04L6567: VisualAge PL/I Enterprise V2.1 Upgrade from Professional V2.0 Program Package CD-ROM
    • 04L6566: VisualAge PL/I Enterprise V2.1 Upgrade from Standard V2.0 Package CD-ROM

  11. Multics

    From: Tom Van Vleck , Multicians Date: Tue, 23 Apr 2002 13:35:42 GMT

    An HTML version of "The Multics PL/1 Compiler" by Bob Freiburghouse from the 1969 FJCC has been added to the Multics website at http://www.multicians.org/pl1-raf.html with Bob's permission.

    This paper describes the Multics version 1 PL/I compiler's implementation.

  12. Language Suggestions

    by Robin Vowels

    Built-in functions are generic, and typically operate on any data type and for an array of any number of dimensions (up to the maximum permitted by the compiler).
    If a user attempts to write a generic function, it is necessary to provide the procedures to perform the desired operation on each of the data types that he wants.
    As well, if the argument(s) can be arrays, the user must also provide procedures to perform the desired operation on arrays of any number of dimensions. Each procedure dealing with an array must also be duplicated to deal with each of the different types that the user wants.
    Thus, if there are four data types (integer, decimal, float, float (16)), and the compiler supports arrays having 10 dimensions, then 40 procedures must be provided.
    It would be better to have a new attribute GENERIC_ALL which specifies that any procedure in the family is assumed to apply to scalars and arrays of any dimension. e.g.,

    Such a facility would require the user to write just four procedures (instead of forty in the above example).

Any comments and contributions for the next newsletter to
r|o|b|i|n|5|1 at dodo dot com dot au
(Team PL/I) please.