Kbase P21835: How to send and receive a binary file from SonicMQ 4GL adapt
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/24/2003 |
|
Status: Unverified
GOAL:
How to send and receive a binary file from SonicMQ 4GL adapter
FACT(s) (Environment):
SonicMQ 4GL-Adapter
FIX:
The following example shows how to put a binary file into a MEMPTR and save it back to file again. The MEMPTR can be sent and received by the broker in a bytes message.
DEFINE VARIABLE mTest AS MEMPTR NO-UNDO.
RUN loadFile2Memptr (INPUT "whatever_filename", OUTPUT mTest).
RUN saveMemptr2File (INPUT mTest, INPUT "whatever_filename").
PROCEDURE loadFile2Memptr:
DEFINE INPUT PARAMETER ipc_fileName AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER opm_message AS MEMPTR NO-UNDO.
FILE-INFO:FILE-NAME = ipc_fileName.
SET-SIZE(opm_message) = FILE-INFO:FILE-SIZE.
INPUT FROM VALUE(ipc_fileName) BINARY NO-MAP NO-CONVERT.
IMPORT UNFORMATTED opm_message.
INPUT CLOSE.
END PROCEDURE.
PROCEDURE saveMemptr2File:
DEFINE INPUT PARAMETER ipm_message AS MEMPTR NO-UNDO.
DEFINE INPUT PARAMETER ipc_fileName AS CHARACTER NO-UNDO.
OUTPUT TO VALUE(ipc_fileName) BINARY NO-MAP NO-CONVERT.
EXPORT ipm_message.
OUTPUT CLOSE.
END PROCEDURE.