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

EZT+

Embed Size (px)

Citation preview

Page 1: EZT+

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

Page 2: EZT+

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.

Page 3: EZT+

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.

Page 4: EZT+

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.

Page 5: EZT+

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.

Page 6: EZT+

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.

Page 7: EZT+

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.

Page 8: EZT+

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.

Page 9: EZT+

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

Page 10: EZT+

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

Page 11: EZT+

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.

Page 12: EZT+

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

Page 13: EZT+

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

Page 14: EZT+

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

Page 15: EZT+

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

PARM LINK (MYPRG(R))*--Library SectionFILE Infile FB(1000 0) in-rec 1 1000 A Emp-key 4 9 A Emp-name 30 30 A

FILE Outfile FB(1000 0) Out-Rec 1 1000 A

total-in W 5 N Value +0total-out W 5 N 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 + 1GOTO JOB

Page 16: EZT+

First-proc. PROC total-in = 0

total-out = 0DISPLAY “Copy Job Started”

END-PROC

last-proc. PROCDISPLAY “COPY JOB END”DISPLAY “ Input Recors “ total-inDISPLAY “Output Records” total-out

END-PROC

Page 17: EZT+

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

Logic codeEND-PROC

Page 18: EZT+

RULES of USAGE for PROCS1. PERFORM statement is used to call a PROC. Syntax : PERFORM procname2. 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 )

Page 19: EZT+

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

Page 20: EZT+

EXAMPLES :

FILE infilein-rec 1 1000 Aemp-id 4 9 Aemp-name 25 30 A

FILE zipcode VS UPDATEzip-key 1 5 Azip-value 6 5 A

VSAM-KEY W 5 A

Page 21: EZT+

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.

Page 22: EZT+

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.

Page 23: EZT+

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.

Page 24: EZT+

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 W 5 N Value +0 MASK ‘ZZZZZ9’

amount W 4 P 2 Mask ‘$$$$9.99’

*-- DEFINE is not required in Library section

Page 25: EZT+

DATA FORMATSA - Alphabetic or AlphanumericN - Zoned DecimalB - Binary P - Packed DecimalU - Unsigned Packed Decimal

Maximum Size Permitted for each data format

Data Code Maximum Length Decimal Pos.

A 32,767 NAB 18 0 - 18 N 10 0 - 18 P 4 0 - 18 U 9 0 - 18

Page 26: EZT+

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

Page 27: EZT+

VARIOUS I/O COMMANDS

Manual FILE Handling ...

OPEN , CLOSE

GET , PUT

DISPLAY , PRINT

STOP

VSAM FILE HANDLING

READ

WRITEPOINT

Page 28: EZT+

*-- Copy a File , Without using Automatic File Processing of Job ActivityPARM LINK ( MYPGM(R))

*-------Library SectionFILE infile FB (1000 0)in-rec 1 1000 Ain-emp-key 4 9 Ain-emp-name 14 30 A

FILE outfile FB(1000 0)Out-rec 1 1000 A

JOB INPUT NULL START firstproc FINISH lastprocGET infileIF NOT EOF infile

outrec = inrecPUT outfile

elseSTOP

end-if

GOTO JOB

Page 29: EZT+

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

Page 30: EZT+

DATA TRANSFER /CONTROL FLOW STATEMENT

• Assignment Statement

• MOVE Statement

• GOTO Statement

• IF Statement

• DO While

• DO Untill

• CASE Statement

• STOP Statement

• PERFORM

• EXIT

Page 31: EZT+

VSAM FILE PROCESSING

USE OF READ

Example ProgramFILE infile in-rec 1 100 Ain-SSN 1 9 Ain-name 11 30 Ain-comp-code 50 5 A

FILE outfileout-rec 1 100 Aout-addr 55 30 A

FILE vsfile VS comp-code 1 5 Acomp-addr 6 30 A

vs-key W 5 A Value ' '

Page 32: EZT+

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 = 16DISPLAY ' RECORD not found’ DISPLAY ‘ key = ' vs-key

