Concatenate and logical OR

Question: I have never used PL/1 before and I'm looking to convert some PL/1 programs. Could you please tell me what the ! and !! represent.
Anonymous

Answer: Pl/1 does not use the ! character for anything special. If the character is surrounded by quotes then it represents an exclamation mark in a character string. You will not find it used for anything else.

What you are probably seeing in the code are | and ||. Some older printers may not have had these characters and may have chosen the closest available character printing | as !

| and || represent a logical or comparison and concatenation respectively.

For example your code might contain:

IF A | B THEN C = "A OR B IS TRUE";

In this instance if A evaluates as true or B evaluates as true then the statement following the THEN will execute otherwise the statement following the optional ELSE will execute. A and B can either be single bits (in which case 1 = true and 0 = false) or any comparison of fields that can be evaluated as true or false.

Another example would be the following:

A = "TREE";
B = "HOUSE";
C = A || B;

This code would set C to be equal to TREEHOUSE.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate