You are on page 1of 105

Basic Eztrieve Plus

CSC Proprietary 11/19/2012 5:16:21 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:21 AM 008_fmt_wht

Capabilities

CSC Proprietary 11/19/2012 5:16:21 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

Output
Outputs any number of files or reports on one pass of the input file

Formats output with all totals calculated internally


Provides summary reports and output files with no limits on the number & size of control fields Allows page and line sizes to vary as needed by overriding default values

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

Structure

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

Program Structure

Generally an Eztrieve Programs contains 3 Parts


Environment Definition
Library Section Activity Definition

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

10

Activity Definition
Contains the Program logic JOB statement SORT statement PROC/END-PROC statements REPORT statements

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

11

Sample Program A First Look


FILE INFILE VS NAME CITY STATE ZIP JOB PRINT RPT1 REPORT RPT1 TITLE CSC FSG TITLE 2 BASIC EZTRIEVE TRAINING TITLE 3 SAMPLE REPORT TITLES LINE NAME CITY STATE ZIP

1 30 A 31 15 A 46 2 A 48 5 N

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

12

Syntax

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

14

File Statement Contd.

FILE statement (VSAM)


FILE filename VS if VSAM file, must add the VS parameter to the end of the FILE statement

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

15

Field Definition

DEFINE <fieldname>

<startpos> <length> <type> <decimals>

keyword DEFINE is optional

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

16

Field Definition Contd.

Field Definition -

<fieldname>

DEFINE fieldname startpos length type decimals


fieldname can be 1 - 40 characters must begin with alphabetic character (A-Z) other positions can be alphabetic (A-Z), numeric (0-9) Can contain dashes (-) to separate words

Sample fieldname
FLDA POLICY-NUMBER POLICY-NUMBER-X BENEFICIARY-1 BENEFICIARY1
CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht 17

Field Definition Contd.

Field Definition <startpos>


DEFINE fieldname startpos length type decimals
startpos is the actual position in the record where the field begins can use * to specify that one field immediately follows another

Sample <startpos>
FIELD-A FIELD-B FIELD-C FIELD-D 1 10 A 11 6 N * 2 A 45 4 P 2

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

18

Field Definition Contd.

Field Definition <length>


DEFINE fieldname startpos length type decimals
length is the number of bytes (positions) required to store the field a 7-byte numeric field which is packed has a length of 4, not 7

Sample length
FIELD-A FIELD-B FIELD-C FIELD-D 1 10 A 11 6 N * 2 A 45 4 P 2

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

19

Field Definition Contd.

Field Definition - <type>


DEFINE fieldname startpos length type decimals
type determines the format of the field and what kind of data it can hold

Sample type
FIELD-A FIELD-B FIELD-C FIELD-D 1 11 * 45 10 6 2 4 A N A P 2

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

20

Field Definition Contd.

Field Types
A - Alphanumeric N - Numeric, Zoned Decimal
(xF1F2F3F4F5)

P - Numeric, Packed Decimal


(x12345F)

U - Numeric, Unsigned Packed Decimal


(x012345)

B - Numeric, Signed Binary


(x3039)

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

21

Field Definition Contd.

Field Definition - <decimals>


DEFINE fieldname startpos length type decimals
decimals optionally defines the number of decimal positions required for the field number of decimals available is determined by the field type

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

22

Field Definition Contd.

Field Definition - <decimals>


numeric fields with decimal places are considered signed numeric fields without decimals assumes zero decimal places

Sample decimals
FIELD-A FIELD-B FIELD-C FIELD-D 1 11 * 45 10 6 2 4 A N A P 0 2

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

23

Field Definition Contd.

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

24

Library Section Review


FILE INFILE
DEFINE NAME DEFINE CITY DEFINE STATE DEFINE ZIP 1 30 A 31 15 A 46 2 A 48 5 N

OR.....
FILE INFILE
NAME CITY STATE ZIP 1 30 A 31 15 A 46 2 A 48 5 N

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

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!

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

