What Is EZT+ ?

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 53

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 a single pass of data.

Edit masks.
Array Processing. Powerful calculation capabilities.

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.

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 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.

JOB activities read information from files, examine and manipulate data, write information to files, and initiate reports and graphs. SORT activities create sequenced or ordered files.

PROCS
You can code one or more procedures (PROCs) at the end of each activity.

Procedures are separate modules of program code you use to perform specific tasks.

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. You must code any PROCs used within a REPORT sub activity (REPORT PROCs) immediately after the REPORT sub activity in which you use them. GRAPH sub activities are areas in a JOB activity where graphs are described. One or more GRAPH sub activities can be coded after JOB procedures. 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 Value Define var2 w 4 N Value +0
*--------Activity Section PROGRAM Name mypgm DISPLAY Hello World STOP

Another EZT+ Program


*--- --------- Programme to Print 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

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 fields are static used for totaling and percentages.

How to declare Working Storage fields syntax DEFINE fieldname W length type [VALUE MASK RESET] Examples DEFINE month W DEFINE empid amount W 4 W P 10 A Value January 5 N Value +0 MASK ZZZZZ9 2 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

Data Transfer /Control Flow Statement Assignment Statement MOVE Statement

GOTO Statement
IF Statement DO While

DO Untill
CASE Statement STOP Statement

PERFORM
EXIT

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

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.

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

Working Storage Fields


You can specify two types of working storage fields: S (static) and W (work). Each type is used in a different way, particularly when used in reporting. Fields defined as type S are stored in a static working storage area and are not copied onto report work files. All references to S fields in a report occur at the time the report is actually formatted and printed.

Fields defined as type W are copied onto the report work files at the time a PRINT statement is executed. A spooled report is not actually formatted and printed at the same time the PRINT is executed. Therefore, the value of a W field on a report is set at the time the report data is selected for printing, not at the time it is printed.

With this in mind, you should use S (static) working storage fields for: Temporary work fields for report procedures

Line annotations controlled from report procedures

Grand total values used to calculate percentages.

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


PRINT DISPLAY STOP PUT GET POINT READ WRITE

*-- 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

Report Generation
Report Definition Statements Sequence: This statement specifies the order of a report. We can order any report based on the content of one or more fields. Syntax SEQUENCE field-name Control: This statement automatically accumulates and prints totals .A break occurs whenever there is a change in the assigned control field . Syntax CONTROL [ field-name ] [ NEWPAGE/ RENUM ] [NOPRINT]

NEWPAGE causes a skip to top-of-page after control break processing is complete for the specified field.

RENUM performs the same function as NEWPAGE ,and also resets the page number to 1 on the page following the control break.

NOPRINT suppresses printing the summary line group for the specified control break.

Sum: This statement explicitly specifies the quantitative fields which are totaled for a control report.
Syntax SUM field-name Title: This statement defines an optional report title. The TITLE statement defines the title items and their position on the title line. Syntax TITLE [title-number] field-name Literal +offset

- offset
COL column-number

Title-number specifies the position of the title line in the title area. We must specify title numbers in ascending order with no duplicates.
Field-name specifies a field in any active file, working storage field, or system defined field. Literal specifies a character string for a title item. Offset modifies the normal spacing between title items. Offset is added to or subtracted from the SPACE parameter on the REPORT statement to get the absolute space between title items COL parameter specifies the print column number where the next title item is placed.

Heading: This statement defines an alternative heading for a field, in the report ,that is to be generated . Syntax HEADING field-name (heading-literal ) The heading-literal can be up to 128 characters in length.

Line: This statement defines the contents of a report line. One or more field values or literals can be contained on a report line.

Syntax LINE [line-number]

field-name

literal

+offset

-offset
COL column-number POS position-number

