TABLE OF CONTENTS
           Introduction to Easytrieve Capabilities Structure of Easytrieve program Environment Definition Data Definition Processing Activities Decision and Branching Logic Input & Output Specification Report Processing Table Processing Synchronized File Processing

INTRODUCTION
Easytrieve is an information retrieval and data management tool designed to simplify computer programming and to perform complex programming tasks.

data extraction and file maintenance requirements. .CAPABILITIES  Easytrieve has all the capabilities of a standard retrieval system as well as the comprehensiveness and flexibility required for complex reports.

CAPABILITIES File Access Accepts any number of input files Processes QSAM. packed-unsigned or binary format  Provides flexible edit masks  Provides default report headings  Allows multiple use of field definitions with COPY keyword     . VSAM . IMS/DLI files. numeric. IDMS & SQL Synchronizes file processing Processes data in alphabetic. ISAM. packed.

CAPABILITIES Logic Process  Provides standard programming constructions  Provides powerful calculation capabilities  Performs special tests useful in editing  Supports Move for corresponding fields  Includes special start & finish procedures  Sorts on any number of keys .

CAPABILITIES Report Output  Automatic formatting of reports & customizing options  Provides Control breaks on any number of keys  Automatically creates summary file for subtotals  Processes only fields that are required for REPORT  Allows explicit positioning of print layout for pre-printed forms .

MODES OF OPERATION  Easytrieve provides five modes of operation that facilitate production as well as ad-hoc programming. compile and execute source statements (Default)  Syntax check and compile source statements and produce an object module  Execute previously link edited programs .  Syntax check source statements  Syntax check and compile source statements  Syntax check.

STRUCTURE OF PROGRAM Environment section (Optional) Library section (Optional if no files) Activity section (s) PARM (parameters) FILE (parameters) DEFINE fields PROGRAM (statements) JOB (Statements) (Job procedures) SORT (Sort procedures) SCREEN (statements) .

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

20 386.60 759.50 344.80 492.40 PAGE 1 .40 445.16 554.80 243.68 360.20 146.92 396.SAMPLE REPORT 30/06/02 DEPT 903 943 915 935 911 914 917 918 911 932 921 911 943 PERSONNEL REPORT EXAMPLE-1 NAME WIMN BERG CORNING NAGLE ARNOLD MANHART TALL BRANDOW LARSON BYER HUSS POWELL MCMAHON EMP# 12267 11473 02688 00370 01963 11602 11931 02200 11357 11467 11376 11710 04234 GROSS 373.64 283.26 804.

PARM Statement: ENVIRONMENT DEFINITION SYNTAX . COMPILE .Terminates Easytrieve processing after completion of the syntax check operation. PARM LINK (pgmname R) + ABEXIT (SNAP) + DEBUG (DMAP) + XREF (LONG) + LIST (PARM) .  An eg.  If PARM statement is not used. the default is syntax check. Allows early checkout of program before data files necessary for execution are available. compile and execute.Terminates Easytrieve processing after completion of the syntax check and compile operations.

ENVIRONMENT DEFINITION PARM statement customizes the operating environment for the duration of a program’s compilation & execution PARM establishes program level parameters in the following areas :  SYNTAX. PREPNAME. SQLID. PLAN. SSID and USERID establish parameters for SQL execution . LINK determine the mode of execution  BIND. COMPILE.

