home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / REFLECT.ZIP / EXAMPLES.RCL < prev    next >
Encoding:
Text File  |  1989-12-28  |  6.5 KB  |  310 lines

  1.                    REFLECTION
  2.                   SAMPLE COMMAND FILES
  3.  
  4.  
  5. This file provides some sample command files to demonstrate how to perform
  6. some common functions.
  7.  
  8. *******************************************************************************
  9. ; This command file saves a disk directory listing to disk
  10. OPEN AFILE
  11. CLOSE PRINTER
  12. LOG
  13. DIR *.*
  14. LOG OFF
  15. CLOSE DISK
  16. *******************************************************************************
  17. ; This command file prompts the user for a file name and sends it to the host
  18. QUIET  STATUS ON
  19. :label
  20. display "^[[H^[[J^J^J^JWHAT FILENAME DO YOU WISH TO SEND?: "
  21. ACCEPT V1 LIMIT 30
  22. IF length(pack(V1)) = 0 OR UPPER(V1) = "E"
  23.   DISPLAY "^J^MI will quit^J^M"
  24.   STOP
  25. ENDIF
  26. display "^[[H^[[J^J^J^JSending $1^J^M"
  27. CONTINUE
  28. SEND V1
  29. IF ERROR
  30.   DISPLAY "^[[H^[[JSo Sorry^M^J"
  31. ELSE
  32.   DISPLAY "^[[H^[[JI'm done^J^M^G^G"
  33. ENDIF
  34. TRANSMIT "^M"
  35. QUIET  STATUS OFF
  36.  
  37. ************************************************************************
  38.  
  39. ; This file uses a HAYES Smartmodem to log on
  40. ; You must replace <username> and <password> with your own.
  41. ; Get response from modem
  42. TRANSMIT "AT^M"
  43. WAIT 0:0:4 FOR "OK"
  44. IF NOT FOUND
  45.   DISPLAY "No response from modem"
  46.   STOP
  47. ENDIF
  48. ; Transmit ATDT, the phone number, and a carriage return
  49. TRANSMIT "ATDT5551212^M"
  50. WAIT 0:1 FOR "CONNECT"
  51. IF NOT FOUND
  52.   DISPLAY "Call not completed"
  53.   STOP
  54. ENDIF
  55. ;
  56. :username
  57. TRANSMIT "^M"
  58. WAIT 0:0:10 FOR "Username"
  59. IF FOUND
  60.   TRANSMIT "<username>^M"
  61.   GOTO pswd
  62. ELSE
  63.   IF V0=5
  64.     DISPLAY "Timed out waiting for 'username' prompt"
  65.     STOP
  66.   ELSE
  67.     LET V0=V0+1
  68.     GOTO username
  69.   ENDIF
  70. :pswd
  71. WAIT 0:0:20 FOR "Password"
  72. IF FOUND
  73.   TRANSMIT "<password>^M"
  74.   GOTO alldone
  75. ELSE
  76.   DISPLAY "Timed out waiting for 'password' prompt"
  77.   STOP
  78. ENDIF
  79. :alldone
  80.  
  81. ************************************************************************
  82.  
  83. ; Use of a macro variable
  84. QUIET COMMAND ON
  85. :try_again
  86. DISPLAY "^[[H^[[JEnter branch to take (A,B or C): "
  87. ACCEPT V1 LIMIT 1
  88. IF NOT (V1 = "A" OR V1 = "B" OR V1 = "C")
  89.   DISPLAY "^[[H^[[JInvalid Response"
  90.   WAIT 0:0:1
  91.   GOTO try_again
  92.   ENDIF
  93. GOTO $1
  94. :A
  95. DISPLAY "^[[H^[[JI'm at 'A'"
  96. goto finish
  97. :B
  98. DISPLAY "^[[H^[[JI'm at 'B'"
  99. GOTO FINISH
  100. :C
  101. DISPLAY "^[[H^[[JI'm at 'C'"
  102. :FINISH
  103. DISPLAY "^J^M"
  104. QUIET COMMAND OFF
  105.  
  106. ************************************************************************
  107.  
  108. ; Math capabilities
  109. LET V1 = "^[[H^[[JMath Demo^J^M"
  110. DISPLAY V1
  111. LET V1 = 5
  112. LET V2 = (7-V1)*(V1+3)+V1
  113. DISPLAY "$2=(7-$1)*($1+3)+$1^J^M"
  114. LET V1 = (7-V1)*(V1+3)+V1
  115. LET V1 = "LET V1 = 10"
  116. DISPLAY "$1^J^M"
  117. $1
  118. IF V1 > 9
  119.   DISPLAY "V1 > 9^J^M"
  120.   ENDIF
  121. IF V1 < "9"
  122.   DISPLAY "BUT V1 < ""9""^J^M"
  123.   ENDIF
  124.  
  125. ************************************************************************
  126.  
  127. ; This command file demonstrates the use of the CONTINUE & DIR commands to
  128. ; verify the existence of a disk file.
  129. QUIET DISPLAY OFF
  130. :label
  131. display "^[[H^[[J^J^J^JWHAT FILENAME DO YOU WISH ME TO CHECK?: "
  132. ACCEPT V1 LIMIT 8
  133. DISPLAY "^J^M"
  134. QUIET DISPLAY ON
  135. CONTINUE
  136. DIR $1
  137. IF ERROR
  138.    QUIET DISPLAY OFF
  139.    DISPLAY "That file does not exist"
  140. ELSE
  141.    QUIET DISPLAY OFF
  142.    DISPLAY "That file is a good one"
  143. ENDIF
  144. WAIT 0:0:1
  145. GOTO LABEL
  146.  
  147. ************************************************************************
  148.  
  149. ; This command file sets up softkeys with command options:
  150. quiet command on
  151. display "^[&f1a1k8d8L  DIR   ^[&oCDIR^M"
  152. display "^[[H^[[J^[[10;15HGo into softkeys and press F1^M^J^J"
  153. ************************************************************************
  154.  
  155. ; This command file saves the entire screen to a file of your choice
  156. ; (This function may also be accomplished with the MSAVE command)
  157. ; To use this command file, type the file name you want the display to drop to
  158. ; after you type the command file name.
  159. Q COMMAND ON
  160. IF LENGTH(V1) = 0 OR LENGTH(V2) <> 0
  161.   DISPLAY "^[[HIncorrect number of parameters^M^J^G"
  162.   GOTO finish
  163.   ENDIF
  164. Q DISPLAY ON
  165. CONTINUE
  166. DIR $1
  167. IF NOT ERROR
  168.   Q DISPLAY OFF
  169.   DISPLAY "^[[HFile already exists^M^J^G"
  170.   GOTO finish
  171.   ENDIF
  172. Q DISPLAY OFF
  173. CLOSE PRINTER
  174. CONTINUE
  175. OPEN $1
  176. IF ERROR
  177.   DISPLAY "^[[HCould not open disk file^M^J^G"
  178.   GOTO finish
  179.   ENDIF
  180. DISPLAY "^[[i"
  181. CLOSE DISK
  182. OPEN PRINTER
  183. :finish
  184. Q COMMAND OFF
  185. Q STATUS OFF
  186.  
  187. ************************************************************************
  188.  
  189. ; This command file logs on to a VAX computer
  190. ;
  191. LET V0=1
  192. :uname
  193. TRANSMIT "^M"
  194. WAIT 0:0:05 FOR "Username"
  195. IF FOUND
  196.    TRANSMIT "<user name>^M"
  197.    GOTO password
  198.  ELSE
  199.    IF V0=5
  200.       DISPLAY "Timed out waiting for 'Username' prompt"
  201.       STOP
  202.     ELSE
  203.       LET V0=V0+1
  204.       GOTO uname
  205.    ENDIF
  206. ENDIF
  207. :password
  208. WAIT 0:0:30 FOR "Password"
  209. IF FOUND
  210.    TRANSMIT "<password>^M"
  211.    GOTO alldone
  212. ENDIF
  213. :alldone
  214. STOP
  215.  
  216. ******************************************************************************
  217. ;This command file dials a remote VAX through a public data network and a
  218. ;switch. Note that parity is initially set to "zeros" for the network but is
  219. ;set to "none" for communicating with the VAX.
  220. set data-bits-parity 7/SPACE
  221. set baud 1200
  222. TRANSMIT "AT^M"
  223. WAIT 0:0:4 FOR "OK"
  224. IF NOT FOUND
  225.   DISPLAY "No response from modem"
  226.   STOP
  227.   ENDIF
  228. ;Transmit modem commands to dial phone
  229. TRANSMIT "ATDT1234567^M"
  230. ;Wait at most 1 minute for connection
  231. ;If no connection, end
  232. WAIT 0:1 FOR "CONNECT"
  233. IF NOT FOUND
  234.    DISPLAY "CALL NOT COMPLETED"
  235.    STOP
  236. ENDIF
  237. LET V0=1
  238. :login
  239. WAIT 0:0:02
  240. TRANSMIT "a^M"
  241. WAIT 0:0:05 FOR "log in"
  242. IF FOUND
  243.   LET V0=1
  244.   TRANSMIT "<login>^M"
  245.   GOTO password
  246. ELSE
  247.   IF V0=5
  248.     DISPLAY "Timed out waiting for network 'login' prompt"
  249.     STOP
  250.   ELSE
  251.     LET V0=V0+1
  252.     GOTO login
  253.   ENDIF
  254. ENDIF
  255. :password
  256. WAIT 0:0:20 FOR "password"
  257. IF FOUND
  258.   TRANSMIT "<password>^M"
  259.   GOTO class
  260. ELSE
  261.     DISPLAY "Timed out waiting for network 'Password' prompt"
  262.     STOP
  263. ENDIF
  264. :class
  265. WAIT 0:0:30 FOR "CLASS"
  266. IF FOUND
  267.   TRANSMIT "<class>^M"
  268.   GOTO handlego
  269. ELSE
  270.     DISPLAY "Timed out waiting for 'class' prompt"
  271.     STOP
  272. ENDIF
  273. :handlego
  274. WAIT 0:0:20 FOR "GO"
  275. IF FOUND
  276.   WAIT 0:0:2
  277.   TRANSMIT "^M"
  278.   GOTO username
  279. ELSE
  280.   DISPLAY "Timed out waiting for 'go'"
  281.   STOP
  282. ENDIF
  283. :username
  284. TRANSMIT "^M"
  285. WAIT 0:0:05 FOR "Username"
  286. IF FOUND
  287.   TRANSMIT "<username>^M"
  288.   GOTO pswd
  289. ELSE
  290.   IF V0=5
  291.     DISPLAY "Timed out waiting for 'username' prompt"
  292.     STOP
  293.   ELSE
  294.     LET V0=V0+1
  295.     GOTO username
  296.   ENDIF
  297. :pswd
  298. WAIT 0:0:20 FOR "Password"
  299. IF FOUND
  300.   TRANSMIT "<Password>^M"
  301.   GOTO alldone
  302. ELSE
  303.   DISPLAY "Timed out waiting for 'password' prompt"
  304.   STOP
  305. ENDIF
  306. :alldone
  307. set data-bits-parity 8/NONE
  308. STOP
  309.  
  310.