Professional Documents
Culture Documents
Introduction EZTRIEVE PLUS is an information retrieval and data management system designed to simplify computer programming. Its English like language and simple declarative statements provide the tools to produce comprehensive reports with ease while its enhanced. facilities provide the capability to perform complex programming tasks. IN OTHER TERMS EASYTRIEVE PLUS is user-friendly, allowing you to retrieve and manage data using simple, English-like statements. It can both process data and create formatted reports without resort to complicated programming languages.
Capabilities
File Processing
Accepts any number of input files. Processes SAM, ISAM, VSAM or IMS/DLI files. Allows fixed, variable, undefined, or spanned record formats. Processes data in alphabetic, numeric, packed, packed-unsigned or binary formats. Searches files and performs logical data selection based on input or calculations. Matches an unlimited number of files. Creates subfiles containing selected records from a master file.
CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht 4
Operations
Performs computations through user logic, including percentages, averages and others
Sorts on any number of keys EZTRIEVE does not have its own sort. It exits to the sort installed at the facility its running on. In our case, it exits to SYNCSORT. Calls programs and subroutines written in other languages and integrates them into the job
Output
Outputs any number of files or reports on one pass of the input file
Structure
Program Structure
Environment Section
Optional If used, must be first section and includes only one statement (PARM) The Environment Section allows user to override system default. It is seldom used.
Library Section
Also called Data Definition Section Describes data fields and usually necessary for file processing and report generation Contains file and field definitions as well as working storage fields
10
Activity Definition
Contains the Program logic JOB statement SORT statement PROC/END-PROC statements REPORT statements
11
1 30 A 31 15 A 46 2 A 48 5 N
12
Syntax
13
File Statement
FILE <filename>
filename is 1 - 8 characters must begin with alphabetic character (A - Z) other positions can be alphabetic (A-Z), numeric (0-9) or national (@, #, $) filename matches the DD name in the JCL
14
15
Field Definition
DEFINE <fieldname>
16
Field Definition -
<fieldname>
Sample fieldname
FLDA POLICY-NUMBER POLICY-NUMBER-X BENEFICIARY-1 BENEFICIARY1
CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht 17
Sample <startpos>
FIELD-A FIELD-B FIELD-C FIELD-D 1 10 A 11 6 N * 2 A 45 4 P 2
18
Sample length
FIELD-A FIELD-B FIELD-C FIELD-D 1 10 A 11 6 N * 2 A 45 4 P 2
19
Sample type
FIELD-A FIELD-B FIELD-C FIELD-D 1 11 * 45 10 6 2 4 A N A P 2
20
Field Types
A - Alphanumeric N - Numeric, Zoned Decimal
(xF1F2F3F4F5)
21
22
Sample decimals
FIELD-A FIELD-B FIELD-C FIELD-D 1 11 * 45 10 6 2 4 A N A P 0 2
23
Decimal Positions
Data Type A N P U B Max Lgth 254 18 10 9 4 Decimal Positions Not Valid 0 - 18 0 - 18 0 - 18 0 - 10
24
OR.....
FILE INFILE
NAME CITY STATE ZIP 1 30 A 31 15 A 46 2 A 48 5 N
25
Activity Definition
This section is where the logic of the program is defined Simple programs which read a file and print a report wont have much in the activity section. In fact, there could only be ONE statement required!
26
Reading Files
EZTRIEVE PLUS will automatically read a file without explicit instructions to do so
The automatic file processing feature handles EOF situations. No need to code EOF logic in most cases.
27
28
29
Redefining Fields
1 1 11 19
19 10 8 1
A A A A
30
A A A A
In this case, LAST-NAME starts at the beginning of FULL-NAME. FIRST-NAME starts in the 11th byte of FULL-NAME (at a displacement of +10 starting at zero).
31
32
VALUE parameter
Initializes the contents of a field in working storage Added to the DEFINE statement Default value of alphanumeric field is space Default value of numeric field is zero Cannot be used on an overlay redefinition (redefinition by listing a specific field) unless the original definition is an alphanumeric field
33
VALUE parameter-contd
If alphanumeric value, must be enclosed in single quotes EXAMPLE: NAME AMOUNT
10 30
34
ASSIGNMENTS
The assignment statement is a JOB activity which establishes a value for a field
Can be a copy of the data in another field, can be a literal, or can be the result of an arithmetic operation The result is converted to the format of the receiving field EXAMPLES FIELD-A = FIELD-A = WS-AMT = NET-AMT =
35
36
MOVE Statement
MOVE transfers character strings from one location to another This is always an alphanumeric move meaning the move will be done left to right No format conversions performed Number of characters moved depends on the length of the shorter field Unless specified, no padding occurs Recommend using ASSIGNMENT (EQ) instead of MOVE when possible
37
38
39
After TRUCK
After CARCK
40
41
IF / END-IF
Controls the execution of associated statements which occur between the IF and the END-IF statements END-IF is required for each IF
42
IF / ELSE / END-IF
Allows for the different processing when the conditional statement is FALSE
43
More on the IF
IF statements can be nested Each IF must have corresponding END-IF Recommend indentation of nested IFs for readability Can use logical connectors AND or OR
44
Imbedded IF Example
IF condition1 IF condition2 statement(s) ELSE statement(s) END-IF END-IF
45
DO WHILE / END-DO
Allows for automated looping DO must have corresponding END-DO The statements following the DO WHILE are executed when the condition is TRUE DO Whiles can be nested
Conditional Expressions
Used as parameters of the IF and DO WHILE statements Offer an alternative to normal top-to-bottom execution Evaluated by asking Is this condition TRUE?
47
48
49
IF HOURS-WORKED > 40 IF TOTAL-COMM-AMT < (COMM-AMT * .5) Remember, each IF must end with an END-IF
50
Equal Not Equal Less Than Less Than or Equal Greater Than Greater Than or Equal
^< ^<
As always, be careful when using AND or OR with negative operators (i.e. NE)
51
52
53
54
55
56
57
58
Reporting
59
Reporting
Printing a Report
If input fields are reported, there is no need to move fields from the input record to a print line Simply give the report a logical name
60
Reporting
61
Reporting
JOB
PRINT RPT1
62
Reporting
REPORT Activity
The description of a report is considered a sub-activity. The REPORT statement describes the characteristics of the report.
63
Reporting
64
Reporting
REPORT Statement
REPORT rptname REPORT is a keyword that must be present rptname is a user defined variable and corresponds to the PRINT statement in the logic portion of the activity section
65
Reporting
Report Titles
May specify up to 99 title lines Automatically centers each line on the page (can be manually controlled with default overrides)
66
Reporting
TITLE Statement
TITLE literal1 TITLE 2 literal2 TITLE 3 literal3 TITLE (TITLE 2, etc) are keywords and are required literal1 (literal2, etc.) are user defined and can be as wide as the report (up to 132 characters)
67
Reporting
68
Reporting
Detail Lines
May specify up to 99 detail lines Fields and literals are printed in the order they are specified on the LINE statement Length of each field reserved on the report is determined by the larger of the field size or the column heading Default is to automatically place 3 spaces between each field on the line
69
Reporting
70
Reporting
LINE Statement
LINE field/literal LINE 2 field/literal LINE 3 field/literal LINE (LINE 2, etc) are keywords and are required field can be fields from the input record, calculated fields or working storage fields literal can be any literal value
71
Reporting
72
Reporting
73
Reporting
74
Advanced Reporting
75
Advanced Reporting
Column Headings
Defaults to the field name Can be overridden on the DEFINE statement Can be overridden in the REPORT sub-activity section
76
Advanced Reporting
77
Advanced Reporting
Sample HEADING - I
POLICY-NUMBER 1 15 A HEADING (POL NUM)
Replaces the literal POLICY-NUMBER as a column heading with one line heading POL NUM
78
Advanced Reporting
Sample HEADING II
POLICY-NUMBER 1 15 A HEADING (POL NUM)
Replaces the literal POLICY-NUMBER as a column heading with a two line heading POL NUM
79
Advanced Reporting
80
Advanced Reporting
More on HEADINGS
If specified on the DEFINE statement and in the REPORT area, the definition in the REPORT area overrides the one on the DEFINE statement.
81
Advanced Reporting
82
Advanced Reporting
83
Advanced Reporting
More on SEQUENCE
SEQUENCE defaults to ascending sort order To specify descending sequence, code a D after the appropriate field (note A can be specified for ascending, but is not necessary)
84
Advanced Reporting
85
Advanced Reporting
CONTROL Statement
Use the CONTROL statement when you want to add the values in columns or want to perform control breaks on a field(s) CONTROL statement immediately follows the SEQUENCE statement, if coded, otherwise it will follow the REPORT statement
86
Advanced Reporting
87
Advanced Reporting
88
Advanced Reporting
CONTROL BREAKS
Control breaks occur whenever the value of any control field changes or when EOF occurs The CONTROL statement coded by itself will produce only final totals. Add control fields to the CONTROL statement when you want subtotals.
89
Advanced Reporting
90
Advanced Reporting
91
Advanced Reporting
92
Advanced Reporting
This example will produce 2 levels of sub-totals (COMPANY and PLAN-CD) and grand totals when EOF is reached
93
Advanced Reporting
Counting Records
Use the TALLY command on the LINE statement Report sub-activity must include the CONTROL statement (with or without any control fields)
94
Advanced Reporting
This example will provide a record count at the end of the report
95
File Processing
96
File Processing
EASYTRIEVE can process all sorts of files and databases including : Sequential VSAM IMS/ DLI IDMS SQL Processing can be either automatic or controlled. Automatic EZT + controls input through the JOB and SORT statement Controlled through the Programmer Codes Input / Output Statement such as GET , PUT , POINT , READ and WRITE
97
File Processing
JOB statement
JOB INPUT < file name > NAME < job name> The job statement performs sequential processing of <file name > Ezetrieve handles the opening and closing of files.It performs several tasks as : - validates block length - allocates buffer areas - allocates work areas - closes the file at the end of each activity. JOB INPUT NULL NAME Control-Input NULL indicates that there is no automatic input and all file processing will be controlled.
CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht 98
File Processing
Controlled Processing is necessary when one needs to a. Access data from more than one input file. b. Randomly access VSAM or database file. Controlled Processing is not allowed for a file that has already been defined as an automatic input file.
99
File Processing
GET statement
GET < file name > STATUS This statement reads the next record of the file. One must test for end-of-file (EOF) and code the STOP statement , else the program will execute forever. STOP / STOP < execute> Some FILE-STATUS values are
0 4 16 operation performed successfully end-of-file during a GET record not found during a READ.
100
File Processing
PUT statement
PUT < file name > from <file name2> This statement writes data onto an output file from an input file. It can also be used to write data onto the file directly. The FROM Parameter is equivalent to coding a MOVE statement prior to the PUT statement.
101
File Processing
READ statement
READ < file name > KEY <field-name> STATUS Used to randomly access a VSAM File. It returns STATUS Codes which , should be handled in the Code. The KEY Parameter indicates the field name to be used while searching for a corresponding record.
102
File Processing
POINT statement
POINT < file name > operator <field-name> STATUS Used to set a position within a VSAM file from where sequential processing can begin.
Data can be retrieved either via Automatic File input or with a GET statement.
The relational operator can specify an exact match with an equal operator (EQ or = ) or can be a Greater than or equal to operator (GE or >=).
103
File Processing
WRITE statement
WRITE < file name > (UPDATE/ADD/DELETE) <from file name> STATUS Used to update a VSAM File.
104
THANK YOU
HAVE FUN!!
105