Tutorial: Using a DBB API

This tutorial demonstrates how to use a basic DBB API, MVSExec. You can use the MVSExec command to run a program on IBM Z®. To make this tutorial easy to understand, program IEFBR14 is selected because its behavior is to just return the exit status zero, which is easy to verify. For more information about IEFBR14, see The IEFBR14 utility: Do (almost) nothing.

Run IEFBR14 by using DBB

  1. Create a file called br14.groovy and add the following content.

    import com.ibm.dbb.build.*
    
    def doAlmostNothing = new MVSExec().pgm("IEFBR14")
    println("Testing MVSExec of IEFBR14")
    println("--------------------------")
    def rc = doAlmostNothing.execute()
    println("RC: " + rc)
    

    Calling new MVSExec() creates a new class to run a program. Calling pgm("IEFBR14") sets IEFBR14 as the program to be run.

  2. Issue the following command on the command line.

    /usr/lpp/IBM/dbb/bin/groovyz br14.groovy 
    

Verify the output

If the program runs perfectly, the output is as follows:

Testing MVSExec of IEFBR14
--------------------------
RC: 0

An RC of 0 means IEFBR14 was able to run with no issues. A value of 4 means that there were issues but the program was able to run regardless. An RC greater than 4 means that the program failed to run.