The macros are only doing exactly what you are telling them - unfortunately in
this case the second CLC in your "IF" is redundant and there is no need to code
it.
If "A<>B" is not satisfied, then there is no need to test "A=B" before your
next condition.
You should be able to code the following :
IF (CLC,A,NE,B),OR,(CH,R1,LE,C)
STH R3,NUMBER
ENDIF ,
Rob Scott
Lead Developer
Rocket Software
275 Grove Street * Newton, MA 02466-2272 * USA
Tel: +1.781.684.2305
Email: [email protected]
Web: www.rocketsoftware.com
-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On
Behalf Of DEBERT Jean-Louis
Sent: 25 April 2012 09:46
To: [email protected]
Subject: Boolean logic in structured programming macroes
Hi all,
I have been experimenting for some time with the structured programming macros
in the HLASM toolkit (IF, ELSE, DO, etc...)
and I stumbled on a small inconsistency, which I don't quite know how to
bypass, "cleanly" that is.
This is a case where I want to do something if (A ne B) or if ((A eq B)
and (R1 le C))
So I used the structured programming macroes, writing the following:
IF (CLC,A,NE,B),OR, *
(CLC,A,EQ,B),AND, *
(CH,R1,LE,C)
STH R3,NUMBER <- this is
what I want to do if the correct conditions are matched.
ENDIF ,
The code generated by the macros is hereafter:
2092 IF (CLC,A,NE,B),OR,
*02730000
(CLC,A,EQ,B),AND,
*02740000
(CH,R1,LE,C)
02750000
000000E0 D507 D080 D088 00000080 00000088 2111+ CLC
A,B 03-ASMMPOPI
000000E6 A774 000B 000000FC 2112+
BRC 7,#@LB2 03-ASMMPOPI
000000EA D507 D080 D088 00000080 00000088 2113+ CLC
A,B 03-ASMMPOPI
000000F0 A774 0008 00000100 2114+
BRC 7,#@LB1 03-ASMMPOPI
000000F4 4910 D090 00000090 2115+
CH R1,C
03-ASMMPOPI
000000F8 A724 0004 00000100 2116+
BRC 2,#@LB1 02-ASMMIFPR
000000FC
2117+#@LB2 DC 0H
02-ASMMIFPR
000000FC 4030 D092 00000092 2119
STH R3,NUMBER 02760000
2120 ENDIF ,
02780000
00000100
2125+#@LB1 DC 0H
01-00000935
Now, the code generated does what I want, but due to two conditions being
tested on exactly the same instruction (CLC A,B) it happens that when A is
equal to B, it will execute the 2nd CLC (at address EA) for nothing at all,
because if this instruction is executed, it is already known that A equals B
I repeat, the generated code still do what I want, but I wondered whether there
would be some way of coding the conditions so as to avoid the unnecessary CLC ?
Also, at the code generation stage in the macro, the assembler has everything
it needs (instruction code and parameters) to know that the same instruction is
(unnecessarily) repeated, so why does it still do repeat it ?
Any hint would be welcome.
Please forgive me if something is obvious to you, my knowledge of Boolean logic
is sparse at best.
Also possibly forgive my English, as it is not my native language.
Thanks in advance to all.