MFUGETF

Loads a file into memory, in preparation for running data-driven tests.

Use this routine when the main .csv file under test references field data in an external file. This technique is often used when the field-level data is complex or long, and is a way to circumvent the size limits placed on the .csv file under test.

Syntax:

call "MFUGETF using by reference get-filename
                             by reference data-ptr
                             by reference data-size
end-call.

Parameters:

get-filename
pic x(n)
data-ptr
pointer
data-size
binary-long unsigned

On Entry:

get-filename
The name of the (space-terminated) file to be loaded.

On Exit:

data-ptr
The pointer to the data.
data-size
The length of the data loaded.

Comments:

If the status-code returned is anything other than 0, then it failed to allocate enough memory for the file. When the test has finished, your test clean-up should include a call to CBL_FREE_MEM, to release the memory allocated to data-ptr.

Another of the unit testing copybooks (mfunit.cpy) contains a level-78 constant, MFU-GET-FILE, which you can use in your programs to invoke this library routine.

Example:

call MFUGETF using
                   by reference ws-filename
                   by reference ws-pointer
                   by reference ws-size
           end-call