| Previous | Contents | Index |
Use the BUILD command to build a program in the SP4GL Console Window. Any build errors will be listed when you perform the BUILD command.
The BUILD command used in the console window defaults to the SheerPower folder. When building a program that is not stored inside the SheerPower folder, the path (location) of the program must be specified. See the following example:
| Example 2-10 BUILD command in SP4GL Console Window with file specification |
|---|
build 'c:\windows\desktop\sample_program.spsrc'
Building c:\windows\desktop\sample_program.spsrc ...
Lines compiled: 11 (33000/min), code: 1KB
|
RUN ['file_spec']
|
The following example assumes that you have a SheerPower program file called 'sample_program.spsrc' in your main SheerPower folder. This sample program was created in a previous section. See Section 2.2, Creating a Sample Program. |
To perform this example, open sample_program.spsrc inside SheerPower Rapid Development Environment. Click once on the Run icon in the toolbar to run the program. A menu will appear on your screen with three choices. Choose 'Exit', and the console window will appear.
Inside the console window, type 'RUN', and press [Enter]. The RUN command will cause the program to execute again, and the resulting menu created will appear.
| Example 2-11 RUN command |
|---|
run c:\sheerpower\sample_program.spsrc 14-Jul-2001 15:30 |
The RUN command is used to execute a program after it has been written inside SPDEV. This way you can remain inside the SP4GL Console Window and run your program after you experiment with elements of your program.
The RUN command can be used:
The RUN command executes programs. RUN with no file specification runs the current program.
When SheerPower executes the RUN command, SheerPower displays a header with the program name, current date and time. SheerPower then executes the program.
A file specification can be given with the RUN command. If a file specification is provided, SheerPower searches for the file, loads it, and then runs it. If no file type is given, SheerPower will use the default file type .SPSRC.
| Example 2-12 RUN command with file specification |
|---|
run 'sample_program' c:\sheerpower\sample_program.spsrc 14-Jul-2001 15:30 |
Choose 'Exit' from the menu to complete running the program, then close the SP4GL Console Window.
If you are running a program that is not stored inside the SheerPower folder, you must specify the path (location) of the program.
LIST [routine_name, routine_name, ...]
|
To perform the following example, open the console window by clicking once on the SP4GL Console Window icon in SPDEV. Use the BUILD command to build the sample program (sample_program.spsrc). Then use the LIST command to display all the lines in the program.
| Example 2-13 Listing program lines |
|---|
build 'sample_program.spsrc'
Building c:\sheerpower\sample_program.spsrc ...
Lines compiled: 11 (33000/min), code: 1KB
list
c:\sheerpower\sample_program.spsrc 06-Jul-2001 16:29
do
line input menu '"Calculator" = calc,"DOS Prompt" = dos,"EXIT"': ans$
if _exit then exit do
select case ans$
case 'CALC'
pass nowait: 'calc'
case 'DOS'
pass nowait: '$$'
end select
loop
|
Use the LIST command to display all or part of your program source code.
LIST displays lines from the current program. The listing includes a header with the program name, current date and time. LIST by itself lists the entire program, including routine headers and comment lines.
Specific sections of a program can be listed by referencing the program's routines. You can also list combinations of routines. For example:
| list do_input | lists the lines of code under the routine "do_input" |
| list date_routine | lists the lines in the "date_routine" routine |
| list do_input, date_routine | lists the lines from both routines |
If a routine is specified which does not exist, nothing is listed.
You can use the LIST command:
HALT
|
Open SPDEV by clicking on the SPDEV shortcut icon on your desktop.
Open the sample program file sample_program.spsrc
inside SPDEV by clicking on the Open icon inside the
SPDEV toolbar.
Insert the HALT statement into the sample_program.spsrc source code as shown below.
Then run the program by clicking once on the Run icon
in SPDEV.
| Example 2-14 HALT statement |
|---|
do
line input menu '"Calculator" = calc,"DOS Prompt" = dos,"EXIT"': ans$
halt //<--- insert HALT statement here
if _exit then exit do
select case ans$
case 'CALC'
pass nowait: 'calc'
case 'DOS'
pass nowait: '$$'
end select
loop
|
Choose 'Calculator' from the menu. The following will appear inside the SP4GL Console Window:
Halt at MAIN.0003 -- Call Stack Depth: 0 MAIN.0003 halt -- Recently Called Routines -- |
Keep the SP4GL Console Window open to continue with the next HALT statement example.
HALT is used to interrupt program execution, check values, and then continue execution.
The HALT statement must be inserted inside the source code before running the program. The HALT statement works the same way as the BREAK statement except that it always interrupts program execution. The BREAK statement will only interrupt program execution while DEBUG is ON. For a detailed explanation of the BREAK statement, please see Section 2.5.7, BREAK Statement.
HALT interrupts program execution, but it does not close any files, nor does it write the active output buffer. Once halted, the user can then check values, enter debug commands or any SheerPower statements and expressions. Execution can be continued with the GO command.
You can continue to run the sample program in the console window as follows:
Halt at MAIN.0003 -- Call Stack Depth: 0 MAIN.0003 halt -- Recently Called Routines -- print ans$ <--- type this line in and press [Enter] CALC go<--- type in 'GO' and press [Enter] |
The calculator program will appear when your program resumes execution. To exit the program, choose 'Exit' in the menu, then close the console window.
|
|
SHOW FILES
|
To perform the following example, open the console window by clicking once on the SP4GL Console Window icon in SPDEV. Have the HALT statement inside the program. The show files command is generally used after a HALT statement halts a program's execution.
line input menu '"Calculator" = calc,"DOS Prompt" = dos,"EXIT"': ans$
halt
if _exit then exit do
select case ans$
case 'CALC'
pass nowait: 'calc'
case 'DOS'
pass nowait: '$$'
end select
loop
|
Use the BUILD command to build the sample program (sample_program.spsrc). Then use the RUN command to run the program.
| Example 2-15 Show files after using the HALT command |
|---|
build 'sample_program.spsrc'
Building c:\sheerpower\sample_program.spsrc ...
Lines compiled: 11 (33000/min), code: 1KB
run
|
Use the SHOW FILES command after a program halts to display a list of all open files and their status.
SHOW FILES displays a list of all open files and their status. If the files are ARS files (tables) then it some information will be displayed about their key structure, and recordsize, etc.
| Previous | Next | Contents | Index |