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

  1. /* rexx */
  2. signal on error
  3. signal on syntax  name error
  4. signal on halt    name error
  5. signal on failure name error
  6. '@echo off'
  7.  
  8. line = copies('-', 79)
  9.  
  10. 'cls'
  11. say
  12. say 'G2Immed --- Testing REXXGDB2.DLL function: G2Immediate'
  13. say 'Simon Husin (husin@ibm.net)'
  14. say 'Kent, Washington, U.S.A., December 1995'
  15. say
  16.  
  17. if rxfuncquery('g2LoadFuncs') then do
  18.    say
  19.    say 'Loading REXXGDB2 Functions...'
  20.    call rxfuncadd 'g2LoadFuncs', 'REXXGDB2', 'g2LoadFuncs'
  21.    say 'Result =' g2LoadFuncs()
  22.    end
  23.  
  24. say
  25. call time 'R'
  26. say 'Connecting to SAMPLE database...'
  27. call g2connectshare 'SAMPLE'
  28. say 'Execution time    ' time('E') / 1
  29.  
  30. /* Before Insert */
  31. say line
  32. say center('ORG before inserting DEPTNUMB = 99', 79)
  33. call ShowOrg
  34.  
  35. /*
  36. Insert a row in table ORG
  37. */
  38. sql = 'insert into org (deptnumb, deptname, manager, division, location)'||,
  39.       "       values (99, 'Europe', 290, 'World', 'Brussels')"
  40. say
  41. say 'Inserting Department# 99...'
  42. call time 'R'
  43. retcode = g2immediate(sql)
  44. elapse = time('E')
  45. say 'Return Code       ' retcode
  46. say 'Execution time    ' time('E')
  47.  
  48. /* After Insert */
  49. say line
  50. say center('ORG after inserting DEPTNUMB = 99', 79)
  51. call ShowOrg
  52.  
  53. /*
  54. Delete the new row from table ORG
  55. */
  56. sql = 'delete from org where deptnumb = 99'
  57. say
  58. say 'Deleting Department# 99...'
  59. call time 'R'
  60. retcode = g2immediate(sql)
  61. elapse = time('E')
  62. say 'Return Code       ' retcode
  63. say 'Execution time    ' time('E')
  64.  
  65. /* After Delete */
  66. say line
  67. say center('ORG after deleting DEPTNUMB = 99', 79)
  68. call ShowOrg
  69.  
  70. say
  71. call time 'R'
  72. say 'Rolling back...'
  73. call g2rollback
  74. say 'Execution time    ' time('E') / 1
  75. return 0
  76.  
  77.  
  78.  
  79. ShowOrg:
  80. sql = 'Select * from org'
  81. stem = 'form.'
  82. requestedrows = 999999999
  83. nullchar      = '%'
  84. padchar       = '_'
  85. varcharlen    = 10
  86.  
  87. say
  88. call time 'R'
  89. retcode = g2selectform(sql, stem, requestedrows, nullchar, padchar, varcharlen)
  90. elapse = time('E')
  91. say 'Return Code       ' retcode
  92. say 'Execution time    ' time('E')
  93. say
  94. say 'Stem tot# elements' form.0
  95. if retcode = 0 | retcode = 100 then
  96.    do i = 1 to form.0
  97.       say 'Element FORM.'i '=' form.i
  98.       end
  99. say line
  100. say 'All ORG rows have just been listed.'
  101. say 'Press Enter to continue.'
  102. pull answer
  103. return
  104.  
  105.  
  106.  
  107. error:
  108. say 'Error detected...'
  109. return 10
  110.  
  111. syntax:
  112. say 'Syntax error detected...'
  113. return 20
  114.