Sei sulla pagina 1di 77

EASYTRIEVE PLUS

Contents
1. Introduction
1.1 Capabilities
File access
Field Definition
Logic process
File Output
Report Output
1.2 Environment.
1.2 General Rules.
2 Structure of Easytrieve programs
2.1 Description of various sections.
2.2 Description of statements.
3 Compilation and Running
3.1 Structure of compilation and run
JCL.
Introduction
 Easytrieve plus is an information retrieval and data
management system
 It is a primitive form of 4GL whose English like
language and simple syntax provide the tools for
easy data retrieval and report generation,
 Easytrieve Plus can now produce reports in HTML
format. This feature allows you to create reports that
can be viewed either from a local disk or LAN or
from a World Wide Web server using the Web
browser
Capabilities
 File access :
 Easytrieve Plus’ file access features all standard retrieval system
capabilities, and also the following :
 Accepts upto 890 input or output files.
 Synchronises file processing (based on keys) of an unlimited
number of files.
 Tests for file availability and current record count.
 Provides search of external & instream files.
 Provides easy method for using temporary files.
 Field Definition:
 Easytrieve Plus’ methods of defining all types of record
structures and field formats are consistent and easy to use, including :
 Defining all field formats, including binary and unsigned packed
fields.
 Providing flexible edit masks.
 Establishing initial values of working-storage fields.
 Providing default report headings .
 Allow multiple use of field definition using COPY keyword,
reducing coding and maintenance.
 Logic Process :
 Easytrieve Plus provides complete conditional logic, including :
 Provides standard programming constructions such as nested IF,
DO WHILE and PERFORM statements.
 Supports move for corresponding fields.
 Sorts on any number of keys.
 File Output :
 Routine file maintenance is faster and simpler because of
Easytrieve Plus’ enhanced capabilities, including :
 Allowing an unlimited number of input and output files.
 Loading and updating files, including VSAM, IMS/DLI, IDMS
and SQL.
 Saving report extract work files for subsequent use.
 Provides a selective hex dump of a file or specific fields.
 Report Output :
 Report generation is the most powerful feature of Easytrieve Plus.
The following features make it widely acceptable to users :
 Produces unlimited reports from a single pass of the data.
 Automatically formats reports.
 Provides customizing alternatives to all report formats.
 Provides control breaks on any number of keys.
 Creates summary reports containing subtotals.
Environment
 Easytrieve Plus operates on the IBM 370, 30xx,
43xx and compatible processors in the DOS/VSE,
OS/VS, MVS/ESA and VM/CMS environments.
 Under TSO, CMS and ICCF, Easytrieve Plus
can run interactively for data inquiry, analysis and
reporting.
 The output can be either returned back to the
screen or routed to a printer.
General Rules
 A colon is used to qualify non-unique field name
 An asterisk in the first column indicates a
comment. No comments are allowed between
continuations lines
 A plus sign indicates that the statement continues
with the first non-blank character in the next
statement area.
Structure of Easytrieve
Program
 Easytrieve Programs have three main
sections :
 Environment Section
 Library Section

 One or more Activity Sections


Environment section
 This section is used for customizing the operating
environment for the duration of program
compilation and execution. This section is
optional and if not specified, a default
environment is set.
 Keyword used in this section : PARM
 Example : PARM LINK (EZTPGM1)
DEBUGGING
 DEBUG parameter of the PARM statement is
used to generate the output which is helpful in
analyzing programming errors
 DEBUG subparameters are
– DMAP - Data definitions for all files and working
storage
– FLDCHK - validates all file/field references
– FLOW - traces statement logic
– STATE - gives statement number of the current
statement executed when abnormal termination occurs
 XREF - produces a cross-reference of field-name,
file-names, procedure-names
 Examples
– PARM DEBUG (DMAP FLDCHK STATE)
LIBRARY SECTION
 The Library section of the program is used to
define all input, output and working storage fields
used in the program
 The FILE statement describes an input or output
file and is coded in the Library section.
 The syntax is