27

Working Storage Fields


Used for fields not on a file record (i.e. calculated fields, indicators, etc.)

Defined with a DEFINE statement


Same as other DEFINE statements except there is no starting location. Code a literal W instead to indicate the field is a work field

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

28

Working Storage Fields Contd..


Usually coded after all file and record definitions and before the JOB statement

Example: GROSS-PAY W 6 P 2 INDICATOR1 W 1 A

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

29

Redefining Fields

Redefining Fields in a Record


Specify another DEFINE statement with the appropriate starting location, length and type. EXAMPLE 1: FULL-NAME LAST-NAME FIRST-NAME MIDDLE-INIT

1 1 11 19

19 10 8 1

A A A A

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

30

Redefining Fields Contd..

Redefining Working Storage Fields


Refer back to the field being redefined since theres no starting location EXAMPLE 1: FULL-NAME LAST-NAME FIRST-NAME MIDDLE-INIT

W 19 FULL-NAME 10 FULL-NAME +10 8 FULL-NAME +18 1

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

31

Assigning Values to Fields Three ways to place a value in a field


VALUE parameter of DEFINE statement Assignment in the JOB activity area MOVE statement in the JOB activity area

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

32

Assigning Values to Fields

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

CSC Proprietary 11/19/2012 5:16:22 AM 008_fmt_wht

33

Assigning Values to Fields

VALUE parameter-contd
If alphanumeric value, must be enclosed in single quotes EXAMPLE: NAME AMOUNT

10 30

20 A VALUE SMITH 8 N VALUE 1000

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

34

Assigning Values to Fields

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 =

FIELD-C TRUCK 123.45 GROSS-AMT - PENALTIES

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

35

Assigning Values to Fields

Notes for ASSIGNMENT


Alphabetic fields are left justified and padded with spaces, if necessary Truncation, if required, will occur to the rightmost characters Numeric fields are decimal aligned and padded with zeroes on either side of the decimal as appropriate The value EQ can be substituted for the equal sign (=)

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

36

Assigning Values to Fields

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

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

37

Assigning Values to Fields

Sample MOVE statements


MOVE FIELDA TO FIELDB Before 1) FIELDA ABC123 FIELDB bbbbbb 2) FIELDA ABC12 FIELDB XXXXXX 3) FIELDA ABC12 FIELDB XXXX

After ABC123 ABC123 ABC12 ABC12X ABC12 ABC1

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

38

Assigning Values to Fields

Sample MOVE different formats


MOVE FIELDA TO FIELDB Before 1) FIELDA X12345F FIELDB XF0F1F2 2) FIELDA X123F FIELDB X404040 3) FIELDA X12345F FIELDB X1234

After X12345F XF0F1F2 X123F X123F40 X12345F X1234

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

39

Assigning Values to Fields

One More Sample - MOVE


MOVE TRUCK TO FIELDB Before FIELDB bbbbbb MOVE CAR TO FIELDB Before FIELDB TRUCK

After TRUCK

After CARCK

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

40

Decision and Branching Logic

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

41

DECISION and BRANCHING LOGIC

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

IF conditional-expression statement(s) END-IF

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

42

DECISION and BRANCHING LOGIC

IF / ELSE / END-IF
Allows for the different processing when the conditional statement is FALSE

IF conditional-expression statement(s) ELSE statement(s) END-IF

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

43

DECISION and BRANCHING LOGIC

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

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

44

DECISION and BRANCHING LOGIC

Imbedded IF Example
IF condition1 IF condition2 statement(s) ELSE statement(s) END-IF END-IF

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

45

DECISION and BRANCHING LOGIC

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

DO WHILE conditional-expression statement(s) END-DO


CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht 46

DECISION and BRANCHING LOGIC

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?

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

47

DECISION and BRANCHING LOGIC

Common Condition types


Field Relation Condition Field Series Condition Field Class Condition File Presence Condition (not covered in this class)

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

