Skip to content
Matt Baker edited this page Jul 17, 2020 · 9 revisions

Example

plugins {
  id "oe.espresso.latte" version "<version>"
}    

import oe.espresso.latte.*

task runABL(type: RunAbl) {
    dependsOn connectDB

    procedure = file("src/abl/ablrun.p").path
    dbConnections << 'sports2020'
}

Use the command ./gradlew runABL to run this example.

If successful, ablrun.p should be run.

Properties

There are a lot of properties available. See the documentation for PCT Run for the full set.

The important onces

By default _progress will be used to run programs. Specify graphicalMode = true if you want to run prowin instead.

graphicalMode = true

Troubleshooting PCTRun

If your procedure successfully runs, but you still get a PCTRun returned 1 error, then pay attention to the documentation for PCTRun. It expects that your procedure returns a string indicating the return code.

The following is an example of ABL code that can be run that prints the customer names to a file. notice the last line of the file returns a 0. Without this, the build would fail with an error.

output to "build\output.txt".

for each customer no-lock:
    message customer.name.
end.

output close.

return "0"

Enabling the profiler

By default the profiler is not enabled when ABL code is executed. You can enable it using the following example. The profiler generates its output to the specified output. Other options such as listings, enabled, description, coverage, and statistics options are supported.

    task runABL(type : RunAbl) {

        procedure = file("src/abl/ablrun.p").path

        profiler {
            outputDir = file("${buildDir}/test/profiler")
        }
    }

Working With Environment Variables

It is possible to set environment variables individually or as a map. The environment variables is passed to the AVM when it is launched. The ABL run task starts with the set of environment variables set as defaults assigned through the abl defaults task. Any environment variables assigned at the task replace or add to the default list.

When assigning the environment property, all previous values are removed, and the contents of the environment map are copied internally.

Environment Variable Map Example

    task runABL(type : RunAbl) {

        procedure = file("src/abl/ablrun.p").path

        environment = ["bob" : "marley", "jim" : "morris"]
    }

Setting Individual Environment Variables

Please refer to this article.