FILE filename File Type => [IS/ VIRTUAL/ DLI/ VS ([ES] [CREATE [RESET]/ UPDATE] Device Type => [CARD/PUNCH/PRINTER/DISK/TAPE] Record Format => [F/V/U/FB/VB/VBS] .DATA / LIBRARY DEFINITION FILE Statement All files and databases that the program references must be defined using the FILE statement.

Two categories of data can be defined : 1. File data 2. Working Storage data Field names must be unique within a file or working storage. The keyword DEFINE is optional within Library section .DATA / LIBRARY DEFINITION DEFINE Statement Fields are defined in the library using DEFINE statement.

specifies the location of the field’s leftmost byte Length .specifies data format(A/N/P/B/U) MASK .Blank When Zero lit-4 .print edit mask (9/Z/*/-/$/X) VALUE .Optional parameter specifying pattern edit mask for printing numeric fields on a report.Basic syntax of DEFINE statement is as follows : DATA / LIBRARY DEFINITION DEFINE field-name Location Length S/W DataFormat [MASK ( [letter] [BWZ] [lit-4])] [VALUE lit-5] Location . letter-identifier for a mask specified with lit-4 BWZ .To initialize working storage fields to specific values .specifies the storage of the field DataFormat .specifies the length of the field S/W .

PROCESSING ACTIVITIES
The activity definition section of the program contains the statements that perform the tasks of reading in, processing and writing out data. Four processing activities – PROGRAM, JOB, SORT and SCREEN.  PROGRAM is a simple top-down set of instructions which is used to initiate other activities.  JOB activities read data from input files, examine and manipulate this data and write data to output files and initiate reports.  SORT activities sequence the files in the order specified by parameters of this statement.  SCREEN activities define screen-oriented transactions.

PROGRAM ACTIVITY
Program identifies and initiates a processing activity PROGRAM NAME program-name [ activity ] [USING field-name1 GIVING field-name2] Program-name - names the processing activity Activity - activity which is initiated by the program Field-name1 - field to which parameter is passed from parent program Field-name2 - field containing the parameter you return to the parent program

PROCEDURES
Procs Separate modules of program code used to perform specific tasks Defined at the end of each activity Local to the activity after which they are coded

JOB STATEMENT JOB statement identifies the files whose records are automatically provided to the program (automatic input) JOB [INPUT {file-name KEY(field-name)}…{NULL}] [START start-proc-name] [FINISH finish-proc-name] [NAME job-name] INPUT file-name . Normally.identifies fields used in synchronized file processing NULL . a job is implicitly stopped when the automatic file is exhausted. the program continues until a STOP statement is executed.provides the name of the file used in automatic input KEY field-name . With NULL.inhibits automatic input.Optional parameter identifying automatic input . .

The optional FINISH finish-proc-name parameter identifies a procedure to be executed during the normal termination of the JOB. NAME job-name .JOB STATEMENT JOB statement identifies the files whose records are automatically provided to the program (automatic input) JOB [INPUT {file-name KEY(field-name)}…{NULL}] [START start-proc-name] [FINISH finish-proc-name] [NAME job-name] START . .names the JOB activity.The optional START start-proc-name parameter identifies a procedure to be executed during the initiation of the JOB. FINISH .Used for documentation only.

END-IF Step 1 Logic generated by JOB Step 2 Data examination and Manipulation statements . ..JOB CONTROL FLOW Reset working storage Open I/O files [PERFORM start-proc] JOB …retrieve automatic input IF EOF . reset working storage closes I/O files [PERFORM finish-proc] wrap-up REPORTS go to the next JOB/SORT activity END-IF IF ….. . .

Sub-parameter D .for descending order.names the SORT activity. NAME sort-name.name of the sorted output file (can be the same as file-name-1 except in case of VSAM and ISAM) USING field-name [D] . BEFORE proc-name .SORT STATEMENT SORT statement orders any file which can be processed sequentially. modifies and selects input records for the sort.Optional parameter that identifies a procedure that prescreens. SORT file-name-1 TO file-name-2 USING (field-name [D]) [BEFORE proc-name] [NAME sort-name] file-name-1 .Identifies data fields of file-name-1 used as sort keys.name of the input file to be sorted file-name-2 .Used for documentation only .

PROC IF GROSS LT 29999 SELECT END-IF END-PROC * . OF SORT PROCEDURE * FILE PERSNL FB(150 1800) EMP# 9 5 N GROSS 94 4 P 2 * FILE SORTER F 150 VIRTUAL * SORT PERSNL + TO SORTER + USING EMP# + BEFORE INCLUDE-RECS * INCLUDE-RECS.EG.

Statements can also be inserted in screen procedures to retrieve and maintain files and databases. Rows .number of rows to be displayed on the screen Columns . in any order) . TITLEs.number of columns on a line Structure of SCREEN statement SCREEN statement Screen declaration statements KEYs.name of the screen. For documentation. A SCREEN activity defines a transaction-oriented processing activity under the control of keys pressed by the terminal operator. ROWs (in any order) Screen procedures (both special-named and user-defined.SCREEN PROCESSING The SCREEN statement defines and initiates a SCREEN activity. SCREEN NAME screen-name [UPPERCASE ROWCOUNT rows LINESIZE columns] Screen-name .

E. then press Enter. D.SAMPLE SCREEN DEFINE WS-REPLY W 1 A SCREEN NAME MAIN-MENU TITLE 'Employee File Main Menu' ROW 6 COL 10 'Type an option. or X' ROW 10 COL 22 'V View employee' ROW 11 COL 22 'E Edit employee' ROW 12 COL 22 'D Delete employee' ROW 13 COL 22 'X Exit' KEY F1 NAME 'Help' IMMEDIATE KEY F3 NAME 'Exit' EXIT KEY F12 NAME 'Cancel' EXIT IMMEDIATE + .' ROW 8 COL 10 'Option ===>' WS-REPLY VALUE ('V' 'E' 'D' 'X') ERROR 'Please type V.

| | | | Option ===> | | V View employee | | E Edit employee | | D Delete employee | | X Exit | | | | F1=Help F3=Exit F12=Cancel . then press Enter.|-----------------------------------------------------------------------------------------------------------------------------------------------| | Employee File Main Menu | | Type an option.

DECISION & BRANCHING LOGIC  IF condition statements ELSE-IF (optional) statements ELSE (optional) statements END-IF  DO WHILE / DO UNTIL condition statements ENDDO .

DECISION & BRANCHING LOGIC  CASE field-name WHEN condition statements OTHERWISE condition statements END-CASE  GOTO {label/JOB}  PERFORM proc-name  EXECUTE job-name|sort-name|screen-name  STOP [EXECUTE] .

INPUT / OUTPUT SPECIFICATION EASYTRIEVE provides three levels of I/O Automatic Controlled Data base .

produces printed o/p not directly supported by reports PRINT . adds or deletes one keyed record Database I/O provides access to IMS.positions to a particular record for subsequent sequential I/O PUT .sequentially writes one record READ .INPUT / OUTPUT SPECIFICATON Automatic I/O provides sequential reading of a data file and production of one or more reports.specifies the input file DISPLAY . Statements supporting this level are JOB .reads one keyed record WRITE .rewrites. . Controlled I/O statements are GET .sequentially reads one record POINT .initiates report output Controlled I/O provides the capability to process any sequential or keyed file (ISAM/VSAM). DB2 and IDMS databases.

Optional parameter specifying destination of the DISPLAYED data.lit-4/ COL lit-5] file-name The .Adjustment of horizontal spacing between displayed items COL lit-5 . named file should be designated as a PRINTER file.Specify the data to be printed +lit-4 / -lit-4 .DISPLAY STATEMENT DISPLAY [file-name] [{TITLE|NOTITLE} / SKIP lit-1 / CONTROL lit-2] [lit-3 / field-name / +lit-4 / . lit-3/field name . The default is SYSPRINT.Specifies precisely where data is placed on the print line .

The next statement to be executed after the PRINT statement is the associated REPORT statement. .PRINT STATEMENT PRINT report-name PRINT statement initiates report output by causing the named report to extract the current values of the fields to be output and to format them according to the specifications in the report declaratives.

PUT file-name-1 [from file-name-2] .GET & PUT STATEMENTS GET statement makes the next or previous sequential record of the named file available for processing. GET file-name [PRIOR] PUT outputs records to SEQUENTIAL files and also adds consecutive records to an INDEXED or RELATIVE file.

. POINT file-name {EQ/=/GE/>=} {field-name/literal} POINT statement only locates the specified position of the record in the file. GET statement is necessary to retrieve the data for processing.POINT STATEMENT POINT statement initiates a search for a position within an indexed or relative record file. based on a comparison between keys in the file and a search value specified in the statement.

POINT STATEMENT EXAMPLE FILE PAYFILE VS REC-KEY 1 3 N JOB INPUT NULL POINT PAYFILE GE 500 GET PAYFILE DO WHILE (REC-KEY < 600 AND NOT EOF PAYFILE) PRINT PAY-RPT GET PAYFILE ENDDO STOP REPORT PAY-RPT … Above statements retrieve those records with keys between 500 and 599 inclusive from file PAY-FILE and output them to report PAY-RPT. .

READ file-name KEY field-name [STATUS] file-name .search value to identify the specific record to be retrieved.READ STATEMENT READ statement provides random access to keyed and relative-record VSAM and ISAM files. . STATUS .execution of the READ statement sets a return code in the FILE-STATUS field of the input file to indicate the success or failure of the operation.identifies the file you wish to access KEY field-name .

This parameter is invalid for DELETE operation. WRITE updates or deletes the current record of the named file or adds new records. Required for deleting or adding records and optional for update activity. WRITE file-name-1 [DELETE / UPDATE / ADD] [FROM file-name-2] file-name-1 .Name of the file to be modified DELETE / UPDATE / ADD .WRITE STATEMENT WRITE statement is used in the maintenance of keyed and relative-record VSAM files.Specify the activity to be performed. Default is UPDATE if the parameter is not coded. .WRITE copies the current record of file-name-2 to file-name-1 for either an UPDATE or an ADD operation. FROM file-name-2 .

READ / WRITE EXAMPLE FILE PAYFILE VS UPDATE EMPL# 1 5 N NAME 6 20 A JOB INPUT NULL EMPL# = 44152 READ PAYFILE KEY EMPL# STATUS IF FILE-STATUS NOT ZERO GOTO ERRTASK END-IF IF NAME EQ ‘OLDNAME’ NAME EQ ‘NEWNAME’ WRITE PAYFILE UPDATE END-IF STOP .

REPORT PROCESSING Reports are defined by the following set of statements REPORT SEQUENCE CONTROL TITLE HEADING LINE report procedures BEFORE-BREAK TERMINATION .

.SALARIED EMPLOYEES’ HEADING LAST-NAME ‘NAME’ HEADING SERVICE ‘SERV’ LINE DEPT LAST-NAME SERVICE RAISE SALARY The above report is ordered by department number and within each department. There are 5 columns spaced three characters apart across the 63character-wide report. by lastname.SAMPLE PROGRAM REPORT DECLARATIVES REPORT UPD-RPT PAGESIZE 51 LINESIZE 63 NODATE NOPAGE SEQUENCE DEPT LAST-NAME CONTROL DEPT TITLE 1 ‘ANNUAL UPDATE REPORT . the dollar values are subtotalled for each department. The report is segmented by department.

Includes mailing labels.REPORT TYPES Standard format .Default format consisting of Title area. Heading area and Report Body. TITLE AREA HEADING AREA REPORT BODY PAGESIZE Label Format . SIZE DOWN LINESIZE LINESIZE . form-letters and other special-purpose reports.

REPORT STATEMENT REPORT report-name + [SUMMARY] + Format Determination Parameters [SUMFILE sum-file-name] + [LABELS ([ACROSS lit-1] + Label Parameters [DOWN lit-2] + [SIZE lit-3] + [NEWPAGE]] + [PRINTER file-name] + File Directing Parameters [PAGESIZE lit-4] + Spacing control Parameters [LINESIZE lit-5] + [SPREAD] + [NOSPREAD] + [NOADJUST] + [NODATE] + [NOPAGE] + [LIMIT lit-6] + Testing aids Parameters [EVERY lit-7] .

Identifies a file-name other than the default print destination .SUMFILE is used to generate a summary file that contains the control and summary field values. LABELS . Only quantitative fields are totaled (those defined with decimal positions) SUMFILE sum-file-name .ACROSS specifies the number of labels printed side-by-side across the page. Summary-file-name identifies the file to contain the summary data.REPORT STATEMENT report-name .Names the report SUMMARY . DOWN specifies the number of print lines on each label. SIZE specifies the width of each label and NEWPAGE prints first line of each label at the top of a page.Inhibits printing of detail data on control reports. PRINTER file-name .

Used in Testing EVERY .SPREAD maximizes number of spaces between columns. NODATE . Centering is the default.REPORT STATEMENT PAGESIZE . NOADJUST .Suppresses printing of characters PAGE and the page number in the rightmost 11 columns of the report title LIMIT .Specifies the occurrence value for processing every nth Print command directed to the report .Left justifies the report.Specifies the number of print statements accepted for this report.sets the number of print columns on each report line SPREAD/NOSPREAD . NOSPREAD.sets the number of print lines per page LINESIZE . puts three spaces between columns and centers the report.Suppresses printing of date in the leftmost 8 columns of the report title NOPAGE . the default.Adjusts column spacing on the report.

..SEQUENCE STATEMENT SEQUENCE field-name-1 [D] [.field-name-2 [D]] . Specifies the order in which the fields on the report should be ordered. Inclusion of ‘D’ indicates the field is sequenced in descending order. . default is ascending order.

CONTROL STATEMENT CONTROL [field-name FINAL] [NEWPAGE/RENUM] [NOPRINT] Specifies the field name(s) on which the report should be controlled. NEWPAGE .suppresses printing the summary line for the specified control break. Following options alter the normal control break processing. RENUM .causes a skip to the top of the next page after control break processing for the specified field is completed. NOPRINT . . FINAL parameter is coded to specify options for the control break which occurs at end-of-report.causes a skip to the top of the next page and resets the page number to 1 on the page following the control break.

Specifies a character string (enclosed in quotes) for the title item. The word PAGE and page number are printed in rightmost 11 positions unless NOPAGE option is specified on the REPORT statement. of characters to be added/subtracted from the normal 3 character space between items. lit-1 .Specifies the column number where the 1st character of the next title item will be printed .Specifies that the contents of the named field will appear on the title line. +lit-3/-lit-3/COL lit-4} Each title line is centered horizontally within the title area of the report.Specifies the position of the title line within the title area. Current date is printed in leftmost 8 positions unless NODATE option is specified on the REPORT statement. +lit-3 / -lit-3 . ‘lit-2’ . field-name.Specifies the no. COL lit-4 .TITLE STATEMENT TITLE [lit-1] {field-name. ‘lit-2’.

HEADING LAST-NAME ‘NAME’ Multiple literals within parentheses are stacked vertically over the column when printed. Eg. HEADING LAST-NAME (‘EMPLOYEE’..HEADING STATEMENT HEADING field-name (‘literal’. ‘NAME’) produces EMPLOYEE NAME . field-name . Eg..Specifies the name of a field coded on the LINE statement. The value of the literal is the content of the new heading.) Optionally defines an alternate column heading to be printed in place of the specified field-name.

‘lit-2’ . field-name. COL lit-4 . lit-5 specifies the item number on line 1 under which the item is to be placed. .Specifies the no. of characters to be added/subtracted from the normal 3 character space between items.Specifies a character string (enclosed in quotes) for the line item.Specifies that the contents of the named field will appear on the print line. lit-1 .Specifies the column number where the 1st character of the next line item will be printed POS lit-5 . ‘lit-2’. +lit-3/-lit-3/COL lit-4/POS lit-5} LINE statement defines the contents of the lines of the report. +lit-3 / -lit-3 .Enables to position items on lines 2 thru 99 so that they line up under specified items on line 1.Specifies the position of the line within the line group when there are multiple lines.LINE STATEMENT LINE [lit-1] {field-name.

Line 3 lists the city.LINE STATEMENT EXAMPLE. LINE 1 REGION + SSN + NAME + DOB LINE 2 POS 2 PHONE + POS 3 STREET + POS 4 DATE-OF-HIRE LINE 3 POS 3 CITY -2 STATE -2 ZIP Line 2 lists phone number under Social Security number. street address under name and date-of-hire under Date Of Birth. state and zip under Name and street address o/p : SOUTHWEST 571-40-8057 Florance Smith 11-26-72 785-4815 3250 Big street 08-03-81 Riverside CA 09265 .

. The description is information directly associated with the argument. TABLE option must be coded. 2.TABLE PROCESSING  A table is a collection of uniform data records. The argument uniquely identifies a table entry. Tables have two parts : 1.  Tables are defined by FILE statements in the library section. ARG defines the field used to search the table. FILE file-name TABLE [INSTREAM / literal]  The only fields defined for TABLE files are ARG (argument) and DESC (description). DESC defines the field which contains the desired information.

 Instream Tables reside within your program.TABLE PROCESSING  There are two types of TABLEs. The word ENDTABLE indicates end of table data. they are established for use when the program is compiled. they are established for use during initiation of the JOB activity that contains the SEARCH statement which references them.  External Tables are stored on files external to the program. . instream and external. Instream table data is coded immediately following the FILE statement.

INSTREAM TABLE EXAMPLE FILE WEEKDAY TABLE INSTREAM ARG 1 1 A DESC 3 9 A 1 SUNDAY 2 MONDAY 3 TUESDAY 4 WEDNESDAY 5 THURSDAY 6 FRIDAY 7 SATURDAY ENDTABLE .

SEARCH STATEMENT SEARCH statement is used to access table information. GIVING field-name-2 .name of the file which describes the table and its source. This field can be defined in Working storage or in any file except a file with TABLE attribute .This parameter identifies the receiving field for the results of the table search. Field-name-1 can be defined in Working storage or in any file except a file with TABLE attribute.This parameter identifies the field that contains the search argument. SEARCH file-name WITH field-name-1 GIVING field-name-2 file-name . WITH field-name-1 .

‘IS DAY’.TABLE SEARCH OPERATION FILE CALENDAR DAY-OF-WEEK 12 1 NAME-OF-DAY 14 20 FILE WEEKDAY TABLE INSTREAM ARG 1 1 A DESC 3 9 A 1 SUNDAY 2 MONDAY 3 TUESDAY 4 WEDNESDAY 5 THURSDAY 6 FRIDAY 7 SATURDAY ENDTABLE A A JOB INPUT CALENDAR SEARCH WEEKDAY WITH DAY-OF-WEEK GIVING NAME-OF-DAY IF WEEKDAY DISPLAY NAME-OF-DAY. DAY-OF-WEEK ELSE DISPLAY ‘****INVALID DAY OF WEEK = ’. DAY-OF-WEEK END-IF .

 Has the capacity to synchronize any number of files which can be processed sequentially. .SYNCHRONIZED FILE PROCESSING  Easytrieve simplifies combining data from more than one file.

SYNCHRONIZED FILE PROCESSING EG. FILE PERSNL FB(150 1800) OLD-EMP# 9 5 N * FILE PERSUPD EMP# 1 5 N RAISE-PERCENT 7 2 N * FILE SORTPER F 150 VIRTUAL UPD-EMP# 9 5 N NAME 17 8 A PAY-GROSS 94 4 P 2 * NEWSAL W 4 P 2 * FILE NEWPERS FB(150 1800) * FILE ERRPRINT PRINTER * .

.SORT PERSNL TO SORTPER USING OLD-EMP# JOB INPUT (SORTPER KEY(UPD-EMP#) PERSUPD KEY (EMP#) ) IF MATCHED NEWSAL = PAY-GROSS * (1 + RAISE-PERCENT /100) PRINT NEW-RPT PAY-GROSS = NEW-SAL END-IF IF SORTPER PUT NEWPERS FROM SORTPER ELSE DISPLAY ERRPRINT EMP# ‘RECORD NOT MATCHED’ END-IF REPORT NEW-RPT LINESIZE 80 NOPAGE NODATE SEQUENCE NAME TITLE ‘SALARY UPDATE REPORT’ LINE UPD-EMP# NAME PAY-GROSS NEWSAL RAISE-PERCENT END SYNCHRONIZED FILE PROCESSING EG.

Sanjay x 4157 Kiran x 4155 Deepa x 4153 .

Sign up to vote on this title
UsefulNot useful