Sei sulla pagina 1di 68

What is EZT+ ?

Easytrieve is an information retrieval and data management

system. It provides a user with tools needed to produce comprehensive reports with ease It also has capabilities to perform complex programming tasks. Easytrieve operates on the IBM 370 and compatible processors in the VM, MVS &VSE environments. Under TSO & CICS, Easytrieve runs interactively for data inquiry, analysis & reporting. The output can be directed to our terminal screen or it can be routed to a printer

Basic features of Easytrieve


Automatic Report Generation. Creation of any number of reports in single pass of data. Edit masks. Array Processing. Powerful calculation capabilities.

EZT helps in :-

Easy extraction of all types of data from any combination of


files, as well as it can handle unlimited number of input files. Access of variable length of fields and has the flexibility to segregate it to our desire. We can match & merge any number of keys & files. We can perform extensible table lookups.

EZT+ Structure
Easytrieve program sections
An Easytrieve program consists of three main sections: 1. Environment section - optional

2. Library definition section - optional


3. Activity section(s) - at least one required.

Environment Section
The environment section enables you to customize the operating environment for the duration of a program's compilation and execution by overriding selected general standards for an Easytrieve program. Some of the standard Easytrieve options affect the efficiency of an Easytrieve program. There can be minor trade-offs between the automatic debugging tools provided by Easytrieve and the efficiency of the program code.

For example, you can specify that Easytrieve record the statement numbers of the statements being executed for display during an abnormal termination (FLOW).
Use of this option, however, does have a minor impact on processing time. You can turn this option on or off in the environment section of each Easytrieve program.

PARM is the only statement that is coded in this section. PARM specifies the name of the link module with the LINK
parameter.

Library Section
The library section describes the data to be processed by the program.

It describes data files and their associated fields, as well as working storage requirements of a program. The library section is said to be optional because, on rare occasions, a program may not be doing any input or output of files.
However, in most cases, use of the library definition section is required. Coding data definitions to avoid unnecessary data conversions can reduce processing time.

Activity Section
The executable statements that process your data are coded in one or more activity sections. Executable statements in Easytrieve can be procedural statements or declarative statements. The activity section is the only required section of your program. There are four types of activities: PROGRAM SCREEN JOB SORT.

PROGRAM ACTIVITY
A PROGRAM activity is a simple top-down sequence of instructions. A PROGRAM activity can be used to conditionally execute the other types of activities using the EXECUTE statement. SCREEN ACTIVITY The SCREEN activities define screen-oriented transactions. 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.

SORT ACTIVITY The SORT activity create sequenced or ordered files. It is used to sort the Sequential Datasets. Output of this Sort is passed to JOB activity as Input file. So Sort is always coded before JOB activity. JOB ACTIVITY The JOB activity read information from files, examine and manipulate data, write information to files, and initiate reports and graphs

REPORT
REPORT sub activities are areas in a JOB activity where reports are described. You can code one or more REPORT sub activities after the PROCs (if any) at the end of each JOB activity. GRAPH

Graph sub activities are areas in a JOB activity where graphs are described.
One or more GRAPH sub activities can be coded after JOB Activity You cannot code procedures for a GRAPH sub activity.

A Basic EZT+ Program


*---- -----Environment Section PARM LINK (myfirstpgm(R)) *-------- --Library Section Define var1 w 9 A Define var2 w 4 N *--------Activity Section PROGRAM Name mypgm DISPLAY Hello World STOP

Value Value +0

EZT+ Program -

MULTIPLICATION TABLE

*---- -----Environment Section PARM LINK (firstpgm(R)) *-------- --Library Section Define Cval W 4 N Value +0 Define Tval W 4 N Value +0 Define Prod W 9 N Value +0 *--------Activity Section PROGRAM Name mypgm Tval = 1. Cval = 20. DO WHILE tval LE 20 Prod = Cval * tval Display Cval * tval = prod tval = tval + 1 END-DO. STOP

FILE PROCESSING
JOB Activity JOB activities read information from files, examine and manipulate data, write information to files, and initiate reports and graphs. JOB Activate initiate Automatic File Processing Syntax: JOB INPUT filename START proc-name1 FINISH proc-name2 NAME job-name

