TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

Easytrieve Program Syntax Rules


Syntax rules:

Statements have a free-form, English-like structure and a simple, consistent syntax that is easy to understand and remember. It is recommend to code Easytrieve programs in uppercase only. Lowercase keywords are not recognized by the compiler.


Statement Structure:

Each of your program statements (source statements) is a record of 80 characters. As each one is read, positions 73 through 80 are ignored. These positions are expected to contain optional information, such as statement sequence numbers, and program identifiers. Positions 1 through 72 are expected to contain Easytrieve statements. All 80 characters are printed on your listing, as illustrated in the next exhibit.

Easytrieve Statement Structure

A statement area can contain more than one statement or, in the case of continuations, a portion of a statement. In general, a statement begins with a keyword and is terminated by a period or the end of the statement area, whichever is first. This technique enables you to code more than one statement in a statement area, or to continue a statement that is too large for one statement area.

To enter multiple statements on one line, follow each statement with a period and a space. The next statement is considered to begin in the next available position after the space.

For example:

A = 7. Y = 5. Z = X

Words:

Statements are made up of one or more words. A word can be a keyword, a field name, or a literal. The basic word delimiter is the space. At least one space must follow all other delimiters except the left parenthesis.

Word DelimiterDescription
Space
(Left parenthesis
)Right parenthesis
'Apostrophe
.Period
,Comma
:Colon

Keywords:

Keywords are words with specific meanings to Easytrieve. Some keywords are reserved for the use of Easytrieve only; the nonreserved words can be used as data names in the appropriate context.


Field Names:

Field names are composed of a combination of not more than 40 characters chosen from the following.

  • Alphabetic characters, A through Z, lowercase and uppercase

  • Decimal digits 0 through 9

  • All special characters, except delimiters

Field Names Rules:

  1. First character of a field name must be an alphabetic character

  2. Field name must contain at least one alphabetic or special character to distinguish the field name from a number

  3. All working storage field names and all field names within a single file must be unique

  4. If you use the same field name in more than one file or working storage field, you must qualify the field name with the file name or the word WORK

A qualified field name consists of the qualifying word followed by a colon and the field name. You can use any number of spaces, or no spaces, to separate the colon from either the qualifying word or the field name.

  • Valid Field Names

    1. EMPLOYEE#

    2. TIME-OF-DAY

    3. TOTAL$DOLLARS-FOR-1988

  • Invalid Field Names :

    1. SOCIAL SECURITY NUMBER(Error - Embedded spaces)

    2. EMP'L-NO(Error - Apostrophe not allowed)

    3. $AMOUNT(Error - Must begin with a letter)


Literals:

Literals can be either alphabetic or numeric.

Alphabetic literals are enclosed within apostrophes and can be up to 254 characters long.

Numeric literals consist of the characters 0 through 9, and can be up to 18 digits long. They can be prefixed by a plus symbol (+) or a minus symbol (-) to indicate the algebraic sign of the number and can contain a single decimal point to indicate a maximum precision of up to 18 decimal positions. For example:

  • 1126
  • +112632
  • -11.2632

Comments:

If the first nonblank character of a statement is an asterisk (*), the remainder of that statement area is a comment. You can put comments in your program at any place, except between the portions of a continued statement.


Continuations:

A statement is terminated by a period or the last nonblank character in the statement area, unless that character is a hyphen (-) or a plus (+). The hyphen indicates that the statement continues with the first position in the next statement area (which can be a blank).

The plus symbol indicates that the statement continues with the first nonblank character in the next statement area (which could be in the first position); leading blanks are ignored.

Example:

LINE EMPLOYEE# NAME STREET CITY STATE ZIP TELEPHONE +
REGION DIVISION BRANCH GROSS NET DEDUCTIONS +
QUARTER YEAR-TO-DATE

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal