home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
339.lha
/
DispMod
/
rexx
/
data_entry.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1990-02-07
|
4KB
|
185 lines
/* dispex.rexx - test dispmod */
options results
pack = 0
BELL = '07'x
ESC = '1B'x
CR = '0D'x
CLS = '0C'x
connected = 0
multiline = 0
maxfield = 15
inline = ''
titlebar = 'Data Entry'
con.0 = ' INPUT INHIBITED'
con.1 = ' CONNECTED'
separator = '--------------------------------------------------------------------------------'
keepgoing = TRUE
if ~exists('datafile') then do
call open(x,'datafile','w')
call close(x)
end
ports = showlist('p')
if pos('ROBBS_disp', ports) = 0 then address command run dispmod
address command waitforport 'ROBBS_disp'
ports = showlist('p')
if pos('ROBBS_disp', ports) = 0 then
exit(100)
address 'ROBBS_disp'
call openport('ROBBS_ctrl')
title titlebar ' INPUT INHIBITED'
call clearall
call initscreen
connect 'ROBBS_ctrl SEND'
connected = 1
title titlebar con.connected
status
say result
fld = 1
crsr field.1.row field.1.col+length(field.1.string)
do while keepgoing = TRUE
packet = getpkt('ROBBS_ctrl')
do while packet = '00000000'x
call waitpkt('ROBBS_ctrl')
packet = getpkt('ROBBS_ctrl')
end
arg0 = getarg(packet)
arg1 = getarg(packet,1)
call reply(packet,0)
select
when arg0 = 'SEND' then do
if pos(arg1,CR) > 0 then do
text substr(arg1,pos(arg1,CR))
field.fld.contents = inline || substr(arg1,pos(arg1,CR))
fld = fld+1
if fld > maxfield then fld = 1
crsr field.fld.row field.fld.col+length(field.fld.string)
inline = ''
end
else do
text arg1
inline = inline || arg1
end
end
when arg0 = 'FKEY' then call Fkey(arg1+1)
when arg0 = 'HELP' then say BELL || 'Help key hit.'
otherwise nop
end
end
call delay(50)
die
do while pos('ROBBS_disp', ports) > 0
call delay(5)
ports = showlist('p')
end
say 'All Done.'
exit(0)
fkey:
parse arg x
if x ~= 10 then do
select
when x = 1 then do
call open(dbfile,'datafile','A')
writeln(dbfile,'ENTRY')
do i=1 to maxfield
if index(field.i.contents,'08'x) >0 then call remdel
writeln(dbfile,field.i.contents)
end
call close(dbfile)
call clearall
call initscreen
end
when x = 5 then do
field.fld.contents = inline
fld = fld-1
if fld = 0 then fld = maxfield
crsr field.fld.row field.fld.col+length(field.fld.string)
inline = ''
end
otherwise nop
end
end
else
keepgoing = FALSE
return(0)
initscreen:
text CLS
crsr 2 25; text 'Data Entry Example'
crsr 3 1; htext separator
field.1.row = 5; field.1.col = 1; field.1.string = 'Name: '
field.2.row = 5; field.2.col = 40; field.2.string = 'Age: '
field.3.row = 7; field.3.col = 1; field.3.string = 'Address: '
field.4.row = 8; field.4.col = 1; field.4.string = ' : '
field.5.row = 9; field.5.col = 1; field.5.string = ' : '
field.6.row = 10; field.6.col = 1; field.6.string = ' : '
field.7.row = 7; field.7.col = 40; field.7.string = 'Telephone - home: '
field.8.row = 8; field.8.col = 40; field.8.string = ' - work: '
field.9.row = 14; field.9.col = 1; field.9.string = 'Comments: '
field.10.row = 15; field.10.col = 1; field.10.string = ' : '
field.11.row = 16; field.11.col = 1; field.11.string = ' : '
field.12.row = 17; field.12.col = 1; field.12.string = ' : '
field.13.row = 18; field.13.col = 1; field.13.string = ' : '
field.14.row = 19; field.14.col = 1; field.14.string = ' : '
field.15.row = 20; field.15.col = 1; field.15.string = ' : '
do i=1 to 15
crsr field.i.row field.i.col; text field.i.string || field.i.contents
end
crsr 21 1; htext separator
text 'F1: Add Data to file F5: Previous Field F6: Next Field'
crsr field.1.row field.1.col+length(field.1.string)
fld = 1
return 0
stat:
parse arg x
crsr 23 1; text '9b4b'x || x
return 0
query
stat:
parse arg x
crsr 23 1; getline '9b4b'x || x
return 0
clearall:
do i=1 to maxfield
field.i.contents = ''
end
return 0
remdel:
temp = field.i.contents
do forever
dele = index(temp,'08'x)
if dele > 0 then do
temp = left(temp,dele-2) || substr(temp,dele+1)
end
else do
field.i.contents = temp
leave
end
end
return 0