48

DECISION and BRANCHING LOGIC

Field Relation Condition


Compares the value of a field to the value of another field, literal or arithmetic expression The two values are separated by an operator Alpha literals must be enclosed in apostrophes.

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

49

DECISION and BRANCHING LOGIC

Field Relation Examples


IF FIELD-A IF PAY-TYPE = = FIELD-B HOURLY

IF HOURS-WORKED > 40 IF TOTAL-COMM-AMT < (COMM-AMT * .5) Remember, each IF must end with an END-IF

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

50

DECISION and BRANCHING LOGIC

Valid Relational Operators


Operator Values = EQ ^= NE NQ < LT LS <= LE LQ > GT GR >= GE GQ

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)

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

51

DECISION and BRANCHING LOGIC

Field Series Conditions


Compares a field and a series of values Subject field is compared to a range of values Alphanumeric comparisons are made bit-by-bit, left-to-right Only EQUAL and NOT EQUAL operators can be used in a Field Series comparison

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

52

DECISION and BRANCHING LOGIC

Field Series Examples


IF HOURS-WORKED = 1 THRU 40 IF DEPARTMENT = AA THRU BC IF COMPANY-CODE = XXX YYY IF GROSS-PAY = 1.00 THRU MAX-FOR-BONUS

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

53

DECISION and BRANCHING LOGIC

Field Class Condition


Used to determine whether ALL positions of a field contain alphabetic, numeric, space or zero characters

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

54

DECISION and BRANCHING LOGIC

Field Class Example - NUMERIC


IF HOURS-WORKED NUMERIC The field is tested for digits 0 through 9 in the correct format for the fields defined type (i.e. alphanumeric, numeric, packed, etc.) In the case of data types N and P, the low-order position is tested for a valid sign

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

55

DECISION and BRANCHING LOGIC

Field Class Example - ZERO


IF HOURS-WORKED ZERO ZERO, ZEROS or ZEROES valid Field is tested for a zero character in the correct format for the fields definition (same as NUMERIC check)

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

56

DECISION and BRANCHING LOGIC

Field Class Example - ALPHABETIC


IF FIRST-NAME ALPHABETIC Each byte of the field is tested for the letters A through Z or a space.

CSC Proprietary 11/19/2012 5:16:23 AM 008_fmt_wht

57

DECISION and BRANCHING LOGIC

Field Class Example - SPACES


IF FIRST-NAME SPACES SPACE or SPACES valid Each byte of the field is tested for a space (x40)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

58

Reporting

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

60

Reporting

Printing a Report - Contd


PRINT rptname PRINT is a keyword rptname is a user defined variable (up to 40 characters) and cannot be an EZTRIEVE reserved word (like REPORT or LINE)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

61

Reporting

Build onto Library Section


FILE INFILE
NAME CITY STATE ZIP 1 30 A 31 15 A 46 2 A 48 5 N

JOB
PRINT RPT1

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

62

Reporting

REPORT Activity
The description of a report is considered a sub-activity. The REPORT statement describes the characteristics of the report.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

63

Reporting

REPORT Activity - Contd


The REPORT statement has many parameters, but each has default and none are required Multiple reports can be printed with a single pass of the file. Need separate REPORT statements and must specify PRINT statement for each.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

67

Reporting

Sample TITLE Statements


TITLE CSC FSG TITLE 2 BASIC EZTRIEVE TRAINING TITLE 3 SAMPLE REPORT TITLES

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

69

Reporting

Detail Lines - Contd


Unless specified otherwise, the field name is used as the column heading on the report Line is automatically centered on the page

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

71

Reporting

Sample LINE Statements


LINE NAME LINE 2 CITY , STATE ZIP LINE 3

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

72

Reporting

Put it Together - A Second Look


FILE INFILE NAME 1 30 A CITY 31 15 A STATE 46 2 A ZIP 48 5 N JOB PRINT RPT1 REPORT RPT1 TITLE CSC FSG TITLE 2 BASIC EZTRIEVE TRAINING TITLE 3 SAMPLE REPORT TITLES LINE NAME CITY STATE ZIP

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

