> On Wednesday, July 19, 2023 at 08:24:41 AM PDT, Chris Craddock
> <[email protected]> wrote:
> I just delivered a brand new z/OS automation product that's about 40% HLASM
> and 60% C++.
> Yes really, it's IBM's C++ running APF authorized under LE in a z/OS STC.
Hi Chris,
Sorry for the long delay, but things have now slowed down a bit for the next
couple of weeks and I can put in some time if you are up for a little
discussion.
Can we make a real world comparison of untenable in HLASM or in C / C++. A few
years back, I too wrote a complete automation product but in HLAsm. I would
love to make a comparison of our experiences to see what made major impacts the
language made on coding ( faster, slower, reliability, pluses and minuses) and
realizing you had the additional requirement of multi-platform. I've written
code in many languages (including C / C++), each with pluses and minuses. I
know how I would have written it in C / C++ but you actually wrote it most
likely with the similar design. Congratulations on your delivery of a new
automation product.
1. You said "C/C++ macro processor is pretty dumb compared to". This tells me
you had free reign of C macro use. Many companies frown upon anything more than
its very basic use. Google finds them so unacceptable that they intentionally
omitted macro support when they rewrote C to create GO (GOLANG). What were your
complicated uses of C macros? Out of curiosity, why didn't you use GO instead
of C++ when it corrected some of the C / C++ flaws (at least by their
interpretation - e.g. OOP) and is modern?
2. Because of macros in HLASM, I eliminated tedious, repetitive and error prone
code of HLAsm. For instance, I easily implemented macros for the most important
C++ functionality that I needed. Remember it doesn't need to be as C as long as
it solves the problem. and eliminated a lot of the need for a great IDE
(Interactive Development Environment).
#CALC (R4)=PSATOLD>TCBFSAB>RSVNEXT>RSVR4>TMDSMD Run pointer chain
for SMD addr
#CALC (R4)=PSATOLD>TCBFSAB@RSVNEXT addr of RSVNEXT field
#CALC (R4)=@PSA addr of PSA
#CALC WRKPSA=@PSA Save PSA addr
#CALC WRKUSER=PSAAOLD>ASCBASXB>ASXBUSR8 Copy the userid
Capturing labels in a macro is simple using OPSYN for CSECT, DSECT, DC, DS and
EQU.
@ is LA instruction, > is L, LH or ICM. +-*/ are the appropriate instructions
according to the field attributes and length.
Logic is left to right instead of order of precedence but this is easy to work
around.
Verified type compatibility (e.g. char to char and num to num) ensured field
compatibility.
It doesn't need to do everything like C++ considering it took less than an hour
to code and solved everything I needed.
3. HLAsm macros greatly simplified many coding processes at compile time
rather than runtime. How did you implement things like messages, message doc
and support NLS (languages)?
*======================================================================
00 #MSG TYPE=MSG,MSGLEVEL=C,SRERC=NO, X
'FREE CB ',char,'(',hex,') in ',char, X
' failed with header=',char,' trailer=',char
*======================================================================
::Explanation:
An internal product error occurred. Program "ccc" tried to
to free CB "aaa" located at storage address "bbb" but
found either an invalid CB header "ddd" or the CB trailer
"eee" did not match the CB header "ddd".
::System action:
The storage is not freed. A storage creep may be
occurring that could possibly lead to insufficient storage.
::Corrective action:
Search the problem database for the solution to this error.
::MESSAGE_END
In HLASM, I created message modules and help modules. I find the C PRINTF a
useful concept and built a more robust method to print messages. For NLS, copy
the message source and translate messages into the appropriate language. The
following is a sample message. Like C PRINTF, It's simple to make the call
passing the message ID and each field required for the message. A message
manual can easily be printed from message help modules. Messages help can
easily be formatted for quickref distribution. Help for a message will be
returned to the requester ( e.g. user terminal, console, web console, remote
system, ...) As for formatting help text like Help text explanation, the macro
removed line ends allowing it to fit the device line size.
4. HLAsm macros provided simplified sentence syntax for complex actions thus
greatly reducing the importance of a great IDE (Interactive Development
Environment). How did you implement service requests passed between tasks that
can have many optional options (e.g. SRE, receive msgs, wait, payload, ...)?
#SRESEND TASK=EXECMGR, Send to exec manager X
TAG='EVENT', Event exec / command X
USERTYPE=EVENT, User from the specified event X
USER=0, X
ERROR=SNDER010, Request failed while sending X
MF=(E,WRKSEND)
Sends the active service request (SRE) from this task to the exec manager with
the specified attributes. Was your implementation the common solution using
multiple methods with names beginning with "set" to make it a verb and the last
method being SRESEND. On a side note, using MF=E is a habit (not necessity)
that I could easily address but was a habit that never bothered me.
5. When you said "It would have been untenable to write the whole thing in
HLASM" can you give us a couple of examples of things that were untenable?
6. You said "IBM's C++ running APF authorized under LE in a z/OS STC". My
design very rarely runs authorized and could easily be written in any language.
In your z/OS STC design, did you run authorized regularly? Init for SSI, PC
routines, one CB in CSA, system exits and start tasks. PC routines do the AR
mode code. No SRB. No updates to CSA. What are you running that runs authorized
on a regular basis in your STC?
7. You said "The programming models are just different" but I find those
differences cause me to make different design choices. I would never code large
C / C++ applications without an IDE because of the complexity. While mouse
hover in the IDE makes info convenient, it's just a little more effort to
position the ISPF edit cursor and press a PF key. A simple ISPF edit macro can
easily get the name under the cursor, find it in the macro libraries and view
the member at the desired line in the macro. Does anyone think the IDE isn't
doing this different?
8. You said "the C/C++ compiler and libraries exploit the living shit out of
the z architecture instruction set". It was wrong for me to say 5% because
it's obviously too low. What unexpected instructions did you see? I suspect the
new instructions you saw were added specifically for the C/C++ compiler (e.g.
string instructions) which makes sense.
Thanks, Jon.