ELSEPERFORM ABEND-ROUTINE

END-IF END-IF

PUT outfileGOTO JOB

Page 33: EZT+

firstproc. PROC OPEN outfileEND-PROC

lastproc. PROC CLOSE outfileEND-PROC

Page 34: EZT+

USE of POINT

POINT vsfilename = keyvalue STATUSor POINT filename > keyvalue STATUS IF FILE-STATUS = 0 --- we got it ----- ELSE IF FILE-STATUS = 16

---- record not found ----END-IF

END-IF

Page 35: EZT+

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 inat current position in VS FILE.

WRITE filenme DELETE It will delete current record from VSAM file.

WRITE filename UPDATE FROM filename2

Page 36: EZT+

Varying Length fields

The VARYING parameter on the DEFINE statement designates varying length fields.

FLDA W 250 A VARYING

w 2 B 0 for length 2byte w 248 A for DataVarying means the length of data in this field is for each

occurrence in separate record is unique.

Varying lengths field are Alphanumeric

Page 37: EZT+

SORT

Syntax : Sort Input file-name TO sorted-file-name NAMEUSING ( Sort Key field/s )

SIZE Record-count Optional

Before Proc Name Optional

Can sorted file name is same as that of input file name. Using - keyword specifies key’s 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

Page 38: EZT+

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

This will be deleted at EOJ

Page 39: EZT+

SAMPLE REPORT

FILE EMPFILERSSNUM 1 9 N

F-NAME 10 8 A

L-NAME 18 10 A

DEPT 28 5 A

SALARY 62 5 N 0

FILE SALSORTCOPY EMPFILER

SORT EMPFILER TO SALSORT +

USING (DEPT SALARY D)

JOB INPUT SALSORT NAME SALARY

Page 40: EZT+

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

Page 41: EZT+

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

Page 42: EZT+

SAMPLE REPORT

FILE EMPFILER - ‘section ?? ‘F-NAME 10 8 A HEADING 'FIRST NAME'

L-NAME 18 10 A HEADING 'LAST NAME'

DEPT 28 5 A HEADING + 'DEPARTMENT'

PAY-GRADE 44 2 N

TOTAL-VAC 71 2 N 0

USED-VAC 73 2 N 0 HEADING ('VACATION’ + 'USED')

NEW-VAC W 2 N 0 HEADING ('NEW’ +'TOTAL' 'VACATION')

VAC-REMAIN W 2 N 0 HEADING ('VACATION’+ 'REMAINING')

Page 43: EZT+

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

Page 44: EZT+

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 + VAC-REMAIN

Page 45: EZT+

REPORT WRITING

Report section begins with a REPROT statement.Syntax:- REPORT Report Name

Report Definition Statements SEQUENCE CONTROL SUM TITLE HEADING LINE

Page 46: EZT+

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.

Page 47: EZT+

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

Page 48: EZT+

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

Page 49: EZT+

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

Page 50: EZT+

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’

Page 51: EZT+

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

Page 52: EZT+

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.

Page 53: EZT+

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

Page 54: EZT+

LINE cont.….

Example: LINE SSNUM F-NAME L-NAME DEPT SALARY

Example: LINE DEPT L-NAME ??TITLE??LINE 2 POS 2 WORK-PHONELINE 3 POS 2 P.O. BOX

Page 55: EZT+

6/4/99 EMPLOYEE LOCATION/PHONE?PAGE?

DEPT L-NAME

------spaces------

IT Munish

255374730

B234

IT Prashanth

277895432

A345

Page 56: EZT+

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

Page 57: EZT+

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

Page 58: EZT+

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.

Page 59: EZT+

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

Page 60: EZT+

Code One of more proc right after the a REPORT section LINE statement, Each of these PROC’s 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.

Page 61: EZT+

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 data’s are bypassed for continued processing.

Page 62: EZT+

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.

Page 63: EZT+

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.

Page 64: EZT+

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

Example

Page 65: EZT+

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.

Page 66: EZT+

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

Example

Page 67: EZT+

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

Page 68: EZT+

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