home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OPNOS2.ZIP
/
KLTESE.ARS
< prev
next >
Wrap
Text File
|
1993-02-23
|
47KB
|
316 lines
1Data Entry Main regular read/write
31ISQH read/writeyes
32SQH read/writeyes
4QBEtitleSelect query
4Commit Commit
4DelMsg Delete the record
4Exist Record exist
4Exit Quit
4OrdTitleOrder by
4Cursor Cursor
4QrErr SQL Communication problem
4First First record
4Last Last record
4NoRec No records
4NoCur No current record to delete/update
4WriteErrFile Access Error
5Order Order by Char Lf-T-Rgh 26 1 ;
5RecCunt RecCunt Long Positive 6 10;
5Date0 Date 0 Date American 10 101/01/0001;
5Zero zero Long Positive1 1 0;
5One One Long Positive1 1 1;
5Two two Long Positive 1 1 2;
5Title title Char Lf-T-Rgh20 1 SQL data entry;
5BLANK blank Char Lf-T-Rgh1 1 ; .
5Dummy dummy Char Lf-T-Rgh10 1 1; .
5Max Long Positive 10 132767;
5Record Long Positive 10 10;
5LastRec Long Positive 10 10;
5ConList ConList Char Lf-T-Rgh2 6 >=;<=;=;<>;>;<; .
5OpList OpList Char Lf-T-Rgh3 2AND;OR; .
5OK IntegerPositive 1 10;
5OKtitle Char Lf-T-Rgh 4 1O.K.;
5CANCEL IntegerPositive 1 10;
5CAtitle Char Lf-T-Rgh 8 1Esc=Quit;
5Long22 Long Positive 21 22;
5SqErr Long Positive 6 10;
5TempFileTempFile Char Lf-T-Rgh 8 1Dummy;
5SysDate SysDate Date American 10 100/00/0000;
5SysTime SysTime Time Time 8 100:00:00;
5Cursor Cursor Char Lf-T-Rgh 10 1;
6MAIN 2.000 6.632 76.167 1.316L_FRAME DARKGREEN 0Title Data 0.5 0.5 6 8
6QBE 11.333 -0.053 85.000 17.368L_FRAME DARKGREEN !QBEtitle Query 2 0.5 6 8
7MAIN 1Key1 0Dummy 57.667 0.158 7.500 1.000S_ARISTO CYAN BLUE KEY NONE
7QBE !Key1 0Dummy 1.667 12.737 10.000 1.000S_ARISTO CYAN BLUE QBEtitle NONE
7QBE !OrdTitle0Dummy 15.167 3.053 12.500 1.000S_ARISTO CYAN NEUTRAL QBEtitle NONE
7QBE 0Order 0OrdList 30.000 3.053 32.500 1.000S_LIST CYAN NEUTRAL QBE1 NONE
7QBE 0OK 0OKtitle 15.167 0.579 12.667 1.474S_BUTTON GREEN NEUTRAL QBE1 NONE
7QBE 0CANCEL 0CAtitle 30.000 0.579 13.167 1.474S_BUTTON RED NEUTRAL QBE1 NONE
8Select SELECT 2.*
8 FROM 2.
8f1_list
8 WHERE (
8q_where
8 )
8 ORDER BY 0.Order
8Insert INSERT INTO 2. VALUES (
8f_values
8 )
8Update UPDATE 2. SET
8d_values
8 WHERE (
8k_where
8 )
8Delete DELETE FROM 2. WHERE (
8k_where
8 )
8Close CLOSE
8SG_Srvr
8Commit COMMIT
8SG_Srvr
8RollbackROLLBACK
8SG_Srvr
9Main If Root
9 New-Scr 0Title
9 Setoff Z5
9 Seton M0
9 EndIf
9 Setoff Q5
9 Setoff O5
9##########The Z5 flag indicates changes in database.
9##########In the case of a linked task, M0 is used to indicate that the task is the root task.
9##########The O5 flag indicates that there is an open Select Query.
9##########The Q5 flag is the "NotQuit" loop flag.
9 Perform Clear
9Loop While NotQuit
9 Edit #MAIN 0Zero Z1
9 Clr-Lin#MAIN
9LoopEnd EndBlck
9 Perform Close
9 Perform IfChange
9 Return
9##########The following Insert routine is executed when the INSERT or APPEND Edit operation is
9##########selected.
9Insert
9 Setoff I1
9 Perform First
9##########The "First" routine is used here to initiate fields and clear them of previous values.
9 Perform Disp*
9Ins1 Perform AccKey
9##########The key fields data are entered by the user in the "AccKey" routine. If the user aborts the data
9##########entry, the flag A1 is set to ON and the Insert routine is aborted, returning the ON status of the
9##########I1 flag to the Edit command.
9 A1 Seton I1 InsEnd
9 Perform AccData
9##########The data fields data are entered by the user in the "AccData" routine. If the user aborts the
9##########data entry, the flag A2 is set to ON and the flow is diverted to the "Ins1" label.
9 A2 Goto Ins1
9 Move +100 0SqErr
9 Ex-Sql ?Insert 0SqErr Q1
9 If NoErr
9 Seton Z5
9 Add 0Record +1 1RECORD
9 Write 1 I0
9 Perform I/O_ok
9 If I/O_ok
9 Move 1RECORD 0Record
9 Else
9 Seton I1
9 EndIf
9 Else
9 Seton I1
9 EndIf
9InsEnd Return
9########## ----- Insert routine end ---------
9##########The following Update routine is executed when the UPDATE edit operation is selected.
9Update
9 Setoff U1
9 Find 1RECORD I0
9 Perform I/O_ok
9 Perform Disp*
9##########The "Disp*" routine is executed after the record is found to display the field values.
9 Perform AccData
9 A2 Seton U1 UpdEnd
9 Move +100 0SqErr
9 Ex-Sql ?Update 0SqErr Q1
9 If NoErr
9 Seton Z5
9 Rewrite1 I0
9 Perform I/O_ok
9 EndIf
9UpdEnd Return
9########## ----- Update routine end ---------
9##########The following Delete routine is executed when the Delete Edit operation is selected.
9Delete
9 Setoff D1
9 Find 1RECORD I0
9 Perform I/O_ok
9 Message!DelMsg +2 +1 D1
9##########The record is deleted after a presentation of warning message.
9 If Delete
9 Move +100 0SqErr
9 Ex-Sql ?Delete 0SqErr Q1
9 If NoErr
9 Delete 1 I0
9 Perform I/O_ok
9 EndIf
9 EndIf
9DelEnd Return
9########## ----- Delete routine end ---------
9##########The Display routine is called by the Edit command. There is no Display command in this
9##########routine, because the display is initiated automaticly by the Edit command.
9Display Find 1RECORD I0
9 Perform I/O_ok
9 Return
9########## ----- Display routine end ---------
9##########The First routine is executed when the Edit command needs to intiate the field values.
9FirstRut Move +0 1RECORD
9 Perform First
9 Return
9First Moves 0BLANK 1Key1
9 Setoff F1
9 Return
9########## ----- First routine end ---------
9##########The Last routine is executed when the Edit command needs to maximize the field values.
9Last-1 Move 0Max 1RECORD
9 Setoff L1
9 Return
9########## ----- Last routine end ---------
9##########The Next routine is executed when the Edit command needs to read the next record, either for
9##########internal use or as a result of user selection.
9Next Setoff N1
9 Read 1RECORD I0
9 Perform I/O_ok
9 I0 Seton N1
9 If Fetch1
9 Perform Fetch1
9 I0=Setoff N1
9 EndIf
9 Return
9########## ----- Next routine end ---------
9##########The Prev routine is executed when the Edit command needs to read the previous record,
9##########either for internal use or as a result of user selection.
9Prev Setoff P1
9 Prev 1RECORD I0
9 Perform I/O_ok
9 I0 Seton P1
9 Return
9########## ----- Prev routine end ---------
9##########The QBE routine is executed when the query option is selected.
9##########It is an Exit+ routine; when it is finished the Edit command ends.
9##########Since the Q5 flag is left off, the main loop will continue and the Edit command will start again.
9QBE Put-Lin#QBE 0Zero
9 Setoff E1
9 Perform Clear
9 Perform First
9 Display#QBE
9AccQbe Accept *QBE1 Q2
9 Clr-Lin#QBE
9 If ExcQbe
9##########After a query is typed by the user, a Select Query is executed, followed by a fetching loop.
9 Perform Close
9 Get-Dat0SysDate 0SysTime
9 Encode 0SysTime 0Cursor
9 Move +100 0SqErr
9 Ex-Sql ?Select 0Cursor 0SqErr Q1
9 If NoErr
9 Seton O5
9 Move +0 0Record
9 Perform 10Fetch
9 EndIf
9 EndIf
9 Return
910Fetch Add 0Record +10 0RecCunt
9 Until 10Fetch
9 Perform Fetch1
9 Q1 QtLoop
9 EndBlck
9 Return
9Fetch1
9 Move +0 0SqErr
9 Fetch ?Select 0Cursor 0SqErr Q1
9 Q1-Message!QrErr +1 +1
9 If NoErr
9 Add 0Record +1 1RECORD
9Move2t1 Moves 2Key1 1Key1
9 Write 1 I0
9 Perform I/O_ok
9 I0=Move 1RECORD 0Record
9 EndIf
9 Return
9##########The Exit routine is executed when the Edit operation Exit is selected.
9##########The Exit operation ends Edit command execution.
9Exit Message!Exit +2 +1 E1
9 E1=Seton Q5
9 Return
9##########The Exit- routine is executed when the Edit operation Exit- is selected.
9##########The Exit- operation ends Edit command execution and sets the Edit flag to "-".
9Exit- Message!Exit +2 +1 E1
9 E1=Seton Q5
9 Find 1RECORD I0
9 Perform I/O_ok
9 Return
9##########The following routine results in an I/O error message.
9I/O_ok
9 I0-Message!WriteErr+1 +1
9 I0-Seton I1
9 I0-Seton U1
9 I0-Seton D1
9 I0-Seton L1
9 I0-Seton N1
9 I0-Seton P1
9 Return
9##########All user data are entered in the Key fields here.
9AccKey Accept *KEY A1
9 Return
9##########All user data are entered in the Data fields here.
9AccData Accept *DATA A2
9 Return
9Disp* Display*KEY
9 Display*DATA
9 Return
9Close Move +100 0SqErr
9 If Close
9 Ex-Sql ?Close 0Cursor 0SqErr Q1
9 Setoff O5
9 EndIf
9 Return
9IfChange If Changed
9 Move +100 0SqErr
9 Message!Commit 0Two +1 M1
9 M1=Ex-Sql ?Commit 0SqErr Q1
9 M1 Ex-Sql ?Rollback 0SqErr Q1
9 EndIf
9 Return
9Clear Reopen 1 0TempFile
9 Move +0 0Record
9 Move +0 1RECORD
9 Return
BNotQuit ^Q5 ^= ^=
BExcQbe ^Q2 ^= ^= And
B 0CANCEL +0 +0
BClose ^O5 ^+ ^+
BFetch1 ^N1 ^+ ^+ And
B ^O5 ^+ ^+
BRoot ^Z0 ^= ^=
BChanged ^M0 ^+ ^+ And
B ^Z5 ^+ ^+
BNoErr ^Q1 ^= ^=
BI/O_ok ^I0 ^= ^=
B10Fetch 1RECORD 0RecCunt 0RecCunt
BDelete ^D1 ^= ^=
CMAIN 1 1 100.00015.65 DARKGRAY 0Title 0Title
KMAIN 1RECORD DISPLAY Space Display A1Displa~y
K FIRST Home FirstRutF1~First
K LAST End Last-1 L1~Last
K NEXT Down Next N1~Next
K PREVIOUSUp Prev P1~Prev
K UPDATE -> Update U1~Update
K INSERT Ins Insert I1~Insert
K APPEND = Insert I1~Append
K DELETE Del Delete D1~Delete
K EXIT F3 Exit E1~Exit
K EXIT- F2 Exit- E1Ch~oose
K EXIT+ F4 QBE E1~Query
0