FILE ddname IS [ES] [F]
F lrecl
V maxlrecl+4
U blksize
FB (lrecl blksize)
VB (maxlrecl+4 maxblksize+4)
 Field Definition Statement
 field-name start-location field-length +
 data-type [decimal-positions] +
 [HEADING ‘literal’] +
 MASK ([letter] [BWZ] [‘literal’])
 [VALUE literal] [RESET]
 Field-name
 Field name must be unique within a file.

 The name can be 1 to 40 alphanumeric

characters.
 Special characters can be used, but not

delimiters
 Start-location
 The start location of a filed is the position of
its first character of data relative to the
position of the first character of data in the
record
Defining data structure:

 Type Max. Length


A Alphanumeric 32, 767
N Numeric 18
P Packed 10
U Unsigned Packed 9
B Binary 4
HEADING Parameter

 used to specify an alternative column heading


for a field
 Eg. CL-NAME 5 20 A HEADING +
‘CLIENT NAME’ produces the column heading
as CLIENT NAME
MASK
 An Edit mask is a pattern of characters specifying
how non-alphanumeric data is to be printed.
Alphanumeric fields cannot be edited. An edit
mask is created using combinations of the
following characters:
 9 Formats digits.
 Z Suppresses Leading zeroes
 * Replaces leading zeroes with an asterisk
 - Prints a minus sign prior to the first non-zero
MASK
digit of a negative number

 $ Prints a currency symbol prior to the first non-


zero digit.

 Eg. For Date ‘Z9/99/99’


 For Negative number ‘-,---,9.99'
MASK ([letter] [BWZ] [‘literal’])

Letter is used to name the edit mask that


 follows it. If we name a mask, we can reuse
 it on other field definitions just by specifying
 the name. A name can be any letter from A
 thru Y.

BWZ (Blank When Zero) specifies that a field
 should not be printed if the entire field
 contains zeroes

System Default Masks


PAY 10 5 N 0 -
‘ZZ,ZZZ-’
PAY 10 5 N 2 -
‘ZZZ.99-’
PAY 10 5 N -
‘99999’
REDEFINITION
 Redefinition can be done in the following
 DOB 103 6 N
 MM 103 2 N
 DD 105 2 N
 YY 107 2 N
 Working Storage fields can be defined by

specifying W as the start location


 VALUE option in the field definition statement is
used to initialize the contents of a
working storage field.
 RESET - restores the field to its initial value
whenever JOB or SORT is executed
Activity section
 An activity section can be one of two type : JOB
or SORT
 A JOB activity is where program logic is

coded. It can also contain a REPORT


subactivity which generates the formatted
report
 The SORT activity is simply used to sort the

data before doing other processing


JOB activity
 Syntax:
JOB INPUT (file-name) START proc-name] +
NULL [FINISH proc-name]
SQL
file-name :Automatic input files to the activity.
proc-name :Procedures to run at the start and/or finish of the activity.
– START to identify a procedure to be executed during initiation of
the JOB activity
– FINISH to identify a procedure to be executed during the normal
termination of the JOB activity
Sort activity
 This section is used to sort a data file.
 Syntax:
SORT file-1 TO file-2
USING (field1 [D]…) +
[BEFORE proc-name]
JOB STATEMENT
 It identifies the name of the input file
 Syntax
 JOB INPUT [file-name] +
 [NAME job-name]
 The optional name parameter names the JOB
activity. It can be up to 40 characters long. It can
begin with A-Z or 0-9, it cannot consist of all
numeric characters. This parameter is for
documentation only.
 Processing within a JOB activity is dependent on the
condition (IF) statements in the program
 Syntax
 IF field-one (EQ OR NE OR GT OR GE OR
 LT OR LE) (FIELD TWO OR
LITERAL OR ARITHMETIC
EXPRESSION)
 [Statements executed for true IF]

 [ELSE]
 [Statements executed for false IF]
 [END-IF]
ASSIGNEMENT
STATEMENT
 The Assignment statement establishes a value in a
filed.
Syntax
field-name [INTEGER] [ROUNDED OR
TRUNCATED] EQ field-name-2 or literal or
arithmetic expression
 The are 4 arithmetic operations
 *, /, + and -
 If INTEGER is used with TRUNCATED then
