Skip to content
Gilles QUERRET edited this page Apr 3, 2015 · 35 revisions

Description

Executes a Progress procedure.

This task generates a temporary Progress procedure on the fly which sets the propath and declares database aliases according to specified parameters, and then runs the specified procedure.

This temporary procedure is launched by an Exec task, with prowin, prowin32 or _progres executable, and with the specified arguments.

You need to add RETURN "IntegerValue" at the end of your procedure. This return value is read by PCT, and any non-zero value tells Ant to throw an exception (thus stopping the build).

  • Database connection problems always return a value of 14.
  • Errors during execution of your procedure return a value of 1.

XML namespace

<pct:run />

Parameters

Attribute Description Required
procedure Procedure to execute ✔
graphicalMode True if you want to execute procedure using prowin32, _progres otherwise. Default value is false
baseDir The directory in which the Progress runtime should be executed. File
failOnError Stop the build process if the Progress procedure exits with a return value other than 0. Boolean
debugPCT True to keep internal temporary files on disk Boolean
centuryYearOffset Century Year Offset (-yy parameter) Integer
cpInternal Internal code page (-cpinternal parameter) String
cpStream Stream code page (-cpstream parameter) String
cpColl Collation table (-cpcoll parameter) String
cpCase Case table (-cpcase parameter) String
dirSize The number of compiled procedure directory entries (-D parameter) Integer
inputChars The number of characters allowed in a single statement (-inp parameter) Integer
maximumMemory The amount of memory allocated for r-code segments (-mmax parameter) Integer
parameter Parameter (-param parameter) String
stackSize Stack size in 1KB units (-s parameter) Integer
token The number of tokens allowed in a 4GL statement (-tok parameter) Integer
compileUnderscore COMPILE statement allows underscores (-zn parameter) Boolean
paramFile Parameter file (-pf parameter). -pf is always the first argument on the command line. File
iniFile Use a .ini file (adds -basekey INI -ininame ...). Attribute is skipped if file can't be found File
TTBufferSize Buffer Size for Temporary Tables (-Bt attribute) Integer
MsgBufferSize Message buffer size (-Mm attribute) Integer
NumSep Thousands separator. Can be either a numeric value or a character, e.g. numsep="44" or numsep="," String
NumDec Fractional separator. Can be either a numeric value or a character, e.g. numdec="46" or numdec="." String
DebugReady Port on which debugger should connect (disabled by default) String
tempDir Temporary directory for Progress runtime (-T parameter) File
resultProperty The name of a property in which the return code of the Progress procedure should be stored. Only of interest if failonerror=false. String
assemblies .Net assemblies directory (-assemblies parameter). Attribute is skipped if file can't be found File
verbose Tells underlying procedure to be verbose (see footnote) Boolean
noErrorOnQuit Set to true to prevent PCT from returning an error (code 66) when a QUIT statement is executed Boolean

Parameters as nested elements

Adds a database connection on startup

Adds a group of database connection on startup

Creates a nested propath, and adds it to the implicit propath.

Adds an additional command line option to prowin32 or _progres executable. These options are always appended at the end of the standard command line (before -p parameter).

WARNING : an option containing a space will be surrounded by quotes. If a value is needed by a parameter, add it in the value attribute. This is needed if the value contains spaces for example.

Creates a parameter which can be read in the called procedure using DYNAMIC-FUNCTION('getParameter' IN SOURCE-PROCEDURE, INPUT 'ParameterName'). Returned value type is CHARACTER. If parameter is not defined, the function returns ?.

WARNING : these parameters are written in a temp-table without unique index. Defining a parameter with same name multiple times may lead to weird results (it will return ?).

Adds a character OUTPUT PARAMETER to the called procedure. This value is then written to the specified Ant property.

Defines profiler options.

Adds aliases on DB connection

env

It is possible to specify environment variables to pass to the system command via nested <env> elements.

Attribute Description Required
key The name of the environment variable. Note: (Since Ant 1.7) For Windows, the name is case-insensitive. Yes
value The literal value for the environment variable. Only one of value/path/file
path The value for a PATH like environment variable. You can use ; or : as path separators and Ant will convert it to the platform's local conventions.
file The value for the environment variable. Will be replaced by the absolute filename of the file by Ant.

About verbose attribute

The main procedure generated by PCT and calling your own procedure always contain a shared variable definition :

DEFINE NEW SHARED VARIABLE pctVerbose AS LOGICAL NO-UNDO INITIAL True/False.

The main procedure will also display some information is verbose is set to true (such as propath, database connections, parameters, and so on). In your own procedure, you can take advantage of this variable to display some information based on this verbose attribute :

DEFINE SHARED VARIABLE pctVerbose AS LOGICAL NO-UNDO.

IF pctVerbose THEN MESSAGE "Entering foo.p".
...

Examples

Example 1

<PCTRun procedure="test.p" dlcHome="${env.DLC}" />

Commandline : ${env.DLC}/bin/_progres -b -p test.p

Example 2

<PCTRun procedure="test/test.p" dlcHome="${env.DLC}" graphicalMode="true" parameter="foobar" />

Commandline : ${env.DLC}/bin/prowin32 -b -param foobar -p test/test.p

Example 3

<pct:run procedure="test/test.p" dlcHome="${env.DLC}" graphicalMode="true" parameter="foobar">
  <DBConnection dbName="foo" dbDir="base" singleUser="true">
    <PCTAlias name="foo2" />
    <PCTAlias name="foo3" />
  </DBConnection>
  <DBAlias name="foo4" value="foo" />
  <propath>
    <pathelement path="src/include" />
    <pathelement path="src/include2" />
  </propath>
  <Option name="-cprcodeout" value="utf-8" />
  <Parameter name="Param1" value="Value1" />
  <Parameter name="Param2" value="Value2" />
  <OutputParameter name="FirstParam" />
  <OutputParameter name="SecondParam" />
</pct:run>

Commandline : ${env.DLC}/bin/prowin32 -b -param foobar -cprcodeout utf-8 -p pctinitxxxx.p

Procedure test/test.p could be:

 /* Two OutputParameter nodes */
 define output parameter param1 as character no-undo.
 define output parameter param2 as character no-undo.

 { myinclude.i } /* Will be found in src/include and src/include2 */

 find first foo.MyTable. /* As foo database is connected */
 find first foo2.MyTable. /* As foo2 is an alias */
 find first foo3.MyTable. /* As foo3 is also an alias */

 define variable myvar as char no-undo.
 assign myvar = dynamic-function('getParameter' in source-procedure, 'Param1').
 display myvar. /* will display Value1 */

 assign param1 = foo.MyTable.Field1.
 assign param2 = foo.MyTable.Field2.

 if (somecondition) then
   return '0'. /* Don't forget to return a value */
 else
   return '20'. /* Any non-zero value is an error */

After PCTRun task execution, Ant properties FirstParam and SecondParam can be accessed with ${FirstParam} and ${SecondParam}, e.g.

 <echo message="FirstParam is ${FirstParam} and SecondParam is ${SecondParam}" />

Clone this wiki locally