AccessMyLibrary provides FREE access to millions of articles from top publications available through your library.

Streamlining with subroutines, part 1. (Tutorial)

Lotus

| June 01, 1992 | Cranford, Richard | COPYRIGHT 1987 Lotus Publishing Corp. (Hide copyright information)Copyright

Cut development time and create compact, well-organized macro code.

Knowing how to fully exploit the subroutine facility in 1-2-3's macro language may be your most important tool for building efficient, elegant macros. Subroutines let you avoid writing the same code more than once. More important, they let you avoid "spaghetti code," the bewildering labyrinth that occurs when a program branches here, there, and somewhere else if a condition is met.

A subroutine is a segment of code that a program jumps to temporarily, after which it jumps back to the calling routine and proceeds to the next instruction. Subroutines drastically cut the size of a macro that repeatedly performs the same task or nearly the same task.

Unlike other languages you may have worked with, 1-2-3's macro language does not include a verb, such as GOSUB or CALL, that invokes a subroutine. Instead, you include a subroutine call in a macro by enclosing the name of the subroutine in braces. For example, to call a subroutine whose first cell is named setup, include the instruction {setup} in the macro. In this way, a subroutine call resembles a macro command, such as {PANELOFF}. You may include parameters in the braces along with the subroutine call. This results in an instruction that resembles a command with arguments, such as {GETLABEL prompt, target_cell}.

Though all subroutine calls work the same way, I've found it useful to think of them in terms of what you want them to do. …

Related articles from newspapers, magazines, journals, and more
Create your own macro commands: Symphony macros. (obvious macro code patterns...
Magazine article from: Lotus Gasteiger, Daniel September 1, 1988 700+ words
Streamlining with subroutines, part 2. (designing macro subroutines)...
Magazine article from: Lotus Cranford, Richard July 1, 1992 700+ words
A beginner's macro subroutine library. (personal library of 1-2-3 Release 2...
Magazine article from: Lotus Fine, Edmund S. Sharon, Phyllis A. March 1, 1988 700+ words
When to avoid the (BRANCH) command: replace branches with calls to make your...
Magazine article from: Lotus Delonas, Nick December 1, 1989 700+ words
TTL-to-CMOS: AI takes out the kinks. (artificial intelligence for circuit...
Magazine article from: ESD: The Electronic System Design Magazine Kirk, Robert June 1, 1988 700+ words
©2013 Gale, a part of Cengage Learning. All rights reserved. Contact us | Privacy policy | Terms and conditions

The AccessMyLibrary advertising network includes: womensforum.com GlamFamily