Fair comparison C vs HLASM

2018-01-21 Thread Jon Perryman
I find it amazing how C programmers believe in the superiority despite 
overwhelming evidence to the contrary. Surprisingly, the psychological term for 
this is "motivated reasoning" and I never believed it until now. Below actually 
transpired yet they still believe that C is superior (even with an examples).
In another newsgroup, someone mentioned that C is THE GOTO system language 
(specifically mentioning Windows) and that there is very little need for 
assembler. C is the goto language for Unix. Windows has a lot of assembler 
which requires their code be written in C#. 
I also commented that C is a weak language compared to HLASM and gave some 
examples that force bad coding techniques (e.g. XML parser). A C programmer 
took offence because he had written an efficient XML parser in C. Below is 
psuedo C logic and the assembler to do the same functionality. Realize the C 
programmer felt C XML parsing needed less than 10 lines but those 10 lines 
ended up being the first line in the pseudo code. He did not believe me until I 
gave him the examples.
Another unhappy C programmer decided to give me an impossible challenge by 
asking for a program where he could not replace a single line with efficient C 
code. To be cheeky but technically correct, I responded IEFBR14.
More unhappy, he decided it must be a system program. I required that a C 
programmer must be able to modify and maintain it once written in C. My choice 
was IDCCDAL which contains the parser statements for TSO ALTER.
That wouldn't make him happy, so lets make it at least a little fair where at 
least 10% must be in C and the assembler code must use the techniques we now 
use. My choice would be all the TSO IDCAM commands.
I've always thought HLASM was good. I now realize It's extremely impressive 
despite all it's warts. Without HLASM, we would not have z/OS, VSE and VM. 
Imagine writing MVS in C (no SYS1.MACLIB capabilities or the other features). C 
programmers are hampered by their choice of programming language. MVS would be 
another flavor of Unix. Imagine the C version of TSO ALLOC DDN(mydd) 
DSN(my.dataset) NEW CATLG CYL SPACE(5,5,10) (tso alloc -dmydd -fmy.dataset -n 
-c -C -p5 -s5 -D10). 
Unix programmers keep mentioning our programs aren't portable. That's true but 
we could make them portable by implementing their machine architecture and 
creating macro's to generate code supporting our machine instructions. How 
arrogant when they think we can't possibly do this but they can write Hercules 
and z390 that do exactly that? Truthfully it's a question of money and desire. 
When would any of our programs be useful in their environment. We could leave 
out all the environment specific code but then it wouldn't be near as useful to 
us.

HLASM is dismissed as a proper language because it includes machine op codes. 
Ignore the op codes and evaluate it on it's merits as a language (ease of use 
and maintainability). I believe that Peter Relson said that HLASM macro's make 
it impressive. While that is true, it has other important unnoticed (and often 
unused) features that combine to make it truly impressive. 
E.g. someone mentioned that most programmer code is NORENT assembler because 
RENT requires initializing and addressing the work area. Coding the init area 
in the CSECT causes USING problems. They don't realize another CSECT will avoid 
the conflict.
        macro ,
&l    cballoc &cb,®=       aif ('&l' eq '').nolabel&l    EQU *.nolabel anop 
,        getmain r,lv=&cb.l,sp=1        lr    ®,r1        USING &cb,®     
!!        LA   R0,R1      
mvcl destination        LA    R1,&cb.l  length to move        L    R14,=A(&cb)  
  mvcl source        LR   R15,R1         length to move               MVCL  
(R0),(R14)      init cb         MEND , 
WRK  CSECT ,   anything thing you want in the CBWRKL EQU *-WRK
MYPGM CSECT ,         CBALLOC WRK,R9 
Assembler allows non-linear programming. LOCTR, CSECT, DSECT and more  When 
used in a macro, the programmer codes a single statement yet the macro 
generates code in multiple locations. This feature is too often overlooked when 
coding macro's.
Now for the code comparison. For those who don't know XML, the basics are very 
simple. data allows you to associate 'data' as element 'a'. While 'data' 
can be can be actual data, it can also include additional levels of more XML. 
Basically it's multi-level data encapsulation. 
bbbcccddaaa
Simplified assembler XML sample that could parse the XML above:
    --- asm code before parsing ---    XMLPARSE BEGIN,XMLDATA=    XMLPARSE  
 ELEMENT=a     --- element  a  code ---     XMLPARSE  ELEMENT=b,SUBELEM=a      
--- element  b  code ---      XMLPARSE ELEMENT=c,SUBELEM=b       --- element c 
code ---      XMLPARSE ELEMENT=d,SUBELEM=a       --- element d code ---       
XMLPARSE END       --- asm code after parsing ---
Pseudo code that shows C programming logic for the XMLPARSE above.
      --- code bef

Re: OPTABLE error

2018-01-21 Thread Jonathan Scott
Ref:  Your note of 19 January 2018, 17:50:02 EST

Mark Boonie wrote:
> I spent an hour or so fighting with my build environment because
> I thought it was ignoring my options, but now I think I have an
> HLASM bug.  I'm specifying OPTABLE(ZS6,LIST) as a *PROCESS
> option.  The "Options for this Assembly" page shows that the
> option has been processed correctly ("3 Invocation Parms
> OPTABLE(ZS6,LIST)"), so the option should be in effect, but in
> the opcode-table section of the listing, the mnemonic RISBG
> doesn't appear, and it's getting flagged in the assembly with
> message ASMA057E, undefined operation code.  (RISBG is a
> ZS4-level mnemonic.)

Strangely enough, I already spotted last week that *PROCESS OPTABLE does
not work as it should, while checking an odd result encountered while
setting up tests for the recent APAR PI87412 (where an unknown ACONTROL
OPTABLE value was quietly being ignored, because it was trying to issue
a *PROCESS error message instead of an ACONTROL one).

In particular, if *PROCESS OPTABLE issues a warning that something is
being overriden, it can issue the wrong warning and can end up changing
the OPTABLE name (which it shouldn't) without actually changing the
internal OPTABLE selection mask.

Also, *PROCESS OVERRIDE OPTABLE does not work, apparently because the
code was cloned from code for a *PROCESS option (MACHINE) which does not
support OVERRIDE, even though OPTABLE does support OVERRIDE.

While debugging these problems, we also found other related problems,
so we are doing a thorough review of this area to try to ensure that
all option processing conforms to the documented rules.

We also noted that there are inconsistencies in whether or not a message
is issued when a specified option overrides a previous specified option,
in that although the message is set up internally, some of the keyword
routines fail to use it.

We are attempting to find a reliable solution which will fix these
inconsistencies.  We are also considering updating the documentation
to make it extra clear that *PROCESS OVERRIDE effectively serves two
purposes:

1. For an option which can be changed by *PROCESS, the OVERRIDE
   option quietly ensures that the specified value is used.

2. For an option which cannot be changed by *PROCESS, the OVERRIDE
   option can be used to verify that the intended valid being used,
   as it will issue a warning if the value does not match, even
   though it cannot change it.

I'd expect to see an internal APAR for this within a few days and a fix
for it within two or three weeks.  No guarantees, of course, but if you
don't see anything happening soon enough for your requirements, you're
welcome to raise a PMR yourself.

Jonathan Scott
HLASM, IBM Hursley, UK