# Paragraphs

Updated: 10/23/2020, 1:48:27 PM
Created: 10/23/2020, 1:48:27 PM
Last Updated By: Mike Street
Read Time: 4 minute(s)

# Description

Paragraphs are stored procedures in that their contents can contain a sequence of commands. They are typically stored in the file defined by the JEDIFILENAME_MD environment variable (i.e. MD or VOC) and run directly from the jshmode of the jShell:

jsh ~ -->paragraph_name
1

Paragraphs can also be stored and run from any file via the para command:

para {filename} paragraph_name
1

In this case, it is not necessary for the paragraph to be envoked from the jShell. If the optional filename is omitted then it is assumed that the paragraph is stored in the MD/VOC.

A logon paragraph record can also be invoked by the jShell via the dash option:

jsh -
1

# Format

The first line of a paragraph record begins with PA e.g. PARAGRAPHX

001 PA
1

This line can then be followed by any of the following :

# Comment lines

Any Line preceded by an asterisk. e.g:

* This is a comment line
1

# Label

Any non-spaced text suffixed by a colon. e.g.:

Label:
1

# Paragraph Prompt

A paragraph prompt to obtain values, e.g.:

<<I2,Second,1N>>
1

Load parameter two from the command line into PromptId Second. If parameter two on the command line is null then prompt for value for Second ensure validates to 1 numeric. The paragraph prompt is formatted as follows:

<<{Code,}PromptId{,Mask}>>
1

where:

  • code may be:
Code Meaning
A Always Prompt.
Cn Use parameter n from command line. If value does not exist then null is used.
In Use parameter n from command line. If value does not exist then prompt.
Sn Use parameter n from original command line. If value does not exist then prompt.
P Use input for all PromptIds of the same name. This is the default action.
R{s}Prompt use s as separator, until null input. Default separator is space.
F(File, RecordId {,Attr {,Value {,Subvalue}}}) Input from record RecordId, in file File.
@(c,r) Prompt at column c, row r.
@(BELL) Sound BELL at prompt.
@(CLR) Clear screen before prompt.
@(TOF) Prompt at top left of screen.
  • PromptId   Identifier used to name prompt values.
  • Mask  Validate Input
  • Pattern Match e.g.
    • 0N - Match any numerics
    • 7X - Match seven printable characters.
    • 3A - Match three alpha characters.
    • text - Match text
  • (Conversion) e.g.
    • (D2/) - Match date dd/mm/yy or mm/dd/yy.

~~Mask meansinput should NOT match mask.

# Note

A Paragraph prompt not mixed with a command line or paragraph statement will attempt to execute the resultant value.

# Paragraph Statement

One of the following syntax statements.

Statement Result
DISPLAY text Output text
DATA Input Stacked input
GO  Label Continue at Label
LOOP Start Loop
REPEAT Repeat Loop
CLEARPROMPTS Clear Prompt Identifier Values

IF Expression THEN Statement

where: Expression - Includes PromptId, operators and/or @variables

@DATE Current internal date
@TIME Current internal time
@DAY Current two digit day of month
@MONTH Current two digit month of year
@YEAR Current two digit year
@LOGNAME Environment PLID value
@USERNO Current port number
@WHO Current user name
@ABORT .CODE Last error code
@SYSTEM.RETURN .CODE Last error code
@USER.RETURN .CODE TBD

Operators include MATCHES, EQ, LE, LT, etc.

Command:
Any executable command with or without paragraph prompts. e.g:

SSELECT <<I2,FILEX,10X>>
1

or

SELECT  FILEX
1

# Examples

PARAGRAPHX

001 PA
002 IF <<C3,THIRD>> EQ THEN GO  CHK.SECOND
003 DISPLAY GOT 3 ARGUMENTS
004 GO END
004 CHK.SECOND:
005 IF <<C2,SECOND>> EQ THEN GO END
006 DISPLAY GOT 2 ARGUMENTS
007 END:
1
2
3
4
5
6
7
8

PARAGRAPHX

001 PA
002 * This is an example paragraph
003 IF <<C2,COMMAND>> NE "" THEN GO DO.CMD
004 DISPLAY ENTER
005 CLEARPROMPTS
006 DO.CMD:
007 DISPLAY ENTER
1
2
3
4
5
6
7

Back to jCL.