only the INTEGER function is performed.
 INTEGER, ROUNDED and TRUNCATED are
valid only with Numeric fields only
REPORT
 The are two parts to every report subactivity
 REPORT Statement - which specifies the type
and physical characteristics of the report
 Report Definition Statements - which defines
the content of the report
REPORT Statement
 Report Statement is first coded in the report
subactivity
 Syntax
REPORT report-name +
[PAGE SIZE nn] [LINE SIZE nn] +
[SKIP nn] [SPACE nn] [NO ADJUST] +
[NODATE] [NOPAGE] [NOHEADING] +
[LIMIT nn] [EVERY nn]
 PAGESIZE -Lines per page (Default is 58)
 LINESIZE -Length of each line (132)
 SKIP -Number of blank lines to be
inserted between line groups (0)
 SPACE -Number of blank lines inserted
between field columns and between fields and
literals in title and detail lines(3)
 NOADJUST -Requests that the title lines and
report be left-justified on the page. The default is
for the report to be centered on the page
 NODATE -Inhibits printing the date in
positions one through eight of the first title line
 NOPAGE -Inhibits the printing of a page
number.
 NOHEADING-Inhibits the printing of column
headings
 LIMIT -Limits the number of records printed on
the report
 EVERY -Specifies that only every nth line is
printed in the report
Report Definition Statements
 This is the second part of a report subactivity and
these statements define the content of the report.
This has to be coded immediately after the
REPORT statement in the following order
– SEQUENCE
– CONTROL
– SUM
– TITLE
– HEADING
– LINE
SEQUENCE
 This statement allows to specify the order of the data in
the report
 Sequence can be done on any field from input file or any
W working storage field
 Sequence fields are stated in major to minor order
 Sequence order is ascending. Coding D after a field-
name reverses the order for that field only.
Syntax
SEQUENCE field-name-1 [D] …. +
field-name-n [D]
CONTROL
 A CONTROL Statement specifies that a report
should automatically accumulate and print totals.
A control break occurs whenever the value of any
control field changes or end-of-report is reached
 A CONTROL field can be any nonquantitative
field from any input file or working storage field
 At each control break, the totals are printed for the
quantitative fields specified in the report
 Unlimited number of control fields can be
specified.
 Fields are coded on the CONTROL statement in
a major to minor order.
Syntax
CONTROL Field-name NEWPAGE NOPRINT
FINAL RENUM
– Final totals are automatically provided. You can alter
the default by coding FINAL NOPRINT
– NOPRINT following any field-name or FINAL
suppresses the printing of totals at that control break.
 NEWPAGE following any field or FINAL causes
a new page with page numbers beginning at one
after the printing of the control break totals (in
case of final, before the printing of the final
totals)
 RENUM following any field or final causes a
new page with page numbers beginning at one
after the printing of the control break totals (in
case of FINAL before the printing of the final
totals)
SUM
 The SUM statement specifies the quantitative
fields to be totaled for a control report
 Normally easytrieve Plus totals all quantitative
fields specified on the LINE statement, but the
sum statement overrides this process.
 Only the fields specified on the SUM statement
are totalled.
Syntax
SUM quant-field-1 ….. quant-field-n
TITLE STATEMENT
 The TITLE statement allows you to define a title for the
report.
 Up to 99 titles are permitted.

Syntax
TITLE [nn] +/- nn field-name
COL nn literal
 +/-nn is used to alter the normal spacing between
