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.
%result = $FunImg(req_num, image_item)
%result is set to either of these:
- The number of bytes returned
- An error code if no data was returned:
>0 - Number of bytes in unloaded record 0 — Fast/Unload completed with return code 0; no more data -1 — Request not found -2 — Invalid image item <-2 — Fast/Unload completed with non-zero return code, and value returned is negative of return code; no more data
- If Fast/Unload has not unloaded any records yet, $FunImg waits for the first record. Each invocation of $FunImg skips over the record processed, so the next invocation retrieves the next unloaded record.
- $FunImg calls 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.
This fragment starts an unload request and then returns the first record into image
IMAGE, starting at item
ITEM in the image:
%req = $FunLoad('DATA', , , '*') If %req le 0 then Stop End if %rc = $FunImg( %req, %image:ITEM )
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.