*--- Typical File Processing Prog. Using Automatic File Processing *-- option with JOB Activity

PARM LINK (MYPRG(R))


*--Library Section FILE Infile FB(1000 0) in-rec 1 1000 Emp-key 4 9 Emp-name 30 30 FILE Outfile FB(1000 0) Out-Rec 1 1000 total-in W total-out W 5 5 A A A

A N N Value +0 Value +0

JOB INPUT Infile START First-proc FINISH Last-proc NAME myjob total-in = total-n + 1 Out-Rec = In-Rec PUT Outfile total-out = total-out + 1 GOTO JOB

First-proc. PROC total-in = 0 total-out = 0 DISPLAY Copy Job Started END-PROC last-proc. PROC DISPLAY COPY JOB END DISPLAY Input Recors total-in DISPLAY Output Records total-out END-PROC

PROCS PROCS are separate modules of program code you use to perform specific tasks. Proc is Logical group of executable statements. You can code one or more procedures (PROCs) at the end of each activity.

Syntax is PROC. Procname Logic code END-PROC

RULES of USAGE for PROCS 1. PERFORM statement is used to call a PROC. Syntax : PERFORM procname 2. PROC must be coded immediately after Activity , in which it is being called. 3. PROCS are local to an activity. 4. Data Variable declared within a PROC are local to current PROC only. 5. A PROC can call other PROC. 6. We cannot use PERFORM for procname from same procname. (GOTO may be used )

FILE Statement
syntax : FILE file-name VS UPDATE

VS - VSAM file UPDATE - Designed VSAM can be updated

HOW TO DECLARE FILE FIELDS


syntax: FIELD-NAME Starting-loc. Length Type

* - Field name can be 40 Char long * - Starting loc. Relative to position one in the record

EXAMPLES :
FILE infile in-rec emp-id emp-name 1 4 25 1000 9 30 A A A

FILE zipcode VS UPDATE zip-key 1 5 A zip-value 6 5 A

VSAM-KEY

Defining Files
Use the FILE statement to describe a file or a database. Different FILE statements must describe all files and databases that your program references. FILE statements are the first statements coded in the library section of an Easytrieve program.

The FILE statement can differ greatly depending on the operating environment and the type of file being processed.

File Fields
File fields are normally defined immediately following the associated FILE statement in the library section of a Easytrieve program. Their rules of usage are: Easytrieve accepts an unlimited number of fields for each file (constrained by available memory). Field names must be unique within a file. You can define file fields anywhere in a Easytrieve library or activity section, except within a REPORT sub activity or a SCREEN declaration.

Working Storage Fields


EZT+ Working Storage gives us a method for setting aside a temporary area of storage to define data items used in processing logic that is independent of FILE definitions. EZT+ has two type of work fields W field : working storage fields used to hold temporary values ,not associated with any file. S field : S percentages. fields are static used for totaling and

How to declare Working Storage fields


syntax DEFINE fieldname W length type [VALUE MASK RESET] Examples DEFINE month W 10 A Value January

DEFINE empid
amount W 4

W
P

5
2

N Value +0 MASK ZZZZZ9


Mask $$$$9.99

*-- DEFINE is not required in Library section

DATA FORMATS A Alphabetic or Alphanumeric N Zoned Decimal B Binary P Packed Decimal U Unsigned Packed Decimal

Maximum Size Permitted for each data format Data Code A B N P U Maximum Length 32,767 18 10 4 9 Decimal Pos. NA 0 - 18 0 - 18 0 - 18 0 - 18

RULES OF USAGE
Working storage fields are normally defined in the Easytrieve library section. Their rules of usage are:

Easytrieve accepts an unlimited number of working storage fields (constrained by available memory).
Working storage fields must be uniquely named within working storage. You can define working storage fields anywhere in a Easytrieve library section, activity, or procedure. The sum of all working storage fields cannot exceed 32K (workstation only).

VARIOUS I/O COMMANDS

Manual FILE Handling ...

OPEN , CLOSE GET , PUT DISPLAY , PRINT STOP VSAM FILE HANDLING READ WRITE POINT

