Listing Program Contents; Branches; The Goto Statement - IBM 5110 Basic Introduction

Table of Contents

Advertisement

52
LISTING PROGRAM CONTENTS
Because the dentbill program is currently in the system work area, we
can now list the statements of the program on the display screen with
the LIST system command. Enter LIST, then press EXECUTE. The
statements of the dentbill program now appear on the display screen.
The LIST command causes the first 14 lines of the program to be
displayed. You can then use the scroll up key to view additional lines
of the program.
It isn't necessary to list the entire program each time you want to see
a particular part of it. You can list any 14-line portion of the program
by entering the last line number you want displayed after the
command keyword LIST. For example, LIST 30 would display
statement numbers 10, 20, and 30 of the dentbill program, with
statement 30 on line 1.
BRANCHES
The system normally executes programs line by line according to the
line numbers of the statements. However, you can vary this sequential
order and transfer control to a line number other than the next
sequential one. This is called branching. Two of the statements you
can use for branching are the GOTO and IF statements.
The GOTO Statement
This statement tells the system to go to a specific line number. A
GOTO statement at line 20 of a program that tells the system to go to
line number 60 would look like this:
0020 GOTO 60
o
()
52
LISTING PROGRAM CONTENTS
Because the dentbill program is currently in the system work area, we
can now list the statements of the program on the display screen with
the LIST system command. Enter LIST, then press EXECUTE. The
statements of the dentbill program now appear on the display screen.
The LIST command causes the first 14 lines of the program to be
displayed. You can then use the scroll up key to view additional lines
of the program.
It isn't necessary to list the entire program each time you want to see
a particular part of it. You can list any 14-line portion of the program
by entering the last line number you want displayed after the
command keyword LIST. For example, LIST 30 would display
statement numbers 10, 20, and 30 of the dentbill program, with
statement 30 on line 1.
BRANCHES
The system normally executes programs line by line according to the
line numbers of the statements. However, you can vary this sequential
order and transfer control to a line number other than the next
sequential one. This is called branching. Two of the statements you
can use for branching are the GOTO and IF statements.
The GOTO Statement
This statement tells the system to go to a specific line number. A
GOTO statement at line 20 of a program that tells the system to go to
line number 60 would look like this:
0020 GOTO 60
o
()

Advertisement

Table of Contents
loading

Table of Contents