$FunImg: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
(No difference)

Revision as of 21:32, 7 November 2012

Retrieve data from active Fast/Unload request into image

This retrieves data from an active Fast/Unload request into an image.

The first argument is the request identifier returned by $FunLoad for the request from which data is to be retrieved. This is a required argument.

The second argument is the image item to which data is to be returned. Data is returned starting at that image item and continuing to the end of the image or until no more Fast/Unload data is available in the current record.

Syntax

<section begin="syntax" />%result = $FunImg(req_num, image_item) <section end="syntax" />

%result is set either to the number of bytes returned, or to an error code if no data was returned.

>0 - Number of bytes in unloaded record 0 - &FUNL completed with return code 0; no more data -1 - Request not found -2 - Invalid image item <-2 - &FUNL completed with non-zero return code, value returned is negative of return code; no more data

$FunImg Error Codes

If Fast/Unload has not unloaded any records yet, $FunImg will wait for the first record. Each invocation of $FunImg skips over the record processed so that the next invocation will retrieve the next unloaded record.

$FunImg's can be mixed with $FunSkip and $FunsStr calls for the same request. In addition, multiple unloads can be performed simultaneously with $FunImg calls for the different requests mixed freely.

For example

%REQ = $FunLoad('DATA', , , '*') IF %REQ LE 0 THEN STOP END IF %RC = $FunImg( %REQ, %IMAGE:ITEM )

starts an unload request and then returns the first record into image 'IMAGE', starting at item 'ITEM' in the image. If the record is shorter than the rest of the image (starting at 'ITEM'), then only as much data as is in the Fast/Unload record is used to overlay the image. All other data in the image is left unchanged. If the record is longer than the rest of the image, the record is truncated before overlaying the image. In all cases, when %RC is positive, it contains the length of the original Fast/Unload record.

Products authorizing $FunImg