literals or fields on the title lines (nn spaces are added
to or subtracted from the SPACE parameter
 COL nn specifies the print column number where
the next title item is to begin.
 If this option is specified then NOADJUST
should also be specified on the REPORT
statement
 If no TITLEs are coded, the date and page
number are not printed.
HEADING STATEMENT
 The HEADING subactivity OVERRIDES a
HEADING parameter coded in the Library
section
Syntax
HEADING field-name (‘literal’ ….)
Eg. HEADING EMP-NO (‘EMPLOYEE’
‘NUMBER’)
LINE STATEMENT
 The LINE statement defines the content of a
report line.
 LINE 1 is used to designate headings for the
report columns.
Syntax
LINE nn +/-nn field-name
POS nn literal
COL nn
 +/- is used to alter the normal spacing between
line items. nn is added to or subtracted from the
SPACE parameter
 POS is for aligning fields under the
corresponding column heading positions
indicated on the LINE 1 statement.
 COL nn specifies the print column number where
next field is to begin.
TALLY
 TALLY is a system defined field for control
reports.
 It contains the number of detail records printed
within each control break and can be printed on
the report.
 It can only be used in control reports and the
value of TALLY only appears on summary lines.
 Relative start-location
– We can define the start-location of a field relative to a
previously defined position in the record.
– Relatively defining a start-location eliminates the need to
identify the actual start-location of a field
– This is most useful when we create output files
Example
EMP# * 5 N
NAME * 16 A
FILLER1 * 10 N
ADDRESS * 39 A
The ADDRESS field would then start in pos 32 in the
record
 Relative Redefinition
– You can relatively redefine a field by
designating the original field-name as the
starting location for all subsequent fields in the
redefinition
– Example
DOB W 6 N
MM DOB 2 N
DD DOB +2 2 N
YY DOB +4 2 N
The starting position of the redefined field is designated by
using the original field plus the sum of the lengths of all
previous fields used in the redefinition.
STOP STATEMENT
 A STOP statement allows you to terminate an
activity
 Syntax
STOP [EXECUTE]
 STOP ends the current activity and goes on to the
next activity if additional activities are coded.
 STOP EXECUTE immediately terminates all
EASYTRIEVE PLUS execution.
DISPLAY
 A DISPLAY statement sends data to a specified
output file or output device.
 This is commonly used
– For error messages.
– For highlighting reports.
– For hex display of selected information
 Syntax (Format I)
DISPLAY [file-name] NEWPAGE +INTEGER +
SKIP number COL integer
POS integer
literal-1 ….. Literal-n
field-name-1 ….. Field-name-n
 If you specify the file-name, EASYTRIEVE
PLUS prints data to the named file. If file
name is not specified the default is
SYSPRINT/SYSLST (EASYTRIEVE PLUS
output files)
 NEWPAGE option specifies that a skip to a new
page occurs before the data is printed.
 SKIP option specifies that the designated number of
lines are skipped before the data is printed.
 Coding integer modifies the horizontal spacing
between display items.
 The COL integer option specifies the print column
number where EASYP places the next display item.
 The POS integer option on DISPLAY statements
within report procedures causes the next display
item to be positioned under the corresponding
position on LINE 1 statement.
 Syntax (Format II)
DISPLAY [file-name] NEWPAGE HEX field-name
SKIP number file name
 In this format , EASYTRIEVE PLUS produces a
hexadecimal and character dump of the current
record or the specified field-name
 The parameter other than HEX, operate the same
as in Format I
REPORT statement
 Syntax
– REPORT report-name [DTLCTL FIRST]
EVERY
NONE
[SUMCTL HIAR DTLCOPY]
NONE
TAG
[SUMMARY]
[SUMFILE file-name]
[PRINTER file-name]
 DTLCTL determines when control field values
are printed on detail lines :
 FIRST detail line (Default)

 EVERY detail line

 NONE of the detail lines

 SUMCTL determines when control field values


are printed on total summary lines
 HIAR prints all fields from major control to

minor control as far as the breaking field.


This is default.
NONE inhibits printing of control field
values on total lines
TAG prints the control field name and the
literal TOTAL on the left side of the
subtotals
 DTLCOPY print all values from detail lines onto
summary lines
 SUMMARY produces a summary report that
contains only total lines.
 SUMFILE generates a summary file.
 A summary file is a file that contains the
values for all control and summed fields at
each minor break.
 The summary file can be process by
subsequent JOB activities
 Summary file can be requested by defining the
file in the library and then creating it via
REPORT SUMFILE parameter.
VFM
 Virtual File Manager (VFM) provides an easy
method for establishing temporary work files
without special job control or file allocation
statements.
 It is a sequential access method for program work
files
 It dynamically allocates space in memory for
work files when sequencing a report or when
producing multiple reports
 CALL Statement invokes an external subprogram.
 The called program is an existing program in another
language
 Syntax
CALL program-name USING field-name …… +
RETURNS field-name-2
 GOTO or GO TO statement is used to modify the natural
top-to-bottom logic flow in a program
Syntax
GO TO or GOTO label/JOB
A label can be up to 40 characters long and it must be in
the same activity or procedure
FILE PROCESSING
 EASYTRIEVE PLUS process the following file
types
– SAM
– ISAM
– VSAM
– IMS/DLI
– IDMS
 File processing can be done either Automatically
(using JOB or SORT) or programmer controlled
(using GET, PUT, READ, WRITE …)
 The GET Statement retrieves the next record of
the named file into the file input area
Syntax
GET file-name
file-name is input file name
EOF - Test of end-of-file when using the GET
command

 PUT statement outputs a file sequentially


Syntax
PUT outfile [FROM file-name]
File processing fields
 RECORD-LENGTH is a two byte binary field with
zero decimal places used for all file types to
determine or establish the length of the current data
record. For variable length records, this field
contains only the length of the records data
 RECORD-COUNT is a read-only four byte binary
field with zero decimal places which contains the
number of logical I/O operations performed on a file
 FILE-STATUS contains the results of most recent
I/O operations on a file
TABLES
 A table is a collection of uniform data records in
a form suitable for quick reference
– A search argument (keyword ARG) that uniquely
identifies that entry
– A description (Keyword DESC) is the data associated
with the argument
 The user’s objective is to obtain the description
from a table of values based on the search
argument
 A table file must be arranged in ascending order
by argument
 No duplicate arguments can be places in the file
 A minimum of three entries are required in a
table
Syntax
FILE file-name TABLE INSTREAM
literal
– INSTREAM denotes that the table file immediately
follows the file description
 Literal specifies the number of entries in an
external table. Specify a value
here only if the number of entries is greater that
256
 ENDTABLE must be the last entry in the
instream table data
 Instream example
FILE STATTBL TBLE INSTREAM
ARG 1 2 N
DESC 4 15 A
01 ALBAMA
02 ALASKA
03 ARIZONA
ENDTABLE
 SEARCH statement is used to perform an in-core
binary search of a table.
Syntax
SEARCH file-name WITH field-name-1
GIVING field-name-2
Field-name-1 is the name of a field which contains
a value that is compared to the search argument
Field-name-2 is the name of a field into which
the description is places if a match exists between
field-name-1 and the search argument.
Example of an Easytrieve program

FILE PERSNL FB(150 1500)


NAME 17 8 A
EMP# 9 5 N
DEPT 98 3 N
NET 90 4 P 2
GROSS 94 4 P 2
JOB INPUT PERSNL NAME FIRST-PGM
*
REPORT PAY-RPT LINESIZE 80
SEQUENCE DEPARTMENT NAME
CONTROL DEPARTMENT
TITLE 01 ‘PERSONNEL REPORT’
TITLE 02 ‘SECOND TITLE’
HEADING EMP# (‘EMPLOYEE’ ‘NUMBER’)
LINE 01 NAME DEPT EMP# +
GROSS NET
OUTPUT
09/03/01 PERSONAL REPORT PAGE 1
SECOND TITLE
EMPLOYEE
NAME DEPT NUMBER GROSS NET
RAJ 911 01963 445.50 300.00
RAMAN 01234 100.00 100.00
911 545.50 400.00
SUMIT 912 24689 100.00 200.00
912 100.00 200.00
645.50 600.00
Structure of compilation and run JCL
 //jobname accounting info
 //STEPNAME EXEC PGM=EZTPA00,REGION=300K
 //SYSPRINT DD SYSOUT=*
 //SYSLIN DD DSN=obj-module-dsn,DISP=…
 //SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,1)
 //EZTVFM DD UNIT=SYSDA,SPACE=(CYL,1)
 //userfile DD dd-parms
 //SYSIN DD DSN=program-ds,DISP=SHR
Thank You

Potrebbero piacerti anche