Version 16 of PL/1

Updated 2007-01-17 23:46:57

mytest:

    proc(cmdArgs, envBlk) options(main);

 dcl
    cmdArgs char(127) var,
    envBlk char(127);

 dcl
    (max, i, j) fixed bin,
    base_page_ptr ptr,
    1 base_page based (base_page_ptr),
      2 pad1 (32) fixed bin(15),
      2 psp_seg fixed bin(15);

 dcl
    cmdLine_ptr ptr,
    cmdLine char(127) var based (cmdLine_ptr);

 dcl
    dateNow char(6),
    timeNow char(9);

 dcl
    junk_waffle fixed bin(7) static initial (20);


    dateNow = DATE();
    timeNow = TIME();
    put skip list (dateNow); put skip list (timeNow);
    put skip edit (substr(dateNow,3,2),'/',substr(dateNow,5,2),'/',substr(dateNow,1,2)) (a(2),a,a(2),a,a(2));
    put skip edit (substr(timeNow,1,2),':',substr(timeNow,3,2),':',substr(timeNow,5,2),'.',substr(timeNow,7,3))
                  (a(2),a,a(2),a,a(2),a,a(3));
    put skip list ('');

    unspec(cmdLine_ptr) = '0080'b4;
    put edit ('command line = ', cmdLine) (a);
    put skip list ('');

    unspec(base_page_ptr) = '0000'b4;
    put edit ('PSP segment = ', unspec(base_page.psp_seg),'h')
             (skip,a,b4(4),a);
    put skip list ('');

    i = length(cmdArgs);
    put edit ('cmdArgs = ', cmdArgs) (a);
    put skip list ('');

    put list ('env = ', envBlk);

    i = '12bc'b4;
    put edit ('i = ',unspec(i),'h') (skip,a,b4(4),a);

    return;                /* just for aesthetics */


    end;          /* of main program */

LV Anyone know why this page was created? Generally someone adds a note giving us some context.

escargo - I'm especially mystified because they got the name of the language wrong (it's PL/I). There is work being done on a PL/I front end to the GNU C compiler; I understand that they are looking for language samples to compile. - RS Thirty years ago, I did some PL/I (or, rather, the "student" subset SL/I) on an IBM 1130... but is PL/I any more than a museum piece today? Long time ago, it was praised as fusion of Fortran and Algol, with some COBOLity thrown in :^) KPV PL/I was the first real language I learned twenty five years ago. Don't remember much of the language except that I remember that C seemed trivial afterwards.

escargo I was an operator for an 1130 more than 30 years ago. I always had a fondness for the card reader/punch. (Makes me wonder if there are any 1130 simulators out there somewhere.) - RS: see http://ibm1130.org/sim

LV Well, I know at least one company which has production code written in PL/I... several hundred thousand lines of code, as a matter of fact. I don't know about other sites.

VK FWIW I consider this page is just off-topic here. No Tcl content, waste of reader's time. Just adding irrelevant information will not do anything good.

CLN I've never worked in PL/I (PL/1) myself but I remember someone once telling me about PL/C (PL/I for College students) which, he claimed, tried so hard to give a compiler warning and guess what the user meant that it would compile a Shakespearean sonnet. ;-)

VK so that PL/1 forgives much errors, could be interesting... but I still fail to understand why this discussion belong here. To continue off-topic, here my PL/1 chunk of correct code of interest:

 if then then then=else; else else=then;

OTOH I must ask for wiki gnomes to delete this entire page! (I am too shy to do this myself)

TP VK's example shows off PL/I's purposeful lack of reserved words. Not every PL/I compiler supported this feature, but it was certainly present in the PL/I compilers that I used (IBM PL/I Optimizing compiler & PL/I C). Instead of reserved words, the compiler parsed purely by context. Other interesting features that I remember using:

  • a very elaborate pre-processor, really a mini-PL/I. Makes C's pre-processor look very anemic. if/then/else, do-while, etc. all in the pre-processor. Code that writes code? Hey, Tcl does that too!!
  • variable labels. GOTO SOMELABEL could go here, there, or somewhere else depending on its value. Made maintaining code written by former assembler programmers very interesting.

I don't see the controversy of having a PL/I page on the Tcl wiki. Since it is now a GCC front-end language, someone could conceivably write a Tcl extension with PL/I. Note that the wiki already has pages for Cobol, Fortran, APL, Smalltalk, Haskell, Basic, and other languages that may not have a direct relationship with Tcl.


Category Language