[Simh] BLISS and C

Jordi Guillaumes Pons jg at jordi.guillaumes.name
Tue Jan 30 06:08:36 EST 2018


Jordi Guillaumes i Pons
jg at jordi.guillaumes.name
HECnet: BITXOW::JGUILLAUMES


> 
> I was also going to point out that neither {} nor [] exist in (System/360 era)
> EBCDIC, so could not have been used in PL/1.
> 
> PL/1 (or PL/I, to use the later naming convention) has both BEGIN/END and
> DO/END, with different effects.  I got a long lecture from an office mate once
> about a program which was using BEGIN/END where DO/END was preferable, because
> BEGIN blocks actually create a new context, with internal/external scope
> details, while DO blocks do not create a new context.

There are no curly braces on any PL/I version that I’m aware of. 

The “normal” way to build statement blocks is DO/END, with are just combined statements (so can be used in IF…ELSE… or WHILE blocks; PL/I has no ‘END IF nor ‘END WHILE’ statements). BEGIN/END create a semantic context where you can define local variables or, more usefully, establish local condition handlers.

A way to do a controlled check for overflow is, for instance

…
BEGIN;
    DECLARE IS_OVERFLOW BIT(1) INIT(‘0’B);
    ON OVERFLOW IS_OVERFLOW = ‘1’B;
    NUMBER = BIGNUMBER1 + BIGNUMBER2;
    IF IS_OVERFLOW THEN CALL HANDLE_OVERFLOW();
END;
…

That “ON” condition is only valid inside the BEGIN/END block, so if an OFL condition occurs elsewhere (and you have used the correct compiler options) the program will crash (“ABEND”, in IBM idiom). That is actually what you really WANT to happen (better to get a call at 3am than to have to correct a corrupt file).




Jordi Guillaumes i Pons
jg at jordi.guillaumes.name
HECnet: BITXOW::JGUILLAUMES
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20180130/a06be2b6/attachment.html>


More information about the Simh mailing list