paragraph.introduction Definition/TCL

paragraph.introduction

Command paragraph.introduction Definition/TCL
Applicable release versions: AP 6.1
Category TCL (746)
Description a macro language allowing execution of TCL statements, looping structures, data stacking, screen input/output, and branching.

A paragraph is an item stored in the current MD whose attribute 1 contains the word "PARAGRAPH". For compatibility with other vendors, "PA" and "T" are also accepted as paragraph indicators.

In its simplest incarnation, a paragraph is a list of TCL statements similar to a standard macro. However, paragraphs also allow other features which make it much more powerful.

LOOPING

Paragraphs allow simple loops by starting a block of commands with the "loop" command and ending that block with the "repeat" repeat. Note that such a loop will continue indefinitely unless terminated by a branch structure shown below.

DATA STACKING

As in MACRO, paragraphs can stack data by adding a second value after a command. Also, a seperate line can appear with the syntax "data {data to stack}". This works in a similar fashion to the BASIC "data" statement.

SCREEN INPUT/OUTPUT

It is possible to solicit input and display output in a paragraph. To do simple output, use the "display" statement with a string argument. To do simple input, embed the desired prompt within double greater than and less than signs. For example, the line "display <<Enter name>>" will prompt "Enter name>" and then print the name. To see the more complex versions of input, see the "<<" token.

PARAMETER MANIPULATION

Unlike standard macros, the parameters to the original TCL command line executing a paragraph are NOT directly passed to the first command. Instead, they are placed in a buffer for the paragraph programmer to access individually. To access the first parameter (word) in the original line (which is generally the name of the paragraph), use "<<c1>>". To access the second paramter, use "<<c2>>". To see more complex means of accessing parameters, see the "<<" token.

BRANCHING

For conditional branching, the IF-THEN-GO construct is used. Its syntax is "if [constant|<<input prompt>>] [conditional] [constant|<<input prompt>>] then go label." The conditional may be ">" or "g" for greater than, "<" or "l" for less than, "n" or "#" for not equal, or "=" or "e" for equal. The label at the end should be an alphanumeric label which appears elsewhere in the paragraph.

LABELS

Labels are used as the target of IF-THEN-GO statements and consist of an alphanumeric label name followed by a colon followed by AT LEAST ONE SPACE. Other paragraph commands may follow on the same line.

COMMENTS

Any line beginning with an asterisk is assumed to be a comment.

LINE CONTINUATION

Any line ending with the underscore character will be merged with the succeding line when processed by the paragraph processor. Note that leading spaces on the next line will be truncated.
Syntax
Options
Example
paragraph
* List a default file if not specified
if <<c2>> = "" then go default
list <<c2>> (<<Input options>>
if 1 = 1 then go done
default: list bp (<<Input options>>
done: * Done with paragraph

 This paragraph will list the default file of BP if no file is specified.  When 
listing the file, it will first prompt for the options.
Purpose
Related macros
paragraph.loop
paragraph.repeat
paragraph.data
tcl.display
paragraph.<<
paragraph.if
paragraph.*
paragraph._