*-- Copy a File , Without using Automatic File Processing of Job Activity PARM LINK ( MYPGM(R)) *-------Library Section FILE infile FB (1000 0) in-rec 1 1000 in-emp-key 4 9 in-emp-name 14 30 FILE outfile FB(1000 0) Out-rec 1 1000

A A A

JOB INPUT NULL START firstproc FINISH lastproc GET infile IF NOT EOF infile outrec = inrec PUT outfile else STOP end-if GOTO JOB

Firstproc. PROC OPEN infile OPEN outfile total-in = 0. Total-out = 0 END-PROC Lastproc. PROC CLOSE infile CLOSE outfile DISPLAY Input Records total-in DISPLAY Output Records total-out END-PROC

DATA TRANSFER /CONTROL FLOW STATEMENT


Assignment Statement MOVE Statement

GOTO Statement
IF Statement DO While

DO Untill
CASE Statement STOP Statement PERFORM EXIT

VSAM FILE PROCESSING USE OF READ Example Program FILE infile in-rec 1 in-SSN 1 in-name 11 in-comp-code 50

100 9 30 5

A A A A

FILE outfile out-rec out-addr

1 55

100 30

A A

FILE vsfile VS comp-code 1 comp-addr 6 vs-key W

5 30

A A

Value '

'

JOB INPUT infile START firstproc FINISH lastproc outrec = inrec vs-key = in-comp-code READ vsfile KEY vs-key, STATUS IF FILE-STATUS(vsfile) = 0 out-addr = comp-addr ELSE IF FILE-STATUS = 16 DISPLAY ' RECORD not found DISPLAY key = ' vs-key ELSE PERFORM ABEND-ROUTINE END-IF END-IF PUT outfile GOTO JOB

firstproc. PROC OPEN outfile END-PROC lastproc. PROC CLOSE outfile END-PROC

USE of POINT POINT vsfilename = keyvalue STATUS or POINT filename > keyvalue STATUS IF FILE-STATUS = 0 --- we got it ----ELSE IF FILE-STATUS = 16 ---- record not found ---END-IF END-IF

USE of WRITE
*** Use Point statement to reach the record after which you want to insert new record WRITE filename ADD It will insert current values in VSAM file record in at current position in VS FILE. WRITE filenme DELETE It will delete current record from VSAM file. WRITE filename UPDATE FROM filename2

Varying Length fields


The VARYING parameter on the DEFINE statement designates varying length fields. FLDA W 250 A VARYING

w w

2 248

B A

for length 2byte for Data

Varying means the length of data in this field is for each occurrence in separate record is unique. Varying lengths field are Alphanumeric

SORT
Syntax : Sort Input file-name TO sorted-file-name NAME
USING ( Sort Key field/s ) SIZE Record-count Before Proc Name Optional Optional

Can sorted file name is same as that of input file name. Using - keyword specifies keys for sorting ( max 10 w/s) Key fields should not be NULL variable length fields cant be defined as keys for sorting Default is Ascending, Specify D for Descending SORT can be executed by a PROGRAM/SCREEN activity In absence of PROGRAM JOB & SORT are executed sequentially until a SCREE activity is encountered

SORT
Sort field can be any field less than 256 byte BEFORE proc-name Optionally, specify proc-name to identify your procedure that pre-screens, modifies, and SELECTS input records for the sort A selected record is written only once even if selected more than once in the procedure. If the file being sorted is variable length record file the output file generated is with a record length equal to maximum record length that is specified in the file stmt. Use VIRTUAL to create a temporary sort file

FILE Sortfile FB Virtual


be deleted at EOJ

This will

SAMPLE REPORT

FILE EMPFILER
SSNUM F-NAME L-NAME DEPT SALARY 1 10 18 28 62 9 8 10 5 5 N A A A N0

FILE SALSORT
COPY EMPFILER

SORT EMPFILER TO SALSORT + USING (DEPT SALARY D) JOB INPUT SALSORT NAME SALARY

PRINT RPT1-SALARY PRINT RPT2-SALARY


