You are right, of course; in the original example, there would be no error,
if the explicit length on the literal had not been specified.
That is:
MVC 0(16,R1),=CL8'EJESPOP PATHNAME' Set cmd name/parm
the problem is the CL8 which was left there when the co-worker of Ed Jaffe
changed the literal constant from the original 8 byte MVC to the new 16
byte MVC.
It would have been ok, if the length had been omitted or changed to 16.
But: the examples I showed in my previous posts are more general and
show that it is possible for the ASSEMBLER to flag statements, where
the literal does not fit well with the operation code or the size of the
left side operand. See examples without explicit length, for example
L Rx,=H'5'
or
N Rx,=X'0C'
which are both plain wrong, IMO, and this can be diagnosed without
looking at the context.
I had such errors sometimes in programs of mine, not because I didn't
know how to do it right, but simply because I make mistakes sometimes
(like others). I, personally, would like an option that warns me about such
wrong uses of literal constants.
One step further: it would IMO even be good if we could flag such
instructions
where field definitions don't fit to the instructions used, like
ST Rx,HALFWORD
...
HALFWORD DS H
Of course, this COULD be ok, if there is a second halfword which lies
behind
the first, but in this case, I would still like a warning, which would
force me to
define a fullword which covers the two halfwords. But that's a matter of
taste.
Maybe different warning levels should be possible ...
Kind regards
Bernd
Am 03.05.2015 um 20:41 schrieb Steve Smith:
I don't know what your point is.
There are uncountable ways to make errors in assembly language not
available to HLL coders. HLASM is *not* a compiler. One could be made,
with whatever features one thought desirable, including strong typing, and
whatever rules one liked in regards to string length. As far as I know, no
one has thought it worth the effort.
But, there are techniques one can use to minimize greatly the chance for
these kind of errors. The main one is to avoid explicit lengths and
explicit offsets. Define all fields, and define them only once*. Only
slightly advanced Computer Science tells you that.
In the original case, all would have been well if no explicit length had
been specified on the literal. No other error he could have made is fixed
by specifying the length. It merely adds another way to make an error
(which of course, he did). In fact, the only reason I can see to specify
the length of a character literal is to get the free blank padding. You
might also *want* truncation, but that's somewhat degenerate.
IN any case, I agree it would make sense for HLASM to warn about literal
truncation. I do not agree that there is anything more it can do to keep
careless programmers from misusing MVC (not to mention all other SS
instructions).
sas
* Do as I say, not as I do...