73

Reporting

Sample with multiple reports


JOB PRINT DETAIL-RPT PRINT SUMMARY-RPT REPORT DETAIL-RPT TITLE CSC FSG TITLE 2 DETAIL RPT LINE ......... REPORT SUMMARY-RPT SUMMARY TITLE CSC FSG TITLE 2 SUMMARY RPT LINE .........

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

74

Advanced Reporting

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

76

Advanced Reporting

HEADING Parm on the DEFINE statement


fieldname startpos length type decimals HEADING (literal) Coded after the field definitions Keyword HEADING is required Literal value placed in single quotes

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

79

Advanced Reporting

HEADING parm in the REPORT sub-activity


REPORT <rptname> TITLE literal1 HEADING fieldname (literal) LINE fields/literals Coded after the TITLE lines If coded here, must specify the field name

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

81

Advanced Reporting

SEQUENCING detail lines


Use the SEQUENCE statement when you want a report sorted in a particular sort order SEQUENCE statement immediately follows the REPORT statement Specify sort fields in highest to lowest order

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

82

Advanced Reporting

Sample SEQUENCE statement


REPORT ...... SEQUENCE PLAN-CODE POLICY-NUM TITLE ..... LINE ....... This example will report records by POLICY-NUM within PLAN-CODE

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

84

Advanced Reporting

Another Sample SEQUENCE


REPORT ...... SEQUENCE PLAN-CODE POLICY-NUM D TITLE ..... LINE ....... This example will report records by descending POLICY-NUM within ascending PLAN-CODE

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

86

Advanced Reporting

CONTROL - Column Totals


Automatically totals all numeric quantitative fields (any field defined with decimal places). Because of this, be careful about specifying a decimal value (even 0) on field such as Social Security Number unless you want it totaled, too.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

87

Advanced Reporting

Sample CONTROL statement


REPORT ...... SEQUENCE PLAN-CODE POLICY-NUM CONTROL TITLE ..... LINE ....... This example will report records by POLICY-NUM within PLANCODE and will add up any column specified on the LINE statement which is defined with decimal places

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

89

Advanced Reporting

CONTROL BREAK notes


You should always sort the records with a SEQUENCE statement to make control breaks work properly. Control fields are generally specified in the same order as they are sorted

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

90

Advanced Reporting

More CONTROL BREAK notes


The format of the report will vary slightly when using control breaks. The control field(s) is only printed on the first detail line of the group, not on every line This default can be changed (not covered in this class)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

91

Advanced Reporting

More CONTROL BREAK notes


Multiple control fields can be specified by adding additional fields on the CONTROL statement Quantitative fields can not be used as control break fields

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

92

Advanced Reporting

Another Sample CONTROL statement


REPORT ...... SEQUENCE COMPANY PLAN-CD POLICY CONTROL COMPANY PLAN-CD TITLE ..... LINE .......

This example will produce 2 levels of sub-totals (COMPANY and PLAN-CD) and grand totals when EOF is reached

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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)

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

94

Advanced Reporting

Sample TALLY statement


REPORT RPT1 SEQUENCE PLAN-CODE POLICY-NUM CONTROL TITLE ..... LINE PLAN-CODE POLICY-NUM TALLY

This example will provide a record count at the end of the report

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

95

File Processing

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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.

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

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

CSC Proprietary 11/19/2012 5:16:24 AM 008_fmt_wht

103

File Processing

WRITE statement
WRITE < file name > (UPDATE/ADD/DELETE) <from file name> STATUS Used to update a VSAM File.

CSC Proprietary 11/19/2012 5:16:25 AM 008_fmt_wht

104

Basic Eztrieve Plus

THANK YOU

HAVE FUN!!

CSC Proprietary 11/19/2012 5:16:25 AM 008_fmt_wht

105

You might also like