home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OPNOS2.ZIP / KLTESE.ARS < prev    next >
Text File  |  1993-02-23  |  47KB  |  316 lines

  1. 1Data Entry                Main            regular  read/write                                                                                      
  2. 31ISQH    read/writeyes                                                                                                                             
  3. 32SQH     read/writeyes                                                                                                                             
  4. 4QBEtitleSelect query                                                                                                                               
  5. 4Commit  Commit                                                                                                                                     
  6. 4DelMsg  Delete the record                                                                                                                          
  7. 4Exist   Record exist                                                                                                                               
  8. 4Exit    Quit                                                                                                                                       
  9. 4OrdTitleOrder by                                                                                                                                   
  10. 4Cursor  Cursor                                                                                                                                     
  11. 4QrErr   SQL Communication problem                                                                                                                  
  12. 4First   First record                                                                                                                               
  13. 4Last    Last record                                                                                                                                
  14. 4NoRec   No  records                                                                                                                                
  15. 4NoCur   No current record to delete/update                                                                                                         
  16. 4WriteErrFile Access Error                                                                                                                          
  17. 5Order   Order by       Char   Lf-T-Rgh 26  1  ;                                                                                                    
  18. 5RecCunt RecCunt        Long   Positive  6  10;                                                                                                     
  19. 5Date0   Date 0         Date   American 10  101/01/0001;                                                                                            
  20. 5Zero    zero           Long   Positive1  1  0;                                                                                                     
  21. 5One     One            Long   Positive1  1  1;                                                                                                     
  22. 5Two     two            Long   Positive 1 1  2;                                                                                                     
  23. 5Title   title          Char   Lf-T-Rgh20 1  SQL data entry;                                                                                        
  24. 5BLANK   blank          Char   Lf-T-Rgh1  1   ;                                                                                                    .
  25. 5Dummy   dummy          Char   Lf-T-Rgh10 1  1;                                                                                                    .
  26. 5Max                    Long   Positive 10  132767;                                                                                                 
  27. 5Record                 Long   Positive 10  10;                                                                                                     
  28. 5LastRec                Long   Positive 10  10;                                                                                                     
  29. 5ConList ConList        Char   Lf-T-Rgh2  6  >=;<=;=;<>;>;<;                                                                                       .
  30. 5OpList  OpList         Char   Lf-T-Rgh3    2AND;OR;                                                                                               .
  31. 5OK                     IntegerPositive  1  10;                                                                                                     
  32. 5OKtitle                Char   Lf-T-Rgh  4  1O.K.;                                                                                                  
  33. 5CANCEL                 IntegerPositive  1  10;                                                                                                     
  34. 5CAtitle                Char   Lf-T-Rgh  8  1Esc=Quit;                                                                                              
  35. 5Long22                 Long   Positive  21  22;                                                                                                    
  36. 5SqErr                  Long   Positive  6  10;                                                                                                     
  37. 5TempFileTempFile       Char   Lf-T-Rgh  8  1Dummy;                                                                                                 
  38. 5SysDate SysDate        Date   American 10  100/00/0000;                                                                                            
  39. 5SysTime SysTime        Time   Time      8  100:00:00;                                                                                              
  40. 5Cursor  Cursor         Char   Lf-T-Rgh 10  1;                                                                                                      
  41. 6MAIN      2.000  6.632 76.167  1.316L_FRAME         DARKGREEN       0Title                   Data    0.5    0.5    6      8                        
  42. 6QBE      11.333 -0.053 85.000 17.368L_FRAME         DARKGREEN       !QBEtitle                Query   2      0.5    6      8                        
  43. 7MAIN    1Key1    0Dummy    57.667  0.158  7.500  1.000S_ARISTO        CYAN            BLUE            KEY              NONE                        
  44. 7QBE     !Key1    0Dummy     1.667 12.737 10.000  1.000S_ARISTO        CYAN            BLUE            QBEtitle         NONE                        
  45. 7QBE     !OrdTitle0Dummy    15.167  3.053 12.500  1.000S_ARISTO        CYAN            NEUTRAL         QBEtitle         NONE                        
  46. 7QBE     0Order   0OrdList  30.000  3.053 32.500  1.000S_LIST          CYAN            NEUTRAL         QBE1             NONE                        
  47. 7QBE     0OK      0OKtitle  15.167  0.579 12.667  1.474S_BUTTON        GREEN           NEUTRAL         QBE1             NONE                        
  48. 7QBE     0CANCEL  0CAtitle  30.000  0.579 13.167  1.474S_BUTTON        RED             NEUTRAL         QBE1             NONE                        
  49. 8Select  SELECT 2.*                                                                                                                                 
  50. 8        FROM 2.                                                                                                                                    
  51. 8f1_list                                                                                                                                            
  52. 8        WHERE (                                                                                                                                    
  53. 8q_where                                                                                                                                            
  54. 8        )                                                                                                                                          
  55. 8        ORDER BY    0.Order                                                                                                                        
  56. 8Insert  INSERT INTO 2. VALUES (                                                                                                                    
  57. 8f_values                                                                                                                                           
  58. 8        )                                                                                                                                          
  59. 8Update  UPDATE 2. SET                                                                                                                              
  60. 8d_values                                                                                                                                           
  61. 8        WHERE (                                                                                                                                    
  62. 8k_where                                                                                                                                            
  63. 8        )                                                                                                                                          
  64. 8Delete  DELETE FROM 2.  WHERE (                                                                                                                    
  65. 8k_where                                                                                                                                            
  66. 8        )                                                                                                                                          
  67. 8Close   CLOSE                                                                                                                                      
  68. 8SG_Srvr                                                                                                                                            
  69. 8Commit  COMMIT                                                                                                                                     
  70. 8SG_Srvr                                                                                                                                            
  71. 8RollbackROLLBACK                                                                                                                                   
  72. 8SG_Srvr                                                                                                                                            
  73. 9Main             If      Root                                                                                                                      
  74. 9                 New-Scr                  0Title                                                                                                   
  75. 9                 Setoff                            Z5                                                                                              
  76. 9                 Seton                             M0                                                                                              
  77. 9                 EndIf                                                                                                                             
  78. 9                 Setoff                            Q5                                                                                              
  79. 9                 Setoff                            O5                                                                                              
  80. 9##########The Z5 flag indicates changes in database.                                                                                               
  81. 9##########In the case of a linked task, M0 is used to indicate that the task is the root task.                                                     
  82. 9##########The O5 flag indicates that there is an open Select Query.                                                                                
  83. 9##########The Q5 flag is the "NotQuit" loop flag.                                                                                                  
  84. 9                 Perform                              Clear                                                                                        
  85. 9Loop             While   NotQuit                                                                                                                   
  86. 9                 Edit   #MAIN             0Zero    Z1                                                                                              
  87. 9                 Clr-Lin#MAIN                                                                                                                      
  88. 9LoopEnd          EndBlck                                                                                                                           
  89. 9                 Perform                              Close                                                                                        
  90. 9                 Perform                              IfChange                                                                                     
  91. 9                 Return                                                                                                                            
  92. 9##########The following Insert routine is executed when the INSERT or APPEND Edit operation is                                                     
  93. 9##########selected.                                                                                                                                
  94. 9Insert                                                                                                                                             
  95. 9                 Setoff                            I1                                                                                              
  96. 9                 Perform                              First                                                                                        
  97. 9##########The "First" routine is used here to initiate fields and clear them of previous values.                                                   
  98. 9                 Perform                              Disp*                                                                                        
  99. 9Ins1             Perform                              AccKey                                                                                       
  100. 9##########The key fields data are entered by the user in the "AccKey" routine. If the user aborts the data                                         
  101. 9##########entry, the flag A1 is set to ON and the Insert routine is aborted, returning the ON status of the                                        
  102. 9##########I1 flag to the Edit command.                                                                                                             
  103. 9              A1 Seton                             I1 InsEnd                                                                                       
  104. 9                 Perform                              AccData                                                                                      
  105. 9##########The data fields data are entered by the user in the "AccData" routine. If the user aborts the                                            
  106. 9##########data entry, the flag A2 is set to ON and the flow is diverted to the "Ins1" label.                                                       
  107. 9              A2 Goto                                 Ins1                                                                                         
  108. 9                 Move   +100              0SqErr                                                                                                   
  109. 9                 Ex-Sql ?Insert           0SqErr   Q1                                                                                              
  110. 9                 If      NoErr                                                                                                                     
  111. 9                 Seton                             Z5                                                                                              
  112. 9                 Add    0Record  +1       1RECORD                                                                                                  
  113. 9                 Write  1                          I0                                                                                              
  114. 9                 Perform                              I/O_ok                                                                                       
  115. 9                 If      I/O_ok                                                                                                                    
  116. 9                 Move   1RECORD           0Record                                                                                                  
  117. 9                 Else                                                                                                                              
  118. 9                 Seton                             I1                                                                                              
  119. 9                 EndIf                                                                                                                             
  120. 9                 Else                                                                                                                              
  121. 9                 Seton                             I1                                                                                              
  122. 9                 EndIf                                                                                                                             
  123. 9InsEnd           Return                                                                                                                            
  124. 9##########          ----- Insert routine end ---------                                                                                             
  125. 9##########The following Update routine is executed when the UPDATE edit operation is selected.                                                     
  126. 9Update                                                                                                                                             
  127. 9                 Setoff                            U1                                                                                              
  128. 9                 Find   1RECORD                    I0                                                                                              
  129. 9                 Perform                              I/O_ok                                                                                       
  130. 9                 Perform                              Disp*                                                                                        
  131. 9##########The "Disp*" routine is executed after the record is found to display the field values.                                                   
  132. 9                 Perform                              AccData                                                                                      
  133. 9              A2 Seton                             U1 UpdEnd                                                                                       
  134. 9                 Move   +100              0SqErr                                                                                                   
  135. 9                 Ex-Sql ?Update           0SqErr   Q1                                                                                              
  136. 9                 If      NoErr                                                                                                                     
  137. 9                 Seton                             Z5                                                                                              
  138. 9                 Rewrite1                          I0                                                                                              
  139. 9                 Perform                              I/O_ok                                                                                       
  140. 9                 EndIf                                                                                                                             
  141. 9UpdEnd           Return                                                                                                                            
  142. 9##########          ----- Update routine end ---------                                                                                             
  143. 9##########The following Delete routine is executed when the Delete Edit operation is selected.                                                     
  144. 9Delete                                                                                                                                             
  145. 9                 Setoff                            D1                                                                                              
  146. 9                 Find   1RECORD                    I0                                                                                              
  147. 9                 Perform                              I/O_ok                                                                                       
  148. 9                 Message!DelMsg  +2       +1       D1                                                                                              
  149. 9##########The record is deleted after a presentation of warning message.                                                                           
  150. 9                 If      Delete                                                                                                                    
  151. 9                 Move   +100              0SqErr                                                                                                   
  152. 9                 Ex-Sql ?Delete           0SqErr   Q1                                                                                              
  153. 9                 If      NoErr                                                                                                                     
  154. 9                 Delete 1                          I0                                                                                              
  155. 9                 Perform                              I/O_ok                                                                                       
  156. 9                 EndIf                                                                                                                             
  157. 9                 EndIf                                                                                                                             
  158. 9DelEnd           Return                                                                                                                            
  159. 9##########          ----- Delete routine end ---------                                                                                             
  160. 9##########The Display routine is called by the Edit command. There is no Display command in this                                                   
  161. 9##########routine, because the display is initiated automaticly by the Edit command.                                                               
  162. 9Display          Find   1RECORD                    I0                                                                                              
  163. 9                 Perform                              I/O_ok                                                                                       
  164. 9                 Return                                                                                                                            
  165. 9##########          ----- Display routine end ---------                                                                                            
  166. 9##########The First routine is executed when the Edit command needs to intiate the field values.                                                   
  167. 9FirstRut         Move   +0                1RECORD                                                                                                  
  168. 9                 Perform                              First                                                                                        
  169. 9                 Return                                                                                                                            
  170. 9First            Moves  0BLANK            1Key1                                                                                                    
  171. 9                 Setoff                            F1                                                                                              
  172. 9                 Return                                                                                                                            
  173. 9##########          ----- First routine end ---------                                                                                              
  174. 9##########The Last routine is executed when the Edit command needs to maximize the field values.                                                   
  175. 9Last-1           Move   0Max              1RECORD                                                                                                  
  176. 9                 Setoff                            L1                                                                                              
  177. 9                 Return                                                                                                                            
  178. 9##########          ----- Last routine end ---------                                                                                               
  179. 9##########The Next routine is executed when the Edit command needs to read the next record, either for                                             
  180. 9##########internal use or as a result of user selection.                                                                                           
  181. 9Next             Setoff                            N1                                                                                              
  182. 9                 Read   1RECORD                    I0                                                                                              
  183. 9                 Perform                              I/O_ok                                                                                       
  184. 9              I0 Seton                             N1                                                                                              
  185. 9                 If      Fetch1                                                                                                                    
  186. 9                 Perform                              Fetch1                                                                                       
  187. 9              I0=Setoff                            N1                                                                                              
  188. 9                 EndIf                                                                                                                             
  189. 9                 Return                                                                                                                            
  190. 9##########          ----- Next routine end ---------                                                                                               
  191. 9##########The Prev routine is executed when the Edit command needs to read the previous record,                                                    
  192. 9##########either for internal use or as a result of user selection.                                                                                
  193. 9Prev             Setoff                            P1                                                                                              
  194. 9                 Prev   1RECORD                    I0                                                                                              
  195. 9                 Perform                              I/O_ok                                                                                       
  196. 9              I0 Seton                             P1                                                                                              
  197. 9                 Return                                                                                                                            
  198. 9##########          ----- Prev routine end ---------                                                                                               
  199. 9##########The QBE routine is executed when the query option is selected.                                                                           
  200. 9##########It is an Exit+ routine; when it is finished the Edit command ends.                                                                       
  201. 9##########Since the Q5 flag is left off, the main loop will continue and the Edit command will start again.                                        
  202. 9QBE              Put-Lin#QBE              0Zero                                                                                                    
  203. 9                 Setoff                            E1                                                                                              
  204. 9                 Perform                              Clear                                                                                        
  205. 9                 Perform                              First                                                                                        
  206. 9                 Display#QBE                                                                                                                       
  207. 9AccQbe           Accept *QBE1                      Q2                                                                                              
  208. 9                 Clr-Lin#QBE                                                                                                                       
  209. 9                 If      ExcQbe                                                                                                                    
  210. 9##########After a query is typed by the user, a Select Query is executed, followed by a fetching loop.                                             
  211. 9                 Perform                              Close                                                                                        
  212. 9                 Get-Dat0SysDate 0SysTime                                                                                                          
  213. 9                 Encode 0SysTime          0Cursor                                                                                                  
  214. 9                 Move   +100              0SqErr                                                                                                   
  215. 9                 Ex-Sql ?Select  0Cursor  0SqErr   Q1                                                                                              
  216. 9                 If      NoErr                                                                                                                     
  217. 9                 Seton                             O5                                                                                              
  218. 9                 Move   +0                0Record                                                                                                  
  219. 9                 Perform                              10Fetch                                                                                      
  220. 9                 EndIf                                                                                                                             
  221. 9                 EndIf                                                                                                                             
  222. 9                 Return                                                                                                                            
  223. 910Fetch          Add    0Record  +10      0RecCunt                                                                                                 
  224. 9                 Until   10Fetch                                                                                                                   
  225. 9                 Perform                              Fetch1                                                                                       
  226. 9              Q1 QtLoop                                                                                                                            
  227. 9                 EndBlck                                                                                                                           
  228. 9                 Return                                                                                                                            
  229. 9Fetch1                                                                                                                                             
  230. 9                 Move   +0                0SqErr                                                                                                   
  231. 9                 Fetch  ?Select  0Cursor  0SqErr   Q1                                                                                              
  232. 9              Q1-Message!QrErr   +1       +1                                                                                                       
  233. 9                 If      NoErr                                                                                                                     
  234. 9                 Add    0Record  +1       1RECORD                                                                                                  
  235. 9Move2t1          Moves  2Key1             1Key1                                                                                                    
  236. 9                 Write  1                          I0                                                                                              
  237. 9                 Perform                              I/O_ok                                                                                       
  238. 9              I0=Move   1RECORD           0Record                                                                                                  
  239. 9                 EndIf                                                                                                                             
  240. 9                 Return                                                                                                                            
  241. 9##########The Exit routine is executed when the Edit operation Exit is selected.                                                                   
  242. 9##########The Exit operation ends Edit command execution.                                                                                          
  243. 9Exit             Message!Exit    +2       +1       E1                                                                                              
  244. 9              E1=Seton                             Q5                                                                                              
  245. 9                 Return                                                                                                                            
  246. 9##########The Exit- routine is executed when the Edit operation Exit- is selected.                                                                 
  247. 9##########The Exit- operation ends Edit command execution and sets the Edit flag to "-".                                                           
  248. 9Exit-            Message!Exit    +2       +1       E1                                                                                              
  249. 9              E1=Seton                             Q5                                                                                              
  250. 9                 Find   1RECORD                    I0                                                                                              
  251. 9                 Perform                              I/O_ok                                                                                       
  252. 9                 Return                                                                                                                            
  253. 9##########The following routine results in an I/O error message.                                                                                   
  254. 9I/O_ok                                                                                                                                             
  255. 9              I0-Message!WriteErr+1       +1                                                                                                       
  256. 9              I0-Seton                             I1                                                                                              
  257. 9              I0-Seton                             U1                                                                                              
  258. 9              I0-Seton                             D1                                                                                              
  259. 9              I0-Seton                             L1                                                                                              
  260. 9              I0-Seton                             N1                                                                                              
  261. 9              I0-Seton                             P1                                                                                              
  262. 9                 Return                                                                                                                            
  263. 9##########All user data are entered in the Key fields here.                                                                                        
  264. 9AccKey           Accept *KEY                       A1                                                                                              
  265. 9                 Return                                                                                                                            
  266. 9##########All user data are entered in the Data fields here.                                                                                       
  267. 9AccData          Accept *DATA                      A2                                                                                              
  268. 9                 Return                                                                                                                            
  269. 9Disp*            Display*KEY                                                                                                                       
  270. 9                 Display*DATA                                                                                                                      
  271. 9                 Return                                                                                                                            
  272. 9Close            Move   +100              0SqErr                                                                                                   
  273. 9                 If      Close                                                                                                                     
  274. 9                 Ex-Sql ?Close   0Cursor  0SqErr   Q1                                                                                              
  275. 9                 Setoff                            O5                                                                                              
  276. 9                 EndIf                                                                                                                             
  277. 9                 Return                                                                                                                            
  278. 9IfChange         If      Changed                                                                                                                   
  279. 9                 Move   +100              0SqErr                                                                                                   
  280. 9                 Message!Commit  0Two     +1       M1                                                                                              
  281. 9              M1=Ex-Sql ?Commit           0SqErr   Q1                                                                                              
  282. 9              M1 Ex-Sql ?Rollback         0SqErr   Q1                                                                                              
  283. 9                 EndIf                                                                                                                             
  284. 9                 Return                                                                                                                            
  285. 9Clear            Reopen 1        0TempFile                                                                                                         
  286. 9                 Move   +0                0Record                                                                                                  
  287. 9                 Move   +0                1RECORD                                                                                                  
  288. 9                 Return                                                                                                                            
  289. BNotQuit ^Q5      ^=       ^=                                                                                                                       
  290. BExcQbe  ^Q2      ^=       ^=       And                                                                                                             
  291. B        0CANCEL  +0       +0                                                                                                                       
  292. BClose   ^O5      ^+       ^+                                                                                                                       
  293. BFetch1  ^N1      ^+       ^+       And                                                                                                             
  294. B        ^O5      ^+       ^+                                                                                                                       
  295. BRoot    ^Z0      ^=       ^=                                                                                                                       
  296. BChanged ^M0      ^+       ^+       And                                                                                                             
  297. B        ^Z5      ^+       ^+                                                                                                                       
  298. BNoErr   ^Q1      ^=       ^=                                                                                                                       
  299. BI/O_ok  ^I0      ^=       ^=                                                                                                                       
  300. B10Fetch 1RECORD  0RecCunt 0RecCunt                                                                                                                 
  301. BDelete  ^D1      ^=       ^=                                                                                                                       
  302. CMAIN    1      1      100.00015.65  DARKGRAY        0Title   0Title                                                                                
  303. KMAIN    1RECORD  DISPLAY Space   Display A1Displa~y                                                                                                
  304. K                 FIRST   Home    FirstRutF1~First                                                                                                  
  305. K                 LAST    End     Last-1  L1~Last                                                                                                   
  306. K                 NEXT    Down    Next    N1~Next                                                                                                   
  307. K                 PREVIOUSUp      Prev    P1~Prev                                                                                                   
  308. K                 UPDATE  ->      Update  U1~Update                                                                                                 
  309. K                 INSERT  Ins     Insert  I1~Insert                                                                                                 
  310. K                 APPEND  =       Insert  I1~Append                                                                                                 
  311. K                 DELETE  Del     Delete  D1~Delete                                                                                                 
  312. K                 EXIT    F3      Exit    E1~Exit                                                                                                   
  313. K                 EXIT-   F2      Exit-   E1Ch~oose                                                                                                 
  314. K                 EXIT+   F4      QBE     E1~Query                                                                                                  
  315. 0                                                                                                                                                   
  316.