Easytrieve manual pdf download

program that you can enter and run on your computer. Use FILE and DEFINE statements in the Library section and view Report Output.

In this introduction task, we show you a sample Easytrieve

program that you can enter and run on your computer. You can follow the task instructions in this tutorial without running the programs to learn the product.

Sample Program

This sample program has only ten lines of code, but it creates a useful report. The program also shows how some of the most important

Easytrieve

keywords are used. In other programming languages, a more complex program would be needed to produce the same report.

FILE PERSNL FB(150 1800) EMPNAME 17 8 A EMP# 9 5 N DEPT 98 3 N GROSS 94 4 P 2 JOB INPUT PERSNL NAME FIRST-PROGRAM PRINT PAY-RPT REPORT PAY-RPT LINESIZE 80 TITLE 01 'PERSONNEL REPORT EXAMPLE-1' LINE 01 DEPT EMPNAME EMP# GROSS
Report Output

The sample program produces the following report, which is an edited display of data from an employee file named PERSNL.

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
The PERSNL sample file is provided with Easytrieve

. Ask your system administrator where it is stored at your site. The PERSNL file is created via the JOB08DEM job located in the CBAAJCL library.

Library Section Statements

This section shows the relationship between the sample program and the report, one statement at a time.

The FILE Statement The first line of our program is:
FILE PERSNL FB(150 1800)

The FILE statement contains the FILE keyword. A FILE statement must be included for every file that your program uses for input or output. The FILE statement tells the program where to get the data that you want processed, and can also provide information about how that data is stored. To do this, the statement must include a file name. In our example, the file name is PERSNL.

The remainder of line 1 is optional. FB(150 1800) provides the program with information about how the PERSNL file is stored, which makes accessing the file more economical. The PERSNL file contains fixed-length records of 150 characters that are stored in 1800 character blocks. This is indicated as one parameter, FB(150 1800), where FB stands for Fixed, Blocked. 150 indicates the record length and 1800 indicates the block size. Multiple sub-parameters must be enclosed in parentheses.

The DEFINE Statement

Our program contains four DEFINE statements that describe fields in a PERSNL file record. The word DEFINE does not need to appear in the statements because it is implied.

EMPNAME 17 8 A EMP# 9 5 N DEPT 98 3 N GROSS 94 4 P 2
The definitions can also be written with the DEFINE keyword:
DEFINE EMPNAME 17 8 A DEFINE EMP# 9 5 N DEFINE DEPT 98 3 N DEFINE GROSS 94 4 P 2

If you need to define a working storage field outside of the library section, you can use DEFINE statements within your program logic. When a field is defined there, the DEFINE keyword is required. See Library Section - Describe and Define Data for more information about using DEFINE statements.

The previous DEFINE statements describe the four fields in a PERSNL file record that our program uses. DEFINE statements do not have to describe all the fields in the record or the spaces between fields. You describe only the fields that the program uses.