Copyright © 2000 by Robin Vowels. All rights reserved for the authors.
  1. Editorial
  2. What's On -- PL/I Workshop
  3. Eberhard's PL/I Problem -- Eberhard gives the best solution for the last problem, and presents a new challenge.
  4. New Update for VisualAge PL/I.
  5. Buy PL/I on the web
  6. Usefulle Webbe Lynx ...

  1. The Newsletter

    We welcome your contributions to this newsletter. It will continue only through your efforts. Thank you in advance. The first issue may be downloaded from: The PL/I Newsletter, No. 1, July 2000
  2. What's On -- PL/I Workshop

    A Structured PL/I Coding Workshop will be run on 23-27 October 2000 in Denver, U.S.A. Look in the Public course list at The Trainer's Friend for details.
    Please note change of date.
    There are several other PL/I courses in their repertoire. You'll see them when you locate the above-mentioned workshop.
  3. Eberhard's PL/I Problem

    Copyright © 2000 by Eberhard Sturm.

    In the last issue of "The PL/I Connection" I presented a PL/I problem and promised to give a solution in the next issue. That was in December 1997. I'm glad to have the opportunity to keep this promise in "The PL/I Newsletter" now.

    If you remember the problem: Write a subroutine which computes the ratings of the game Master Mind. An additional requirement was, do it in eight statements or less.

    For those of you who missed the original article and first want to find a solution themselves, here is the URL:
    I reviewed the postings of 1998 in the newsgroup "comp.lang.pl1" and here is my favourite solution posted by Clement McGann (please, excuse my editorial changes):

    Mm: proc (Hidden, Guess, Black, White); dcl (Hidden,Guess) dim (4) connected fixed bin, (Black, White) fixed bin, (Temp dim (4), I) fixed bin; White = sum(Hidden = Guess); do I = 1 to 4; Temp(I) = min(sum(I = Hidden), sum(I = Guess)); end; Black = sum(Temp) - White; end Mm; In those days there were discussions if this is a "good" way of programming. I declared it "elegant". Array arithmetic is an outstanding feature of PL/I, and it's simple to understand. Of course, you can translate the statements above to more do loops. But are many nested do groups better to understand?

    The number of white pins is the sum of all places where the hidden pins and the guessed pins are equal. (Comparison of two arrays yield a bit array which is converted to binary for the purpose of computing the sum. I may be biased but I like this statement!)

    Then for each color it is checked how many times the color occurs in the hidden and in the guessed code. (Again comparing a scalar to an array yields a bit array. You can read "sum(I = Hidden)" as: Sum up all places where I is equal to a value of the array Hidden.) In Master Mind only relevant is the minimum of the two values. If you add these numbers you get the number of both black and white pins. So you have to subtract the number of white pins in order to know the number of black pins.

    This Month's Problem
    The problem of today uses some new features of the Visual Age PL/I compiler. Given an ordinal variable T which can assume two values T1 and T2, I want a function also named T which returns the ordinal value when the binary value is passed to it:

    Problem2: proc options (main); define ordinal T (T1 value (-1), T2 value (3)) prec (7) signed; put (ordinalname(T(-1)), ordinalname(T(3))); T: proc (N) returns (type T); dcl N fixed bin (31); ??? end T; end Problem2; The attributes "value", "precision", and "signed" are only examples of what may happen to occur. Function T should be independent of these attributes. You can regard T as the inverse function of the builtin function BINARYVALUE in respect to ordinals.

    If you have a running solution you can check if you have presumed big endian or little endian representation, respectively :-)

    I hope this problem is a challenge to you. Have fun, and, perhaps, learn something new. Afterwards you can decide yourself if your product is programmed in "good" or "bad" style.

    You may post solutions to comp.lang.pl1, or if you prefer a more private venue, mail your solution direct to Eberhard at sturm@uni-muenster.de

  4. From the Web ...

    From: "AlexanderDamyanovich" , WebUseNet Corp http://www.usenetserver.com - Home of the fastest NNTP servers on the Net.Date: Fri, 11 Aug 2000 07:30:10 -0400
    Greetings, Ladies & Gentlemen:

    Can someone among you please tell me if it's possible to do something like the following:

    DCL Function_name CHAR(40) VARZ; GET EDIT (Function_name)(A(40)); /* function names include SM_CXSCREEN, SM_CYSCREEN, etc. */ CALL Function_name; Or, will I have to hard-code the list in the programme itself (as Petzold does in his textbook "Programming Windows")? Many TIA!
    Alexander Damyanovich

    From: "Mark Yudkin" , CompuServe Interactive ServicesDate: Fri, 11 Aug 2000 16:36:31 +0200 I'll assume IBM VA PL/I for Windows, as you said Petzold.

    You do it the same way you would in "Petzold" (C / C++). But you can cut down on the OS APIs by using FETCH

    Compile all of the functions into an external DLL, and export them. The caller can use FETCH with the TITLE option to name the DLL and the entry to be invoked.

    The same technique also allows you to have plug-in lower level code - here's a sample from the Cogent/SQL (=> tag line) code

    IF DATABASE_API = ODBC THEN FETCH YCEXSQL TITLE('YCEODBC/YCEXSQL'); ELSE IF DATABASE_API = DB2 FETCH YCEXSQL TITLE('YCEXDB2/YCEXSQL'); ... Here I select different DLLs for different implementations of the same routine (and I use DLLs as if, for example, DB2 isn't installed, the FETCH will give a oncode=9050, but if I used static linking the program wouldn't load at all). In your case, select different functions from the same DLL.

    Regards, Mark Yudkin, Yudkin Consulting AG, Authors of Cogent/SQL for MVS, OS/2 and Windows NT.

  5. New Update for VisualAge PL/I.

    An update for VisualAge PL/I for Windows NT and Windows 2000 was scheduled for 29th September 2000.
    Salient features include:
  6. Buy PL/I on the web

    You may buy PL/I for OS/390, or for OS/2 and Windows NT (also the personal edition), or PL/I Set for AIX online. Go to IBM's online shop.
  7. Usefulle Webbe Lynx ...

    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.

Any comments and contributions for the next newsletter to email: robin_v@bigpond.com please.