home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
COMET.ZIP
/
SAMPLE.CMT
< prev
Wrap
Text File
|
1991-09-27
|
16KB
|
603 lines
# Same COMET script file
# View COMET13.INF file for details on creating a COMET script file.
comet display_on;
comet debug_on srpi;
@define LOOP_COUNT 30;
@define NO_OF_DATA_SENDS 1;
@define NO_OF_DATAGRAM_SENDS 1;
@define NO_OF_FILE_SENDS 1;
@define CALL_TIMEOUT 5; # Call timeout in minutes
@define LENGTH 30; # Length of test case in minutes.
#define SEND_FILENAME test.txt;
#define COMPARE_FILENAME test2.txt;
@define PC1 pc1;
@define PC2 pc2;
@define RECV_TIMEOUT 0; # Recv timeout in seconds (0 = no timeout)
@define SEND_TIMEOUT 0; # Send timeout in seconds (0 = no timeout)
@define groupname groupname;
@define VM1USER VM1USER;
@define VM1PSW VM1PSW;
@define AS4PSW AS4PSW;
@define AS4USER AS4USER;
@define NODE_ADDR1 NODE_ADDR1;
@define D_B "this is a test line. one two three four five six seven eight.
the quick brown fox jumped over the lazy dog.
this is a test line. one two three four five six seven eight.
the quick brown fox jumped over the lazy dog.
this is a test line. one two three four five six seven eight.
the quick brown fox jumped over the lazy dog.
this is a test line. one two three four five six seven eight.
the quick brown fox jumped over the lazy dog.";
# ACDI Calls
#
# Opem COM1 port and set ASYNCH Line Speed.
#
#------------------------------------------------------------------------
acdi open dev=com1;
acdi setbit send=1200, rcv=1200;
acdi setlinectrl stopbits=1,
parity=none,
databits=8;
#/*****************************************************************
#
# Start APPC and Autostart COMET on PC 2 and PC 3.
#
#------------------------------------------------------------------------
appc tp_started local_lu = "SENDER",
tp = "COMET.AUTOSTART",
prc=x'0';
appc mc_alloc conv=1,
remote_lu="RECEIVR2",
mode="MODE1",
tp="COMET.AUTOSTART",
sync=confirm,
prc=x'0';
appc mc_alloc conv=2,
remote_lu="RECEIVR3",
mode="MODE1",
tp="COMET.AUTOSTART",
sync=confirm,
prc=x'0';
#/***********************************************************************
#
# Database Creation and Granting Authority.
#
#------------------------------------------------------------------------
#
# Create database METMA02
#
DBM CREATE_DB DB=METMA02;
DBM START_USING_DB DB=METMA02, USE=s, RC=0;
#
# Create a table and insert values
#
SQL "CREATE TABLE testtab
(name VARCHAR(10),
dept SMALLINT)";
SQL "INSERT INTO testtab(name, dept) VALUES('Leroy',644)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Art', 644)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Brad',644)";
SQL "INSERT INTO testtab (name, dept) VALUES ('John',644)";
SQL "INSERT INTO testtab (name, dept) VALUES('Derek',644)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Dan',644)";
SQL "INSERT INTO testtab (name, dept) VALUES ('Jim',644)";
SQL "INSERT INTO testtab (name, dept) VALUES('Chuck',644)";
SQL "INSERT INTO testtab (name, dept) VALUES('Mike', 644)";
SQL "INSERT INTO testtab (name, dept) VALUES('Jeff', 644)";
SQL "GRANT dbadm ON DATABASE TO metMA222";
SQL "GRANT dbadm ON DATABASE TO metMA223";
SQL "GRANT all ON TABLE testtab TO public";
SQL "COMMIT";
appc mc_confirm conv=1;
appc mc_confirm conv=2;
#***********************************************************************
#
# Begin Scenario MA02 Main Loop.
#
#------------------------------------------------------------------------
begin_loop loop1 count=LOOP_COUNT; # Main loop for PC1
OS2_SHELL "MA02REX";
os2_shell "echo Issuing FIRST SRPI call";
OS2_API DOSBEEP 200,500;
# comet debug_on srpi;
srpi sendreq function=x'0000',
data="0987654321",
parm="12345678",
server="SRPIEM31",
rcsrpi=x'00000000',
rcsrvr=x'0000000',
rparm="12345678",
rdata="0987654321";
os2_shell "echo Issuing NEXT SRPI call";
# Verify that we are still connected to VM.
OS2_API DOSBEEP 200,500;
OS2_API DOSBEEP 200,500;
srpi sendreq server="SRPIEM31",
function = x'0000',
parm="c:\MET12\common\parm.req",
data="c:\MET12\common\data.req",
rcsrpi=x'00000000',
rcsrvr=x'00000000',
rparm="c:\MET12\common\parm.req",
rdata="c:\MET12\common\data.req";
os2_shell "dir c:\MET12\common\*.r";
os2_shell "type c:\MET12\common\parm.r";
os2_shell "type c:\MET12\common\data.r";
#************************************************************************
#
# APPC Communications
OS2_API DOSBEEP 600,500;
#
#------------------------------------------------------------------------
appc mc_send_data conv=1,data="hi there";
appc mc_confirm conv=1;
appc mc_send_data conv=2,data="hi there";
appc mc_confirm conv=2;
appc mc_send_data conv=1,data ="This is another test\
one, two, three";
appc mc_confirm conv=1;
appc mc_send_data conv=2,data ="This is another test\
one, two, three";
appc mc_confirm conv=2;
os2_api dossleep seconds=15;
appc mc_send_data conv=2, file=C:\MET12\COMMON\small.doc;
appc mc_confirm conv=2;
appc mc_rcv_wait conv=2, crc=C:\MET12\COMMON\small.doc; # check CRC
appc mc_rcv_wait conv=2, what=CONF;
appc mc_confirmed conv=2;
#************************************************************************
# Begin LAN Server/Requester Section
# Make a mailslot on Requester 1
lan make_mailslot name=\mailslot\SRVN, #Make the server mailslot
msgsize=24000,
slotsize=24000;
lan mailslot_info name=\mailslot\SRVN,
outfile=SRVN.TXT;
lan write_mailslot name=\\metMA222\mailslot\REQ1N, # Write to SL32U1
message=D_B2,
priority=8, # 9 is the highest
class = 2,
timeout=1800000; # milliseconds
lan read_mailslot name=\mailslot\SRVN, # REQ1 just wrote
timeout=-1,
outfile=REQ1.txt;
lan write_mailslot name=\\metMA223\mailslot\REQ2N, # SL32U2 mailslot
message=D_B2,
priority=8, # 9 is the highest
class = 2,
timeout=-1; # milliseconds
lan read_mailslot name=\mailslot\SRVN, # REQ2 just wrote
timeout=-1,
outfile=REQ2.txt;
lan delete_mailslot name=\mailslot\SRVN; #Delete the server mailslot
#
# End LAN Server/Requester Section
#************************************************************************
#************************************************************************
#
# Start ACDI Communications
OS2_API DOSBEEP 800,500;
#
#------------------------------------------------------------------------
comet debug_on acdi;
#
# Send a file to a secondary PC using ACDI
acdi connect type=4,
timeout1=0,
timeout2=1000,
prefix=" ",
suffix=" ",
number=" ";
os2_api dossleep seconds=5;
acdi send data="Hello There";
acdi rcv data="How are you?";
os2_api dossleep seconds=10;
acdi send file=C:\met12\common\logo.exe, timeout=1400;
acdi rcv file=C:\met12\common\logt.EXE, timeout=1000;
comet compare_files file1=c:\met12\common\logo.exe,
file2=c:\met12\common\logt.exe;
OS2_SHELL "Echo The received IBM logo will now be displayed";
OS2_SHELL "c:\met12\common\logt.exe";
#comet debug_off acdi;
os2_shell "echo Next: Disconnect";
acdi disconnect;
#/***********************************************************************
#
# 802.2 and NetBios Communication with PC 2.
OS2_API DOSBEEP 1000,500;
#
#------------------------------------------------------------------------
os2_shell "echo Opening adapter 0";
:d_open_a
802.2 dir_open_adapter open_options=x'2100', adapter=0;
:d_status
802.2 dir_status adapter=0;
:d_open_sap1
802.2 dlc_open_sap adapter=0,
sap=8,
station_count=1; # Line added by Art B 11/17
:d_open_station
802.2 dlc_open_station adapter=0,
sap=8,
station=2,
rsap=8,
dest_node_addr=x'4000AC305202',
rc=x'00';
:d_status2
802.2 dir_status adapter=0;
:d_open_sap3
802.2 dlc_open_sap adapter=0,
sap=10,
station_count=1; # Line added by Art B 11/17
os2_shell "echo Issuing read command for Sap = 2";
:d_status3
802.2 dir_status adapter=0;
os2_api dossleep seconds=20;
:d_connect
802.2 dlc_connect_station sap=8,
station=2;
802.2 receive adapter=0,
sap=8,
station=2,
rc=x'ff'; #command in progress
comet msg msg="About ready to transmit I-frame";
802.2 transmit_i_frame adapter=0,
sap=8,
station=2,
data="This is a receive that the sending side is issuing. Communications";
802.2 read adapter=0,
sap=8,
station=2,
event_set=RECEIVE, # bit 2 is RECEIVE notification
data="Hello, Arthur.";
802.2 receive_cancel adapter=0,
sap=8,
station=2,
rc=x'00';
:d_close_station
802.2 dlc_close_station adapter=0,
sap=8,
station=2,
rc=x'00';
:d_status4
802.2 dir_status adapter=0;
:d_close_sap
802.2 dlc_close_sap adapter=0,
sap=8;
:d_close_sap2
802.2 dlc_close_sap adapter=0,
sap=10;
os2_shell "echo That's it for 802.2 folks...";
#----------------------------------------------------
comet debug_on netbios;
:pc1
comet debug_on netbios;
# netbios reset;
netbios reset sessions=2, commands=4, names=10;
comet debug_off netbios;
netbios add_name_wait name=METPC1;
call call_pc2;
call send_data_test; # send a bunch of data..
os2_api dossleep seconds=10;
call send_datagrams_to_pc2;
os2_api dossleep seconds=10;
netbios session_status name=*; # get session status for all names
# This will eventually be used with B/L
netbios status call_name=METPC1,
file=c:\met12\comet\netb.lst,
display;
:add_name_test1
netbios add_name name=a1;
netbios add_name name=b1;
netbios add_name name=c1;
netbios add_name name=d1;
netbios add_name name=e1;
netbios add_name name=f1;
netbios add_name name=g1;
netbios delete_name name=a1;
netbios delete_name name=b1;
netbios delete_name name=c1;
netbios delete_name name=d1;
netbios delete_name name=e1;
netbios delete_name name=f1;
netbios delete_name name=g1;
call send_file_test;
call receive_data_test; # ... then receive a bunch...
call receive_file_test;
call hang_up_session1;
os2_api dossleep seconds=5;
netbios delete_name name=METPC1;
# netbios reset free_all = yes;
netbios reset sessions=2, commands=4, names=10, free_all=yes;
802.2 dir_close_adapter adapter=0;
# appc mc_rcv_wait conv=1, what=SEND;
appc mc_rcv_wait conv=2, what=SEND;
#/***********************************************************************
#
# Local Database SQL commands
#
#------------------------------------------------------------------------
sql "select * from testtab where dept=644", file=dept644.out;
sql "select * from testtab where dept=44", file=dept44.out;
sql "commit";
comet compare_files file1=dept644.out, file2=c:\met12\comet\dept644.vfy;
comet compare_files file1=dept44.out, file2=c:\met12\comet\dept44.vfy;
#/***********************************************************************
#
# End Scenario MA02 Main Loop.
#
#------------------------------------------------------------------------
end_loop loop1;
#
# APPC DeAllocate
#
#------------------------------------------------------------------------
appc mc_dealloc conv=1;
appc mc_dealloc conv=2;
#************************************************************************
#
# Stop Using Db and Drop Db.
#
#------------------------------------------------------------------------
os2_api dossleep seconds=60;
dbm stop_using_db;
dbm drop_db DB=METMA02;
#************************************************************************
#
# EXIT COMET.
#
#------------------------------------------------------------------------
comet exit;
# ---------------------------------------------------------------------
# Subroutines
# ---------------------------------------------------------------------
:send_datagrams_to_pc2
begin_loop send_loop count=NO_OF_DATAGRAM_SENDS;
netbios send_datagram name=METPC1, call_name=METPC2, data=D_B;
end_loop send_loop;
return;
:do_a_return # delete will take place when hang_up completes
return;
:receive_datagrams_from_pc2
begin_loop rcv_loop count=NO_OF_DATAGRAM_SENDS;
netbios recv_datagram name=METPC1, data=D_B;
end_loop rcv_loop;
return;
# ---------------------------------------------------------------------
:hang_up_temp_session
netbios hang_up session=TEMP_SESSION_NUM;
# Test to see if we get a 'Session_Closed' status. If we do that
# means that the other side has already done a Hang_Up.
if netb_rc = x'0a' clear netb_rc;
return;
:l1
begin_loop test count=10, time=1;
os2_shell "echo infinite loop!";
os2_shell "echo testing!";
end_loop test;
:test
# ---------------------------------------------------------------------
:call_pc2
# Keep issuing CALLs until we get a LISTEN.
begin_loop do_call time=CALL_TIMEOUT;
netbios call_wait name=METPC1, call_name=METPC2, session=1,
rcv_timeout=RECV_TIMEOUT, snd_timeout=SEND_TIMEOUT;
if netb_rc = x'00' break_to have_call;
clear netb_rc;
end_loop do_call;
os2_shell "echo No listen found!";
comet exit errorlevel=1;
:have_call
return;
# ---------------------------------------------------------------------
# SEND/RECEIVE test
# ---------------------------------------------------------------------
:send_data_test
begin_loop send_loop count=NO_OF_DATA_SENDS;
netbios send session=1, data=D_B;
end_loop send_loop;
return;
:receive_data_test
begin_loop rcv_loop count=NO_OF_DATA_SENDS;
netbios recv session=1, data=D_B;
end_loop rcv_loop;
return;
# ---------------------------------------------------------------------
# SEND/RECEIVE file test
# ---------------------------------------------------------------------
:send_file_test
begin_loop send_loop count=1;
netbios send session=1, file=c:\met12\common\data.req;
# w/ databse file=ma02p1.out;
#THE FILE COMPARISON WILL BE DONE LOCALLY
# By Art B comet compare_files file1=ma02p1.out, file2=ma02px.out;
end_loop send_loop;
return;
:receive_file_test
begin_loop rcv_loop count=1;
netbios recv session=1, file=data.rcv; # w/ db file=ma02py.out;
comet compare_files file1=data.rcv, file2=c:\met12\common\data.req;
# comet compare_files file1=ma02p1.out, file2=ma02py.out;
end_loop rcv_loop;
return;
# ---------------------------------------------------------------------
:hang_up_session1
netbios hang_up session=1;
# Test to see if we get a 'Session_Closed' status. If we do that
# means that the other side has already done a Hang_Up.
if netb_rc = x'0a' clear netb_rc;
return;
# ---------------------------------------------------------------------