home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OPNOS2.ZIP
/
KLTLIE.ARS
< prev
next >
Wrap
Text File
|
1993-02-22
|
40KB
|
251 lines
1Data Entry Main regular read/write
31SG read/writeyes
4DelMsg Delete the record
4Exist Record exist
4Exit Quit
4First First record
4Last Last record
4NoCur No current record to delete/update
4WriteErrFile Access Error
5Date0 Date 0 Date American 10 100/00/0000;
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 Data entry;
5BLANK blank Char Lf-T-Rgh1 1 ; .
5Dummy dummy Char Lf-T-Rgh10 1 1; .
5MaxReal MaxReal Float 1 10 19999999999;
5MaxLong MaxLong Long Positive 10 12147480000;
5MaxInt MaxInt IntegerPositive 5 132767;
5MaxStr MaxStr Char Lf-T-Rgh 20 1zzzzzzzzzzzzzzzzzzzz;
5MaxDate MaxDate Date American 10 112/31/9999;
5MaxTime MaxTime Time Time 8 123:59:59;
5MaxByte MaxByte Byte Positive 4 1127;
5OK IntegerPositive 1 10;
5OKtitle Char Lf-T-Rgh 4 1O.K.;
5Cancel IntegerPositive 1 10;
5CancelT Char Lf-T-Rgh 8 1Esc=Quit;
5Next Char Lf-T-Rgh 4 1Next;
5First Char Lf-T-Rgh 4 1Top;
5Last Char Lf-T-Rgh 4 1Last;
5Prev Char Lf-T-Rgh 4 1Prev;
5Add Char Lf-T-Rgh 4 1Add;
5Upd Char Lf-T-Rgh 4 1Upd;
5Del Char Lf-T-Rgh 4 1Del;
5Locate Char Lf-T-Rgh 4 1Find;
5Quit Char Lf-T-Rgh 4 1Quit;
5Action Action Char Lf-T-Rgh 4 1Add;
5ActLst ActLst Char Lf-T-Rgh 4 9Add;Upd;Del;Next;Prev;Top;Last;Find;Quit;
5Menu Menu Char Lf-T-Rgh 20 1Menu;
5RepeatB Long Positive 1 10; 5RepeatT Char Lf-T-Rgh 7 1Repeat; 6Menu 0.667 -0.053 18.667 13.895L_FRAME PINK 0Menu DEFAULT_WINDOW Nobmp 1 1 12 6 6MAIN 19.333 3.000 74.000 10.895L_FRAME DARKGRAY 0Title DEFAULT_WINDOW Data 0.5 0.5 6 8 7MAIN 1Key1 0Dummy 57.167 5.737 7.500 1.000S_ARISTO BACKGROUND BLUE KEY NONE 7MAIN 0RepeatB 0RepeatT 2.000 2.000 20.000 1.000S_BUTTON GREEN RED Repeat NONE 7Menu 0Action 0ActLst 0.667 0.053 16.000 12.053S_RADIOV GREEN BLUE Action ON_TOP 10.895 9Main Z0=New-Scr 0Title
9 Setoff Q5
9 Put-Lin#MAIN 0Zero
9 Put-Lin#Menu 0Zero
9##########The following lines find and display the first record.
9 Perform First
9 Perform Next
9 Perform Display
9##########In the following loop the user is asked to select an action. This loop will continue as long as
9##########the Q5 flag is OFF.
9Loop
9 While NotQuit
9##########The following Accept command is executed to access the user selection.
9##########When a selection is made, the Dialog ends and a "Switch" begins to execute the selection.
9ActDlg
9 Dialog +0 9 Accept *Action Q5
9 Goto DlgEnd 9 Accept *Repeat Q5
9 Goto DlgEnd 9DlgEnd E-Dialg 9 Q5 Moves 0Quit 0Action
9##########The following switch contains cases for each selection made by the user.
9 Switch 0Action
9 Case 0First
9 Perform First
9 Perform Next
9 Perform Display
9 QtSwtch
9 Case 0Last
9 Perform Last
9 Perform Prev
9 Perform Display
9 QtSwtch
9 Case 0Next
9 Perform Next
9 Perform Display
9 QtSwtch
9 Case 0Prev
9 Perform Prev
9 Perform Display
9 QtSwtch
9 Case 0Add
9##########When Add is selected, an Add loop begins calling the Insert routine as long as the flag I1 is
9##########OFF. 9 Setoff I1
9 While AddLoop
9 Perform Insert
9 EndBlck
9 Perform FindCur
9 QtSwtch
9 Case 0Upd
9##########When Upd is selected, an Update loop begins calling the Update routine and reading the next
9##########record as long as there are records to read and the user does not abort the updating process.
9 Setoff U1
9 While UpdLoop
9 Perform Update
9 U1 QtLoop
9 Read 1KEY1 I0
9 Perform I/O_ok
9 I0 Seton U1
9 EndBlck
9 Perform FindCur
9 QtSwtch
9 Case 0Del
9 Perform Delete
9 QtSwtch
9 Case 0Locate
9 Perform Locate
9 QtSwtch
9 Case 0Quit
9 Seton Q5
9 QtSwtch
9 EndSwch
9 EndBlck
9LoopEnd
9########## -------- Main loop end -----------
9 Clr-Lin#MAIN
9 Clr-Lin#Menu
9 Return
9##########The following Insert routine is executed when the Add operation is 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
9##########data entry, the flag A1 is set to ON and the Insert routine is aborted.
9 A1 Seton I1 InsEnd
9 Find 1KEY1 I0
9 Perform I/O_ok
9##########A Find command is executed to an existing record with the entered key field value.
9 I0=Message!Exist +1 +1
9 I0=Goto Ins1
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 Write 1 I0
9 Perform I/O_ok
9##########"Write" is executed to write the record.
9InsEnd Return
9########## ----- Insert routine end ---------
9##########The following Update routine is executed when the Upd operation is selected.
9Update
9 Setoff U1
9 Find 1KEY1 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 Rewrite1 I0
9 Perform I/O_ok
9UpdEnd Return
9########## ----- Update routine end ---------
9##########The following Delete routine is executed when the Del operation is selected.
9Delete
9 Setoff D1
9 Find 1KEY1 I0
9 Perform I/O_ok
9 Perform Disp*
9 Message!DelMsg +2 +1 D1
9##########The record is deleted after presentation of a warning message.
9 If Delete
9 Delete 1 I0
9 Perform I/O_ok
9##########After execution of the Delete routine a record is located and displayed.
9 Perform FindCur
9 EndIf
9DelEnd Return
9########## ----- Delete routine end ---------
9##########The following Locate routine is executed when the Find operation is selected.
9Locate
9 Setoff L1
9 Perform First
9 Perform AccKey
9##########The searched key value is entered by the user in the "AccKey" routine.
9 Perform FindCur
9 If Locate
9 Seton L1
9 EndIf
9LocEnd Return
9########## ----- Locate routine end ---------
9##########The display routine is called by other routines.
9Display
9 Find 1KEY1 I0
9 Perform I/O_ok
9 Perform Disp* 9 Return
9########## ----- Display routine end ---------
9##########The first routine is executed when necessary to intiate the field values.
9First Moves 0BLANK 1Family
9 Setoff F1
9 Return
9########## ----- First routine end ---------
9##########The last routine is executed when necessary to maximize the field values.
9Last Moves 0MaxStr 1Family
9 Setoff L1
9 Return
9########## ----- Last routine end ---------
9##########The next routine is executed when necessary to read the next record.
9Next Setoff N1
9 Read 1KEY1 I0
9 Perform I/O_ok
9 I0 Seton N1
9 Return
9########## ----- Next routine end ---------
9##########Prev routine is performed when we need to read the previous record.
9Prev Setoff P1
9 Prev 1KEY1 I0
9 Perform I/O_ok
9 I0 Seton P1
9 Return
9########## ----- Prev routine end ---------
9##########The following routine is called from other routines in order to locate and display a record.
9FindCur
9 Find 1KEY1 I0
9 Perform I/O_ok
9 If Locate
9 Read 1KEY1 I0
9 Perform I/O_ok
9 EndIf
9 If Locate
9 Prev 1KEY1 I0
9 Perform I/O_ok
9 EndIf
9 If Locate
9 Perform First
9 EndIf
9 Perform Disp*
9 Return
9########## -------- Find Current record routine end -------
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########## ------ End I/O Case
9##########All user data are entered in the KEY fileds here.
9AccKey Accept *KEY A1
9 Return
9##########All user data are entered in the DATA fileds here.
9AccData Accept *DATA A2
9 Return
9Disp* Display*KEY
9 Display*DATA
9 Return
BDelete ^D1 ^= ^=
BLocate ^I0 ^+ ^+
BNotQuit ^Q5 ^= ^=
BAddLoop ^I1 ^= ^=
BUpdLoop ^U1 ^= ^=
0