Z Assembler Mnemonic Instructions and Macros
Part Three - Challenge #11

Background:

Learning to be an assembler programmer takes significant time and repetition.

Learning assembler is more difficult than learning other programming languages.

Assembler requires a programmer to learn about:

  • Assembler mnemonics
  • Machine instructions
  • Assembler directives
  • Assembler macros
  • Hardware architecture

Years are spent learning to recognize and apply assembler language coding techniques.


Challenge Situation

The same assembler program, ASMHELLO, from challenge 10 is used to complete challenge 11.

You will learn about the difference between assembler mnemonic instructions and assembler macros.


Challenge Description

Modify ASMHELLO to write a 3rd message:
"High level languages hide complexity of assembler".

You will add 3 assembler mnemonic instructions and 2 assembler macros to complete the challenge.

Compile and execute the modified program interactively to see program output.

Once satisfied the program is executing properly, then submit JCL to execute the program in batch that will write the program output to member #11 in your part 3 output data set.


Challenge:

Review ASMHELLO in your SOURCE partitioned data set
Description of ASMHELLO assembler source code:
  1. Comment on line 7 describes reason for the assembler instructions on lines 9, 10, and 11
  2. Lines 15 to 20 is the body of the assembler program which consists of:
    OPEN - an assembler macro that expands into assembler instructions
    MVC - an assembler instruction, Move Characters
    PUT - an assembler macro that expands into assembler instructions
    CLOSE - an assembler macro that expands into assembler instructions
  3. Lines 30 to 33 are assembler program reference definitions which consists of:
    DC - an assembler instruction, Define Constant
    DS - an assembler instruction, Define Storage
    DCB - an assembler macro that expands into assembler instructions
Description of ASMHELLO assembler program execution:
  1. DC is an area of storage with an assigned label to hold data constants
  2. DS is an area of storage with an assigned label to be modified
  3. DCB is a macro to define a program file name for program input and/or output
  4. MVC is an operation to move static data characters to a storage area capable of being modified
  5. PUT is a macro that writes to the target DCB

Assembler program modification

Modify ASMHELLO to write a 3rd message:
"High level languages hide complexity of system assembler".

A 3rd message can be written using:

  • A new DC assembler mnemonic instruction
  • A new MVC assembler mnemonic instruction
  • A new PUT assembler mnemonic instruction

Submit JCL to compile assembler program source code

While in edit on member asmhello in your SOURCE data set:

  • submit; =sd ; st
  • JCL jobname is ASMHELLO in JES spool output owned by your ID
  • If compile is unsuccessful, then correct errors

Execute successfully compiled assember program interactively

From ISPF Command Shell panel =6 enter the following:

  1. allocate dataset(*) file(recdd) shr
      Assembler program writes to RECDD file name
      The above allocates RECDD file name to the display, *
  2. call 'z#####.load(asmhello) - substitute your ID for z######
  3. Successfull execution writes three messages to the display

Submit JCL job to execute successfully compiled assember program
  • tso submit 'zos.public.jcl(p3ch11)'

The above JCL job executes your modified ASMHELLO assembler program and writes the output to member #11 in your P3.OUTPUT partitioned data set.


What did you just learn?

You can recognize IBM Z assembler program source code.

You successfully modified an IBM Z assembler program.


Browse or View P3.OUTPUT(#11) to verify the three lines are present, then move on to the next challenge!

Next: Challenge #12