ENVIRONMENT DIVISION.
DATA DIVISION.
working-Storage section.
01 LINEA-INFORME-X.
03 Comando PIC X VALUE X"08".
03 Comandobis PIC X VALUE X"02".
01 LINEA-EXTRA-x.
03 DataField1 PIC X VALUE X"0C".
03 DataField2 PIC X VALUE X"21".
01 sPort PIC S9(9) COMP-5.
01 sBaudio PIC S9(9) COMP-5.
01 SProtocol PIC S9(9) COMP-5.
01 gState PIC S9(9) COMP-5.
01 FUNC-EPSON-LIB Pic x(40).
01 BufferLen pic S9(9) COMP-5 VALUE 0.
01 version pic x(250).
PROCEDURE DIVISION.
call CLEARLIST OF p-comandos.
***** Purge
* call ADDSTRING of p-comandos using "Purge".
* MOVE "Purge" TO FUNC-EPSON-LIB.
* CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE VERSION.
* display PROGRAM-STATUS.
* move VERSION to POW-TEXT of l-version.
* call DISPLAYMESSAGE of ComFis using "Ver Version".
***** GetAPIVersion
call ADDSTRING of p-comandos using "Ver la Version de la DLL".
MOVE "GetAPIVersion" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE VERSION.
display PROGRAM-STATUS.
move VERSION to POW-TEXT of l-version.
call DISPLAYMESSAGE of ComFis using "Ver Version".
***** setComPort
call ADDSTRING of p-comandos using "Setear el puerto".
MOVE spaces TO FUNC-EPSON-LIB.
MOVE "setComPort" TO FUNC-EPSON-LIB.
move 0 to sPort.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY VALUE sPort.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "Seteo de puerto".
***** getLastError
call ADDSTRING of p-comandos using "getLastError".
MOVE "getLastError" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY VALUE gState.
display gState.
move VERSION to POW-TEXT of l-version.
call DISPLAYMESSAGE of ComFis using "Ver Version".
***** getState
* call ADDSTRING of p-comandos using "getState".
* MOVE "getState" TO FUNC-EPSON-LIB.
* CALL FUNC-EPSON-LIB WITH STDCALL USING BY VALUE gState.
* display gState.
* display PROGRAM-STATUS.
* move VERSION to POW-TEXT of l-version.
* call DISPLAYMESSAGE of ComFis using "Ver Version".
***** setBaudRate
call ADDSTRING of p-comandos using "Setear los baudios".
MOVE spaces TO FUNC-EPSON-LIB.
MOVE "setBaudRate" TO FUNC-EPSON-LIB.
move 9600 TO sBaudio *> set baudios
CALL FUNC-EPSON-LIB WITH STDCALL USING BY VALUE sBaudio.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "Seteo de baudios".
***** setProtocolType
call ADDSTRING of p-comandos using "setProtocolType".
move spaces TO FUNC-EPSON-LIB.
MOVE "setProtocolType" TO FUNC-EPSON-LIB.
MOVE 1 TO SProtocol.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY VALUE SProtocol.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "setProtocolType".
***** OpenPort
call ADDSTRING of p-comandos using "OpenPort".
MOVE spaces TO FUNC-EPSON-LIB.
MOVE "OpenPort" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE VERSION.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "Open Port".
***** Ver que comando
*AddDataField
call ADDSTRING of p-comandos using "AddDataField LINEA-INFORME-X".
move spaces TO FUNC-EPSON-LIB.
MOVE 2 TO BufferLen.
MOVE "AddDataField" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE LINEA-INFORME-X
BY VALUE BufferLen.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "AddDataField LINEA-INFORME-X".
move spaces TO FUNC-EPSON-LIB.
*AddDataField
call ADDSTRING of p-comandos using "AddDataField LINEA-EXTRA-X".
MOVE 2 TO BufferLen.
MOVE "AddDataField" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE LINEA-EXTRA-x
BY VALUE BufferLen.
display PROGRAM-STATUS.
move spaces TO FUNC-EPSON-LIB.
call DISPLAYMESSAGE of ComFis using "AddDataField LINEA-EXTRA".
*SendCommand
call ADDSTRING of p-comandos using "SendCommand".
MOVE "SendCommand" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE VERSION.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "SendComand".
***** ClosePort
call ADDSTRING of p-comandos using "ClosePort".
MOVE spaces TO FUNC-EPSON-LIB.
MOVE "ClosePort" TO FUNC-EPSON-LIB.
CALL FUNC-EPSON-LIB WITH STDCALL USING BY REFERENCE VERSION.
display PROGRAM-STATUS.
call DISPLAYMESSAGE of ComFis using "Close Port".