REPORT RPT1-SALARY TITLE 'EMPLOYEE SALARIES BY NAME WITHIN DEPARTMENT' LINE 01 DEPT F-NAME L-NAME SALARY REPORT RPT2-SALARY TITLE 'EMPLOYEE SALARIES BY SS NUMBER WITHIN DEPARTMENT' LINE 01 DEPT SSNUM SALARY

EASYTRIEVE provides the following automatic formatting features:


Centering of report body and titles Library field names as column headings Column headings centered over data Run date and page number printed at top

REPORT ON A VACATION DAYS ALLOTED AND REMNANING TO EMPLOYEE

SAMPLE REPORT
FILE EMPFILER - section ??
F-NAME L-NAME DEPT PAY-GRADE TOTAL-VAC USED-VAC NEW-VAC 10 18 28 44 71 73 W 8 10 5 2 2 2 2 2 A A A N N N N N HEADING 'FIRST NAME' HEADING 'LAST NAME' HEADING + 'DEPARTMENT' 0 0 0 0

VAC-REMAIN W

HEADING ('VACATION + 'USED') HEADING ('NEW + 'TOTAL' 'VACATION') HEADING ('VACATION+ 'REMAINING')

JOB INPUT EMPFILER NAME COURSE-EXAMPLE IF PAY-GRADE > 3 NEW-VAC = TOTAL-VAC + 2 ELSE NEW-VAC = TOTAL-VAC + 1 END-IF VAC-REMAIN = NEW-VAC - USED-VAC PRINT REPT1

REPORT REPT1 SEQUENCE DEPT L-NAME CONTROL DEPT TITLE 'NEW VACATION TOTALS AFTER BONUS + DAYS AWARDED' DEPT F-NAME L-NAME NEW-VAC USED-VAC VAC + -REMAIN LINE DEPT F-NAME L-NAME NEW-VAC USED VAC + VACREMAIN

REPORT WRITING

Report section begins with a REPROT statement. Syntax:REPORT Report Name Report Definition Statements
SEQUENCE CONTROL SUM TITLE HEADING LINE

SEQUENCE
To specifies the order in which data prints on the Report Syntax:SEQUENCE field-name1<D> field name2<D> Example: SEQUENCE DEPT SALARY D L-NAME The fields you sequence on DO NOT have to appear in the printed report.

CONTROL
To accumulate totals and print them at CONTROL breaks Syntax:- CONTROL field-name1 FINAL <NEW PAGE> <RENUM> <NOPRINT> Example: CONTROL FINAL NOPRINT DEPT SUPERVISOR NEWPAGE field-name can be any non quantitative field from any input file or working storage

CONT.

CONTROL Cont....
FINAL - Lets you specify options for the end of report. NEWPAGE - Starts printing on new page following the printing of control break. Page number continues RENUM - Also starts a new page but restarts the numbering NOPRINT - Suppresses printing of accumulated total at control break. Final totals print automatically unless you code FINAL NOPRINT

SUM
Use the SUM statement to specify which fields you want totaled for control breaks. By default, EZT+ totals all quantitative fields included in the report, but you can override this with SUM. Syntax:SEQUENCE field-name1field-name2 Example:- SUM Salary Bonus New-Salary

TITLE
Use TITLE statement to define one or more title on a report ( Max 99 ) Syntax:- TITLE<nn> <+n -n COL nn> field-name literal by default space =3 Use NOADJUST if using COL on REPORT STMT Example:CONTROL DEPT TITLE NEW SALARY AND BONUS FIGURES TIELT3 FOR THE -2 DEPT DEPARTMENT

OUTPUT
4/12/99 New Salary and Bonus Figures PAGE 1 --------SPACE FOR TITLE2-----For the Finance Department If no TITLE are coded no date of page number is displayed You must code at least one literal or field-name on each TITLE statement

HEADING
Use the HEADING statement to define alternate column headings for any fields in the report. These definitions override any you specified in the Library section. Syntax :- HEADING field-name 'literal Example:- HEADING DEPT 'DEPARTMENT Example:- HEADING INCREASE ('PROPOSED' 'SALARY' 'HIKE') Max of 128 characters you can give in a heading.

LINE
Use the LINE statement to define the detail lines of a report. Syntax: LINE <nn> <+n-n COL n POS n> field-name 'literal' <nn> -offset specifies the spacing b/w the lines COL specifies the column no where next line item should be placed. POS parameter positions line items on lines 2 through 99,so that they line up under particular line items on the first line. Line starts form 1 and max 99 & should be ascending

LINE

cont..

Example: LINE SSNUM F-NAME L-NAME DEPT SALARY Example: LINE DEPT L-NAME LINE 2 POS 2 WORK-PHONE LINE 3 POS 2 P.O. BOX ??TITLE??

6/4/99 EMPLOYEE LOCATION/PHONE ?PAGE? DEPT L-NAME ------spaces-----IT Munish 255374730 B234 IT Prashanth 277895432 A345

PARAMETER DESCRIPTION DEFAULT PAGESIZE number of lines per page 58 LINESIZE length per line 120 SKIP blank lines between line groups SPACE blanks between field columns and between fields and literal in titles TITLESKIP blank lines after title line(s) before heading or detail lines begin SPREAD spreads data evenly over entire line; NOSPREAD overrides SPACE NOADJUST left-justifies title lines and body centered NODATE suppresses date on first title line prints NOPAGE suppresses page number on title line prints

TALLY
You can use a system-defined field called TALLY. EASYTRIEVE accumulates in TALLY the number of detail records within each control break. Its value appears on total lines. HEADING statement to give the value a more descriptive name. REPORT ROSTER SEQUENCE DEPT L-NAME CONTROL DEPT TITLE 'EMPLOYEES BY DEPT' HEADING TALLY ('DEPARTMENT' 'TOTAL') LINE DEPT F-NAME L-NAME TALLY

CUSTOM REPORT WRITING


One of the important features of Easytrieve is 'Report Procedures. These are the routines that are automatically invoked within a report sub activity to perform special data manipulation They are coded immediately after the last LINE statement of the report.

Special Proc for Data Manipulation


EZT provides you seven PROC which performs special data manipulation task for a report REPROT-INPUT BEFORE-BREAK AFTER-BREAK BEFORE-LINE AFTER-LINE ENDPAGE TERMINATION

Code One of more proc right after the a REPORT section LINE statement, Each of these PROCs can be used only once in a give report. SYNTAX Proc-name. PROC Logic statements END-PROC we code the logic similarly as we do in JOB but remember no INPUT/OUTPUT is allowed.

REPORT-INPUT. PROC

A REPORT-INPUT procedure selects and/or modifies report input data. Syntax REPORT-INPUT. PROC This procedure is performed for each PRINT statement that is nothing but the report input. SELECT statement for the associated input data must be executed for the data to continue into report processing, so the unselected datas are bypassed for continued processing.

Although the logic can be coded in JOB activity, We occasionally write the logic in a REPORT-INPUT procedure. An END-PROC statement delimits REPORT-INPUT procedure.

BEFORE-BREAK PROC This procedure is invoked before printing the summary lines for a control break. It can be used for calculating the percentages & average totals. These values must be calculated immediately before printing. Syntax BEFORE-BREAK. PROC

This procedure is invoked once for each level of break. An END-PROC statement must delimit a BEFORE-BREAK procedure.

Note: If NOPRINT is specified on a CONTROL statement, the BEFOR-BREAK procedure is still executed.
Example

AFTER-BREAK PROC This procedure is invoked following the printing of summary lines for a control break. It can be used to produce special annotation on reports. Syntax AFTER-BREAK. PROC This procedure is invoked once for each level of break. An END-PROC statement must delimit a AFTER-BREAK procedure.

Note: If NOPRINT is specified on a CONTROL statement, the AFTER-BREAK procedure is still executed.
Example

BEFORE-LINE. PROC
This procedure allows for special annotation before each detail line is printed AFTER-LINE. PROC This procedure allows special annotation after each detail line is printed ENDPAGE. PROC This procedure is invoked whenever end of page is discerned. Page totals or footer information can be printed at the bottom of each page

TERMINATION. PROC This procedure is invoked at the end of the report. This allows for footer information only on the last page of the report

ALL THE BEST

Potrebbero piacerti anche