Line-number is optional if it is 1 (which is the default). The value ranges from 1 to 99 .We must specify the line number if there are multiple LINE statements, and it should be in ascending order with no duplicates. Field-name specifies any field contained in the active file or in working storage. If the field is in active file or in working storage , datas are transferred to the print line at the time the PRINT statement is executed . Literal defines a static value for a line item.
Offset modifies the spacing between line items. COL specifies the column number where the next line item is placed POS parameter positions line items on lines 2 through 99,so that they line up under particular line items on the first line.

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 and are not included in the logic sub activity. They are coded immediately after the last LINE statement of the report. The procedures are delimited by End-proc. Each proc may be used only once per report.

Some of the report procs are 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, its a common programming practice to incorporate the logic in a REPORT-INPUT procedure. An END-PROC statement delimits REPORT-INPUT procedure.

FILE HELLO
NAME 1 6A

TEL-NO 7 14 A AREA 15 16 A

AMOUNT 17 21 N 2
HOLD-VAL W 3 N 2 JOB INPUT HELL0 PRINT REP * REPORT REP SEQUENCE AREA NAME

CONTROL AREA
TITLE LIST OF SUBSCRIBERS LINE NAME TEL-NO AREA AMOUNT HOLD-VAL

* REPORT-INPUT. PROC HOLD-VAL = AMOUNT / 10 SELECT END-PROC

Data:

DINESH8235781CH1567.81
BENHUR8756851CH2456.12 KUMAR7258781VP1000.00 BINDHU5678583BL1050.00

Results:

11/21/01 NAME BINDHU

LIST OF SUBSCRIBERS TEL-NO 5678583 AREA BL BL AMOUNT 1050.50 1050.50 2456.12 1567.81 HOLD-VAL 105.05 105.05 245.61 156.78

PAGE 1

BENHUR DINESH

8756851 8235781

CH CH

CH KUMAR 7258781 VP

4023.93 1000.00

402.39 100.00

VP

1000.00

100.00

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.

FILE HAI NAME STATE ZIP 1 5A 6 2A 8 5N

PAY-NET 13 5 N 2 * PERCENT W 2 N 2 TOTAL-NET S 8 N 2 * JOB INPUT HAI * TOTAL-NET = TOTAL-NET + PAY-NET

PRINT REP
* REPORT REP SUMMARY SUMCTL DTLCOPY SEQUENCE STATE ZIP NAME CONTROL STATE ZIP LINE NAME STATE ZIP PAY-NET PERCENT * BEFORE-BREAK. PROC PERCENT = PAY-NET * 100 / TOTAL-NET END-PROC

Data:

BINDHUBL6007612345

BINDHUBL6007667890
DINESHBL6007709876 DINESHBL6007754321 VASAN JP7521811111 VASAN JP7521866666

Results:

NAME

STATE ZIP PAY-NET PERCENT

BINDHU

BL 60076

802.35

36.10

DINESH

BL 60077

641.97

28.89

BL

1444.32

64.99

VASAN

JP 75218

777.77

35.00

JP

777.77

35.00

1555.54 70.00

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.

FILE HAI NAME STATE ZIP 1 5A 6 2A 8 5N

PAY-NET 13 5 N 2 JOB INPUT HAI PRINT REP

*
REPORT REP SUMMARY SUMCTL DTLCOPY SEQUENCE STATE ZIP NAME CONTROL STATE ZIP LINE NAME STATE ZIP PAY-NET

* AFTER-BREAK. PROC IF LEVEL EQ 2 DISPLAY TOTALS FOR THE STATE OF STATE END-IF END-PROC

Data:

BINDHUBL6007612345 BINDHUBL6007667890 DINESHBL6007709876 DINESHBL6007754321 VASAN JP7521811111 VASAN JP7521866666

Results: NAME STATE ZIP PAY-NET

BINDHU BL 60076 802.35 DINESH BL BL 60077 641.97 1444.32

TOTALS FOR THE STATE OF BL VASAN JP JP 75218 777.77 777.77

TOTALS FOR THE STATE OF JP

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

You might also like