"Statement Not in a Subprogram Block"; Order SUBs Last (32790)






This article was previously published under Q32790

SUMMARY

The compile-time error message "Statement not in a subprogram block" occurs in QuickBASIC for the Macintosh when compiling a program in which main-level code occurs after a subprogram (SUB...END SUB) definition. The Macintosh BASIC interpreter allows subprogram (SUB...END SUB) blocks to be interspersed within main level code; however, in compiled programs, all subprogram declarations must come after the main program.

To move the subprograms to the end of the program, you may do either of the following:

  1. Cut and paste in the QuickBASIC editor.
  2. Run "SortSub" (provided on the Macintosh QuickBASIC release disk) or the compiled version "SortSub apl". Note that "SortSub" can only sort programs that are saved as text. "SortSub" renames the original program (by giving it an extension) and gives the sorted program the original program name.

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB32790