Sharp OZ-707 Operation Manual - Page 36

Program 3, Adding Data to a Sequential File, Program Execution

Page 36 highlights

Program 3 - Adding Data to a Sequential File 110: DIM AD$(O} 120: OPEN "E:FOLKS" FOR APPEND AS #22 130: REM ADD NEW ENTRIES TO FILE 140: CLS 116500~· INPUT "NAME?";NA$ IF NA$ = "00" THEN 230: REM 00 EXITS INPUT LOOP 170: INPUT "ADDRESS?";AD$(O} 180: INPUT "BIRTHDAY?";BI$ 190: PRINT #22,NA$ 200: PRINT #22,AD$(0} 210: PRINT #22,BI$ 220: GOTO 140 230: CLOSE #22 Input 00 in answer to the question NAME? in line 150 to cause the program to jump out of the input loop in line 160. The REM statement can be used to write programming notes to yourself. This brief introduction to programming should serve to illustrate the exciting programming possibilities of your new Card. Program Execution More than one program can be stored in this Card if the memory capacity is not exceeded. Execute the second or subsequent program using one of the following: 1. the RUN command: RUN line number 1ENTER I 2. the GOTO command: GOTO line number 1ENTER 1 Execution begins from the specified line number. If a label such as *AB is entered in the program, the program can be executed by entering RUN*AB 1ENTER I. The following lists the differences between the variables and status when a program is executed using the GOTO and RUN commands. Execution using RUN Execution using GOTO • Clears the WAIT setting. • Clears the USING format. • Clears array and simple variables. • Clears double-precision operation mode and variable specifications. • Initializes the DATA statement for the READ statement. • Clears the PRINT=LPRINT setting. • Closes all the files • Clears the position set by LOCATE or GCURSOR. • Clears the error trap function. • Clears ERN and ERL variables. • Retains the WAIT setting. • Retains the USING format. • Retains array and simple variables. • Retains double-precision operation mode and variable specifications. • Does not initialize the DATA statement for the READ statement. • Retains the PRINT=LPRINT setting. • Does not close all the files. • Retains the position set by LOCATE or GCURSOR. • Retains the error trap function. • Retains ERN and ERL variables. Note: When the program is executed using the RUN command, the variables for data are cleared. (Fixed variables are retained.) To retain the data, execute using the GOTO command. 60 61

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

Program 3 -
Adding Data to a Sequential File
110: DIM
AD$(O}
120: OPEN "E:FOLKS" FOR APPEND
AS
#22
130: REM ADD NEW ENTRIES TO FILE
140: CLS
150· INPUT "NAME?";NA$
160~
IF
NA$
=
"00" THEN 230: REM 00 EXITS INPUT LOOP
170: INPUT "ADDRESS?";AD$(O}
180: INPUT "BIRTHDAY?";BI$
190: PRINT #22,NA$
200: PRINT #22,AD$(0}
210: PRINT #22,BI$
220: GOTO 140
230: CLOSE #22
Input
00
in
answer to the question NAME? in line 150 to cause the
program to jump out of the input loop in line 160. The REM statement
can
be
used to write programming notes to yourself.
This brief introduction to programming should serve to illustrate the
exciting programming possibilities of your new Card.
60
Program Execution
More than one program can be stored
in
this Card if the memory
capacity is not exceeded. Execute the second or subsequent program
using one of the following:
1.
the RUN command: RUN line number
1
ENTER
I
2.
the GOTO command: GOTO line number
1
ENTER
1
Execution begins from the specified line number.
If
a label such as
*AB
is entered
in
the program, the program can be executed by
entering RUN*AB
1
ENTER
I.
The following lists the differences between the variables and status
when a program
is
executed using the GOTO and
RUN
commands.
Execution using RUN
Execution using GOTO
• Clears the WAIT setting.
• Retains the WAIT setting.
• Clears the USING format.
• Retains the USING format.
• Clears array and simple variables.
• Retains array and simple
variables.
• Clears double-precision operation
• Retains double-precision
mode and variable specifications.
operation mode and variable
specifications.
• Initializes the DATA statement for
• Does not initialize the DATA
the READ statement.
statement for the READ statement.
• Clears the PRINT=LPRINT setting.
• Retains the PRINT=LPRINT
setting.
• Closes all the files
• Does not close
all
the files.
• Clears the position set by
• Retains the position set by
LOCATE or GCURSOR.
LOCATE or GCURSOR.
• Clears the error trap function.
• Retains the error trap function.
• Clears ERN and ERL variables.
• Retains ERN and ERL variables.
Note:
When the program
is
executed using the RUN command, the variables
for data are cleared. (Fixed variables are retained.) To retain the data,
execute using the GOTO command.
61