Getting Started

Tutorial and overview of program sections.
caet116
Easytrieve
is an information retrieval and data management system that is designed to simplify report programming. Its English-like language and simple declarative statements provide you with the tools to produce comprehensive reports and screens. If you are an experienced developer,
Easytrieve
provides you with the tools to perform complex programming tasks.
Easytrieve
operates in various mainframe, UNIX, Linux, and Windows environments.
Easytrieve
runs interactively for data inquiry, analysis, maintenance, and reporting. The output can be returned to your terminal or routed to a printer.
The articles in this section explain how to write
Easytrieve
programs. The Programming Lessons section is a tutorial for persons who are familiar with data processing concepts. Skills for other programming languages are not required. The tutorial does not describe all product features, and some of the described features may not be available in all implementations of the product. Because
Easytrieve
is a compiled language that runs in many data processing environments, the examples in this section are generic and do not address variations between different installations.
Program Examples
Most program examples in this section use the sample input file PERSNL that is included when the product is installed. You can use PERSNL when you run program examples. Report output in some examples has been edited or shortened for illustrative purposes. Actual reports that are produced using the PERSNL file can be much longer.
Suggested Reading
To get familiar with the product, we suggest that you read the sections listed under Level One, Level Two, and Level Three. Each level introduces more advanced concepts.
Level One
The level one articles explain how to:
  • Write a complete
    Easytrieve
    program, using automatic input and output features.
  • Generate standard reports and screens.
  • Perform calculations and use conditional expressions.
  • Be familiar with the system-defined fields that are provided with
    Easytrieve
    .
To begin learning about
Easytrieve
, we suggest that you read the following articles and sections:
  • Programming Lessons — Lessons 1 through 4
  • Library Section - Describe and Define Data
  • Describe Files and Fields — Defining Data through DEFINE Within an Activity
  • Job Activities — Job Statement through Parentheses in Calculations sections
  • Activity Section - Input and Output — Automatic Input and Output through Work File Processing
  • Activity Section - Reporting
  • Processing of Reports
Level Two
The level two articles explain how to:
  • Write slightly more complex
    Easytrieve
    reports, using programmer-controlled input and output commands.
  • Generate label reports.
  • Perform data assignments and moves and use loops and branching in program logic.
  • Perform basic debugging techniques.
After you read the level 1 articles, we suggest that you read the following articles and sections:
  • Describe Files and Fields — Defining Static Working Storage through Implicit Start-location
  • Job Activities — Assignment Statement through STOP Statement
  • Activity Section - Input and Output — User Controlled Input and Output through PUT Statement
  • Label Report and Testing Aid Parameters
Level Three
The level three articles explain how to:
  • Use advanced FILE statement parameters, including VIRTUAL and EXIT.
  • Perform sorts.
  • Use procedures and tables.
  • Perform programmer-controlled input and output of randomly accessed files, including VSAM.
  • Use REPORT procedures.
After you read the level 2 articles, we suggest that you read the following articles and sections:
  • Describe Files and Fields — FILE Statement Revisited through COPY Statement
  • Job Activities — User Procedure (PROCS) section
  • SORT Activities
  • PROGRAM Activities
  • Activity Section - Input and Output — POINT Statement through WRITE Format 2
  • Format Determination Parameters
  • Multiple Reports
  • Report Procedures (PROCs)
Program Structure
Each
Easytrieve
program can contain an environment section, a library definition section, and one or more activity sections. The environment and library definition sections are optional, but at least one activity section is required.
easytrieve_program
easytrieve_program
Environment Section
The environment section establishes parameters for the program. This section lets you override standard
Easytrieve
options and select a mode of operation. The environment section is not required for most of the examples in this section. For more information about the environment section, see PARM Statement in Language Reference.
Library Definition Section
The library definition section describes the data the program processes, data files and their associated fields, and any working storage requirements of the program. The library definition section is usually required; it is optional when the program does not perform any file input or output.
Activity Section
The activity section is the only mandatory section of an
Easytrieve
program. The activity types are PROGRAM, SCREEN, JOB, and SORT.
  • PROGRAM
    A simple top-down sequence of instructions. You can use a PROGRAM activity to conditionally execute the other types of activities, using the EXECUTE statement.
  • JOB
    Reads information from files, examine and manipulate data, write information to files, and initiate printed reports.
  • SORT
    Creates sequenced or ordered files.
  • SCREEN
    Defines a screen-oriented transaction. Data can be displayed to a terminal operator and received back into the program. Files can be read and updated. A SCREEN activity can EXECUTE a JOB or SORT activity to perform a special process, such as printing a report.
    Screen processing activities are available only in
    Easytrieve
    Online.
You can code one or more procedures (PROCs) at the end of each activity. Procedures are separate modules of program code that you use to perform specific tasks. See Activity Section - Processing and Logic for more information about procedures.
REPORT subactivities are areas in a JOB activity where reports are described. You can code one or more REPORT subactivities after the PROCs (if any) at the end of each JOB activity. Code any PROCs used within a REPORT subactivity (REPORT PROCs) immediately after the REPORT subactivity in which you use them.
The following table shows some
Easytrieve
keywords and other items in the sections where they are usually located. The table gives the general order of
Easytrieve
statements in a program.
Section
Items
Environment Section
PARM ...
Library Section
FILE ...
DEFINE ...
...
Activity Section
PROGRAM ...
(statements)
(program procedures)
JOB ...
(statements)
(job procedures)
REPORT ...
(report procedures)
SORT ...
(sort procedures)
SCREEN ...
(screen procedures)
...
Sample Program
A simple
Easytrieve
program example follows. This program produces a standard report that is used in the next section as a starting point for the tutorial.
FILE PERSNL FB(150 1800) } EMPNAME 17 8 A } EMP# 9 5 N }
Library Section
DEPT 98 3 N } GROSS 94 4 P 2 } JOB INPUT PERSNL NAME FIRST-PROGRAM } PRINT PAY-RPT } REPORT PAY-RPT LINESIZE 80 }
Activity Section
TITLE 01 'PERSONNEL REPORT EXAMPLE-1' } LINE 01 DEPT EMPNAME EMP# GROSS }
The sample program produces the following report:
01/31/18 PERSONNEL REPORT EXAMPLE-1 PAGE 1 DEPT EMPNAME EMP# GROSS 903 WIMN 12267 373.60 943 BERG 11473 759.20 915 CORNING 02688 146.16 935 NAGLE 00370 554.40 911 ARNOLD 01963 445.50 914 MANHART 11602 344.80 917 TALL 11931 492.26 918 BRANDOW 02200 804.64 911 LARSON 11357 283.92 932 BYER 11467 396.68 921 HUSS 11376 360.80 911 POWELL 11710 243.20 943 MCMAHON 04234 386.40
You can generate reports faster with
Easytrieve
than with other programming languages or report generators. The programming lessons show how to start creating
Easytrieve
programs.