home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxgdb2.zip / TestLong.CMD < prev    next >
OS/2 REXX Batch file  |  1997-08-10  |  6KB  |  248 lines

  1. /* rexx */
  2. parse arg argument
  3.  
  4. signal on error
  5. signal on syntax  name syntax
  6. signal on halt    name halt
  7. signal on failure name failure
  8. '@echo off'
  9.  
  10. 'cls'
  11. say
  12. say 'TestLong --- Testing REXXGDB2.DLL For Long SQLs & Returned Values'
  13. say 'Simon Husin (husin@ibm.net)'
  14. say 'Kent, Washington, U.S.A., June 1996'
  15. say
  16. sql = 'select text from sysibm.sysviews where length(text) > 1000'
  17.  
  18. say
  19.  
  20. if rxfuncquery('g2LoadFuncs') then do
  21.    say
  22.    say 'Loading REXXGDB2 Functions...'
  23.    call rxfuncadd 'g2LoadFuncs', 'REXXGDB2', 'g2LoadFuncs'
  24.    say 'Result =' g2LoadFuncs()
  25.    end
  26.  
  27. say
  28. call time 'R'
  29. say 'Connecting to SAMPLE database...'
  30. call g2connectshare 'SAMPLE'
  31. say 'Execution time    ' time('E') / 1
  32. say
  33. say copies('~', 78)
  34. say center('*** TESTLONG TESTS STARTED ***', 78)
  35. say
  36. say copies('~', 78)
  37.  
  38. say 'G2Immediate using IMMED (value) as input...'
  39. immed = 'set current query optimization 9'
  40. say 'Immed:' immed
  41. 'pause'
  42. call time 'R'
  43. retcode = g2immediate(immed)
  44. elapse = time('E')
  45. say 'Return Code           ' retcode
  46. say 'Completed in (seconds)' elapse
  47. say copies('~', 78)
  48.  
  49. say 'G2Immediate using ''IMMED'' as input...'
  50. immed = 'set current query optimization 0'
  51. say 'Immed:' immed
  52. 'pause'
  53. call time 'R'
  54. retcode = g2immediate('immed')
  55. elapse = time('E')
  56. say 'Return Code           ' retcode
  57. say 'Completed in (seconds)' elapse
  58. say copies('~', 78)
  59.  
  60. say 'G2SelectCols using SQL (value) as input...'
  61. say 'SQL:' sql
  62. 'pause'
  63. call time 'R'
  64. retcode = g2selectcols(sql, cols.)
  65. elapse = time('E')
  66. say 'Return Code           ' retcode
  67. say 'Completed in (seconds)' elapse
  68. say
  69. say 'Stem tot# elements    ' cols.0
  70. if retcode = 0 | retcode = 100 then do
  71.    do i = 1 to cols.0
  72.       say 'Element COLS.'i '=' cols.i
  73.       end
  74.    end
  75. say copies('~', 78)
  76.  
  77. say 'G2SelectCols using ''SQL'' as input...'
  78. say 'SQL:' sql
  79. 'pause'
  80. call time 'R'
  81. retcode = g2selectcols('sql', cols.)
  82. elapse = time('E')
  83. say 'Return Code           ' retcode
  84. say 'Completed in (seconds)' elapse
  85. say
  86. say 'Stem tot# elements    ' cols.0
  87. if retcode = 0 | retcode = 100 then do
  88.    do i = 1 to cols.0
  89.       say 'Element COLS.'i '=' cols.i
  90.       end
  91.    end
  92. say copies('~', 78)
  93.  
  94. say 'G2SelectData using SQL (value) as input...'
  95. say 'SQL:' sql
  96. 'pause'
  97. say
  98. call time 'R'
  99. retcode = g2selectdata(sql, data., reqrows)
  100. say 'Selecting data    ' retcode time('R')
  101.  
  102. say 'DATA.0   =' data.0
  103. say 'DATA.0.0 =' data.0.0
  104. if retcode = 0 | retcode = 100 then
  105. do r = 1 to data.0
  106.    do c = 1 to data.0.0
  107.       say 'DATA.'r'.'c '=' data.r.c '    length='length(data.r.c)
  108.       end
  109.    end
  110. say copies('~', 78)
  111.  
  112. say 'G2SelectData using ''SQL'' as input...'
  113. say 'SQL:' sql
  114. 'pause'
  115. call time 'R'
  116. retcode = g2selectdata('sql', data., reqrows)
  117. say 'Selecting data    ' retcode time('R')
  118.  
  119. say 'DATA.0   =' data.0
  120. say 'DATA.0.0 =' data.0.0
  121. if retcode = 0 | retcode = 100 then
  122. do r = 1 to data.0
  123.    do c = 1 to data.0.0
  124.       say 'DATA.'r'.'c '=' data.r.c '    length='length(data.r.c)
  125.       end
  126.    end
  127. say copies('~', 78)
  128.  
  129. say 'G2SelectForm using SQL (value) as input...'
  130. say 'SQL:' sql
  131. 'pause'
  132. call time 'R'
  133. retcode = g2selectform(sql, form.,,,,1100)
  134. elapse = time('E')
  135. say 'Return Code       ' retcode
  136. say 'Execution time    ' time('E')
  137. say
  138. say 'Stem tot# elements' form.0
  139. if retcode = 0 | retcode = 100 then
  140.    do r = 1 to form.0
  141.       say 'Element FORM.'r '=' form.r'    length='length(form.r)
  142.       end
  143. say copies('~', 78)
  144.  
  145. say 'G2SelectForm using ''SQL'' as input...'
  146. say 'SQL:' sql
  147. 'pause'
  148. call time 'R'
  149. retcode = g2selectform('sql', form.,,,,1100)
  150. elapse = time('E')
  151. say 'Return Code       ' retcode
  152. say 'Execution time    ' time('E')
  153. say
  154. say 'Stem tot# elements' form.0
  155. if retcode = 0 | retcode = 100 then
  156.    do r = 1 to form.0
  157.       say 'Element FORM.'r '=' form.r'    length='length(form.r)
  158.       end
  159. say copies('~', 78)
  160.  
  161. say 'G2SelectOne using SQL (value) as input...'
  162. say 'SQL:' sql
  163. 'pause'
  164. call time 'R'
  165. returned = g2selectone(sql)
  166. elapse = time('E')
  167. say 'SelectOne returns ' returned
  168. say '           length ' length(returned)
  169. say ' G2SQLCODE        ' g2sqlcode
  170. say ' G2LONGRESULT     ' g2longresult'    length='length(g2longresult)
  171. say 'Execution time    ' elapse / 1
  172.  
  173. if g2sqlcode \= 0 |,
  174.    returned \= '' then do
  175.    say
  176.    call time 'R'
  177.    say 'Commiting...'
  178.    call g2commit
  179.    say 'Execution time    ' time('E') / 1
  180.    end
  181. say copies('~', 78)
  182.  
  183. say 'G2SelectOne using ''SQL'' as input...'
  184. say 'SQL:' sql
  185. 'pause'
  186. call time 'R'
  187. returned = g2selectone('sql')
  188. elapse = time('E')
  189. say 'SelectOne returns ' returned
  190. say '           length ' length(returned)
  191. say ' G2SQLCODE        ' g2sqlcode
  192. say ' G2LONGRESULT     ' g2longresult'    length='length(g2longresult)
  193. say 'Execution time    ' elapse / 1
  194.  
  195. if g2sqlcode \= 0 |,
  196.    returned \= '' then do
  197.    say
  198.    call time 'R'
  199.    say 'Commiting...'
  200.    call g2commit
  201.    say 'Execution time    ' time('E') / 1
  202.    return /* returned value is not NULL */
  203.    end
  204.  
  205. say
  206. say 'Enter any character(s) to do the same query to replace NULL char.'
  207. parse pull nullchar
  208.  
  209. say
  210. call time 'R'
  211. returned = g2selectone('sql', nullchar)
  212. elapse = time('E')
  213. say 'SelectOne returns ' returned
  214. say '           length ' length(returned)
  215. say ' G2SQLCODE        ' g2sqlcode
  216. say ' G2LONGRESULT     ' g2longresult'    length='length(g2longresult)
  217. say 'Execution time    ' elapse / 1
  218. say
  219. say copies('~', 78)
  220. say center('*** TESTLONG TESTS COMPLETED ***', 78)
  221. say
  222. say copies('~', 78)
  223.  
  224. say
  225. call time 'R'
  226. say 'Commiting...'
  227. call g2commit
  228. say 'Execution time    ' time('E') / 1
  229. return 0
  230.  
  231.  
  232.  
  233. error:
  234. say 'Error detected...'
  235. return 10
  236.  
  237. syntax:
  238. say 'Syntax error detected...'
  239. return 20
  240.  
  241. halt:
  242. say 'Halt error detected...'
  243. return 30
  244.  
  245. failure:
  246. say 'Failure error detected...'
  247. return 40
  248.