home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
17 Bit Software 3: The Continuation
/
17-Bit_The_Continuation_Disc.iso
/
files
/
amg18.dms
/
amg18.adf
/
RexxSerial
/
testserial.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1993-12-02
|
2KB
|
54 lines
/* rexxserdev.library test program used to debug function calls */
/* open the Rexx support library */
signal on error
if ~show('L',"rexxsupport.library") then do
if addlib('rexxsupport.library',0,-30,0) then
say 'added rexxsupport.library'
else do;
say 'support library not available'
exit 10
end
end
/* open the Rexx serial device library */
if ~show( 'L', "rexxserdev.library" ) then do
if addlib( 'rexxserdev.library', 0, -30, 1 ) then
say 'added rexxserdev.library'
else do;
say 'support library not available'
exit 10
end
end
libaddr = serlibbase()
say 'serial library base =' libaddr
if seropen() then say 'serial device opened'
if serreset() then say 'serial device reset'
if ~sersetparms( 9600, 7, e, 1 ) then say 'Parms not set'
if ~serclear() then say 'buffer not clear'
if serflush( w ) then say 'write queue flushed'
if serflush( r ) then say 'read queue flushed'
block = allocmem( 20 )
addr = c2d( block )
say 'memory block address =' addr
query = SerQuery()
parse var query err rl stat
if ~err then say 'query status valid'
say 'number of characters in received buffer:' rl
say 'status word in ASCII decimal:' stat
say 'waiting for 5 characters from the remote'
text = SerRead( addr, 5 )
say 'received:' text
if ~freemem( block, 20 ) then say 'memory block not freed'
text = 'send stuff out port again'
say 'calling SerWrite'
if ~serwrite( text, length( text ) ) then say 'nothing written'
say 'back from SerWrite'
error:
if serclose() then say 'serial device closed'
if remlib( 'rexxserdev.library' ) then say 'removed rexxserdev.library'
/***************** ShoList.rexx ****************/