Hallo Kampi,

bzgl. VARPG und COM-Ports habe ich folgendes gefunden:

Using COM ports in VARPG
by Les Lieurance
This tip from VARPG developer Les Lieurance shows how to open a COM port (or any port of file for that matter) and send information out the port. Les uses three Windows DLL functions, CreateFileA, WriteFile, and CloseHandle, to accomplish the task. Because Les is using Windows DLLs that often require null terminated strings, he appends a null character, X'00', to the end of the strings. To open COM1:, use COM1 in VARPG part ENT1. To open COM2:, use COM2 in VARPG part ENT1.

************************************************** *******************
* Author . . . . : Les Lieurance, Braden Carco Gearmatic *
* Program ID . . : Com port *
* *
* Description . : Sample program to write data to a com port *
* *
* *
* *
************************************************** *******************
HDEBUG(*YES)
D************************************************* ********************
D* Function Prototypes ****
D** ****

D************************************************* **************************
D* Crtfile: CreateFile function from the Kernel32.dll. **Used to Open Com Port**
D************************************************* **************************
D CRTFILE PR 10U 0 ExtProc('CreateFileA')
0002 D DLL('Kernel32.dll')
0003 D Linkage(*StdCall)
D * VALUE OPTIONS(*STRING)
D 10I 0 Value
D 10I 0 Value
D $SEC LIKE(secattr)
D 10I 0 Value
D 10I 0 Value
D 10I 0 Value


D************************************************* **************************
D* WriteFile WriteFile function from the Kernel32.dll **Used to write to com port**
D************************************************* ***************************
D WRTFILE PR 10U 0 ExtProc('WriteFile')
0002 D DLL('Kernel32.dll')
0003 D Linkage(*StdCall)
D 10I 0 VALUE
D * VALUE OPTIONS(*STRING)
D 10U 0 Value
D $WRITE LIKE(WRITE)
D $OVER LIKE(OVERLAP)


D************************************************* ****************************
D* CloseFile CloseHandle function from the Kernel32.djll **Used to close the com port
D************************************************* **************************
D CLOSEFILE PR 10U 0 ExtProc('CloseHandle')
0002 D DLL('Kernel32.dll')
0003 D Linkage(*StdCall)
D 10I 0 VALUE



D************************************************* ****************************
D* Miscellaneous Initializations
D************************************************* ****************************
D secattr ds
D LENGTH 10I 0 INZ(80)
D SECDESC 10I 0 INZ(0)
D BOOL 10I 0 INZ(0)

D name S 10A
D access S 10U 0 INZ(3221225472)
D share S 10U 0 INZ(0)
Dcreate S 10I 0 INZ(3)
Dattr S 10U 0 INZ(128)
Dtemplate S 10I 0 INZ(0)
DBRC S 10U 0
DRET S 10I 0
DRET2 S 10U 0
DWRITE S 10U 0
DOVERLAP S 10U 0
D
D************************************************* ********************
D************************************************* ********************
* Notes: *
************************************************** *******************
*
C START BEGACT PRESS WIN2

C EVAL ENT1= %GETATR('WIN2':'ENT1':'TEXT') Get com port
C EVAL ENT1 = %TRIM(ENT1)+X'00' add null character t
C EVAL ENT2= %GETATR('WIN2':'ENT2':'TEXT') get data
C EVAL ENT2 = %TRIM(ENT2)+X'00' add null character
C*
C*
C Eval BRC = CRTFILE(ENT1:ACCESS:share:secattr: CreateFile function
C create:attr:template)


C Eval RET =WRTFILE(BRC:ENT2:LENGTH:WRITE:OVERLAP) WriteFile Function

C Eval RET2 = Closefile(brc) Close Com Port
C ENDACT


Gruß,
KM