John, all

I second John Gilmore's recommendation to learn the HLASM conditional macro
language.  It will become a useful tool that will save you untold lines of
coding and avoid repeatedly debugging commonly used blocks of code that
belong in macros for either the current program, the application library, or
your installation library all of which can be concatenated.

Perhaps the most useful set of macros are those to support structured
programming.  The HLASM toolkit includes a set and the z390 tool includes a
subset.  The z390 tool also includes an assembler pre-processor built into
the z390 macro processor which implements structured programing basic
constructs in conditional macro assembler.  This pre-processor supports AIF,
AELSEIF, AELSE and AEND for alternate selection in conditional macro code.
It supports ACALL, AENTRY, and AEND for performing local named blocks of
code.  These structured pre-processor macro generate standard HLASM
conditional macro code using AIF and AGO statements with generated macro
statement labels.  z390 includes a standalone pre-processor named
ZSTRMAC.MLC to convert any structured assembler program including structured
conditional macro code into standard HLASM code which can then be ported to
other platforms.

http://www.z390.org/z390_ZSTRMAC_Structured_Macro_Support.htm

z390 also includes extensions to AREAD and APUNCH to support speciation of
specific input and output text files via DDNAME parms.  This allows z390
structured conditional macro assembler code to be used to write complete
text processing programs which may read and write multiple text files
concurrently.  This has been used to write a number of utilities such as
HTML generators and also to write a structured version of the ZSTRMAC
preprocessor itself which is included with z390 open source.

The z390 macro library (z390\mac) includes versions of the most commonly
used system macros such as SAVE, RETURN, WTO, WTOR, GETMAIN, FREEMAIN,
OPEN, CLOSE, READ, WRITE, GET, PUT, DCB, ACB, etc.  For those without easy
access to their z/OS macro libraries for reference, the z390 website also
has link to download all of the public domain MVS 3.8 system macros which
are also a good reference unless you are looking for specific operating
system version dependent options (such options should be avoided whenever
possible to keep code portable going forward).  z390 will assemble programs
using these MVS 3.8 macros if you want to try them out, some generated MVS
3.8 code will work as is on z390 such as WTO 'Hello World' since the
generated svc 35 is the same, but most of the MVS 3.8 svc interfaces and
z/OS svc interfaces are not supported on z390.  If you want to run macro
assembler programs on z390, use the supplied z390 common macros which
support the most common system macro interfaces.

Another example use of structured conditional macro code for a large
application is the zCOBOL compiler which first translates COBOL source into
an HLASM source program with macro calls.  Then structured macros for all
the COBOL verbs convert the generated call statements into one or more
specific code generating structured macro calls.  These code generating
structured macros then generate HLASM basic assembler statements with
readable labels for both data division and procedure division code.  This
open source tool with all the structured macros and lots of demos and
regression test programs are included with z390.

http://www.zcobol.org/zCOBOL_System_Programmer_Guide.pdf

My only point with these examples is that the conditional macro facility in
HLASM is what enables it to be extended with structured programing
capabilities and compete with other higher level languages to perform
complex tasks. Or to put it another way, until you have learned to write
macros for any repeated code in your programs, you haven't really learned
HLASM.

Don Higgins
[email protected]

Reply via email to