z390 Portable Mainframe Assembler and Emulator

z390 ZSTRMAC Structured
Macro Support

Automated Software Tools Corporation

z390 Macro support has been extended to allow coding mainframe conditional macro code using the following structured programming extensions to the standard HLASM conditional macro language:

  • Alternate selection of code blocks
    • AIF  (expression) - execute the following block of code if expression is true
    • AELSEIF (expression) - end prior block and execute following block if expression is true
    • AELSE - end prior block and execute following block if prior AIF and AELSEIF expressions false
    • AEND - end last block for AIF at current level of nesting
  • Repeat execution of code block
    • AWHILE (expression) - repeat following code block while expression is true (test at beginning)
    • AEXIT AWHILE - exit to end of inner most AWHILE (for exceptions within nested AIF)
    • AEND - end block of code for AWHILE at current level of nesting
    • AUNTIL (expression) - repeat following code block until expression is true (test at end)
    • AEXIT AUNTIL - exit to end of inner most AUNTIL (for exceptions within nested AIF)
    • AEND - end block of code for AUNTIL at current level of nesting
  • Perform code block
    • APM name - perform the named code block and return to next instruction
    • AENTRY name - define start of performed block of code (skip over if entered sequentially)
    • AEXIT AENTRY - exit from AENTRY block of code (for exceptions within nested AIF)
    • AEND - end the current performed code block and exit to next statement after APM
  • Perform selection of code blocks based on index from 0 to 255
    • ASELECT (expression) - execute selected block based on value of index expression
    • AWHEN values - define end of previous block and start of code block for index values
      • values can be decimal (0-255), character C'?', or hex X'??'
      • one or more values may be specified separated by commas
      • a range of values may be specified as (value1,value2)
      • for example AWHEN (C'0',C'9') defines EBCDIC digits 240-249
    • AEXIT ASELECT - exit to end of current ASELECT (for exceptions within nested AIF)
    • AELSE - define optional code block if no AWHEN block defined for current index
    • AEND - end code block for ASELECT
  • Additional extension to indent label field by preceding with colon (:)

Starting with z390 v1.4.02e, a translator has been added (linklib\zstrmac.mlc) which will read structured macro assembler source code from SYSUT1 and write standard HLASM macro assembler source code on SYSUT2.  Starting with z390 v1.4.03, this support will be included in the z390 macro processor so no separate translation will be required to use the extensions to write structured macro code.  The mz390 macro processor will perform the translation automatically during source input if option ZSTRMAC is on.

The following new programs are included for general use:

  1. linklib\ZSTRMAC.MLC - structured translator generated using bootstrap version ZSTRMAC1.MLC to translate the structured version of itself ZSTRMAC.ZSM.
  2. ZSTRMAC.BAT - command using %1 to set SYSUT1 input and %2 to set SYSUT2 output and translate structured macro assembler to standard HLASM macro assembler.

The following new regression test programs are included in z390 v1.4.02e PTF:

  1. rt\test\ZSTRMAC1.MLC - bootstrap version of translator written in standard HLASM.
  2. rt\test\ZSTRMAC2.ZSM - structured version of the translator which uses all the structures.
  3. rt\test\TESTZSM1.ZSM - test program for ZSTRMAC1 with all the basic structures.
  4. rt\test\TESTZSM2.ZSM - test program for ZSTRMAC2 with all the basic structures (duplicate)
  5. rt\test\TESTZSM3.ZSM - test of all 256 ASELECT values using all forms of AWHEN operands
  6. rt\test\TESTZSM4.ZSM - test error messages

Note that z390 also has structured assembler macro support including IF, ELSE, ENDIF, DO, and ENDO.  For examples see the utilities linklib\REPRO.MLC and linklib\SUPERZAP.MLC.  As time permits these old structured assembler macros could be rewritten using STRMAC extensions while adding additional function compatible with the IBM HLASM toolkit structured macros.

The translator and above test source programs are in z390 PTF v1.4.02e.  The ZSTRMAC support will be integrated into the mz390 macro processor in z390 v1.4.03.  The above ZSTRMAC1.MLC is the last unstructured macro code program I ever intend to write with 169 explicit macro labels.  The structured version has no labels, and I would submit that it is significantly easier to read and maintain using APM performed blocks to reduce the logic down into small logical blocks.  Any and all feedback is welcome as work proceeds on z390 v1.4.03.  Send comments and suggestions to Don Higgins.

 

IBM, CICS, HLASM, MVS, OS/390, VSAM, z9, z10, and z/OS are registered trademarks
 of International Business Machines Corporation

This page last updated Sunday September 07, 2008.   Webmaster  Sitemap
Copyright 2008 Automated Software Tools Corporation