Download - Ezetrieve Presentation Version 1.0
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 1
Basic Eztrieve Plus
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 2
•EZTRIEVE PLUS is an information retrieval and data management system designed to simplify computer programming. It’s English like language and simple declarative statements provide the tools to produce comprehensive reports with ease while it’s enhanced. facilities provide the capability to perform complex programming tasks.
Introduction
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 04/08/23 12:37 AM 008_fmt_wht 3
Capabilities
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 4
• 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.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 5
• Performs computations through user logic, including percentages, averages and others
• Sorts on any number of keys
EZTRIEVE does not have it’s own sort. It exits to the sort installed at the facility it’s running on. In our case, it exits to SYNCSORT.
• Calls programs and subroutines written in other languages and integrates them into the job
Operations
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 6
• 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
Output
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 7
Structure
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 8
Generally an Eztrieve Programs contains 3 Parts
• Environment Definition
• Library Section
• Activity Definition
Program Structure
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 9
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 04/08/23 12:37 AM 008_fmt_wht 10
• 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
Library Section
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 11
Contains the Program logic
• JOB statement
• SORT statement
• PROC/END-PROC statements
• REPORT statements
Activity Definition
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 12
FILE INFILE VS
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
Sample Program – A First Look
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 13
Syntax
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 14
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
File Statement
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 15
FILE statement (VSAM)
FILE filename VS
• if VSAM file, must add the VS parameter to the end of the FILE statement
File Statement Contd.
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 16
DEFINE <fieldname> <startpos> <length> <type> <decimals>
• keyword DEFINE is optional
Field Definition
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 17
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”
Field Definition Contd.
Sample fieldname
FLDAPOLICY-NUMBERPOLICY-NUMBER-XBENEFICIARY-1BENEFICIARY1
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 18
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
Field Definition Contd.
Sample <startpos>
FIELD-A 1 10 A
FIELD-B 11 6 N
FIELD-C * 2 A
FIELD-D 45 4 P 2
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 19
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
Field Definition Contd.
Sample length
FIELD-A 1 10 A
FIELD-B 11 6 N
FIELD-C * 2 A
FIELD-D 45 4 P 2
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 20
Field Definition - <type>
DEFINE fieldname startpos length type decimals
• type determines the format of the field and what kind of data it can hold
Field Definition Contd.
Sample type
FIELD-A 1 10 AFIELD-B 11 6 NFIELD-C * 2 AFIELD-D 45 4 P 2
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 21
Field Types
• ‘A’ - Alphanumeric
• ‘N’ - Numeric, Zoned Decimal – (x’F1F2F3F4F5’)
• ‘P’ - Numeric, Packed Decimal– (x’12345F’)
• ‘U’ - Numeric, Unsigned Packed Decimal – (x’012345’)
• ‘B’ - Numeric, Signed Binary – (x’3039’)
Field Definition Contd.
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 22
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
Field Definition Contd.
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 23
Field Definition - <decimals>
• numeric fields with decimal places are considered signed
• numeric fields without decimals assumes zero decimal places
Field Definition Contd.
Sample decimals
FIELD-A 1 10 A
FIELD-B 11 6 N 0
FIELD-C * 2 A
FIELD-D 45 4 P 2
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 24
Decimal Positions
Data Max Decimal
Type Lgth Positions
‘A’ 254 Not Valid
‘N’ 18 0 - 18
‘P’ 10 0 - 18
‘U’ 9 0 - 18
‘B’ 4 0 - 10
Field Definition Contd.
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 25
Library Section Review
FILE INFILEDEFINE NAME 1 30 A
DEFINE CITY 31 15 A
DEFINE STATE 46 2 A
DEFINE ZIP 48 5 N
OR.....
FILE INFILENAME 1 30 A
CITY 31 15 A
STATE 46 2 A
ZIP 48 5 N
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 26
• This section is where the logic of the program is defined
• Simple programs which read a file and print a report won’t have much in the activity section. In fact, there could only be ONE statement required!
Activity Definition
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 27
• 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.
Reading Files
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 28
• 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
Working Storage Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 29
• Usually coded after all file and record definitions and before the JOB statement
Example:
GROSS-PAY W 6 P 2
INDICATOR1 W 1 A
Working Storage Fields Contd..
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 30
Redefining Fields in a Record
• Specify another DEFINE statement with the appropriate starting location, length and type.
EXAMPLE 1:
FULL-NAME 1 19 A
LAST-NAME 1 10 A
FIRST-NAME 11 8 A
MIDDLE-INIT 19 1 A
Redefining Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 31
Redefining Working Storage Fields
• Refer back to the field being redefined since there’s no starting location
EXAMPLE 1:
FULL-NAME W 19 A
LAST-NAME FULL-NAME 10 A
FIRST-NAME FULL-NAME +10 8 A
MIDDLE-INIT FULL-NAME +18 1 A
Redefining Fields Contd..
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 04/08/23 12:37 AM 008_fmt_wht 32
• 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
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 33
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
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 34
VALUE parameter-cont’d
• If alphanumeric value, must be enclosed in single quotes
EXAMPLE:
NAME 10 20 A VALUE ‘SMITH’
AMOUNT 30 8 N VALUE 1000
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 35
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
Assigning Values to Fields
EXAMPLES
FIELD-A = FIELD-C
FIELD-A = ‘TRUCK’
WS-AMT = 123.45
NET-AMT = GROSS-AMT - PENALTIES
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 36
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 (‘=‘)
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 37
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
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 38
Sample MOVE statements
MOVE FIELDA TO FIELDB
Before After
1) FIELDA ABC123 ABC123
FIELDB bbbbbb ABC123
2) FIELDA ABC12 ABC12
FIELDB XXXXXX ABC12X
3) FIELDA ABC12 ABC12
FIELDB XXXX ABC1
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 39
Sample MOVE different formats
MOVE FIELDA TO FIELDB
Before After
1) FIELDA X’12345F’ X’12345F’
FIELDB X’F0F1F2’ X’F0F1F2’
2) FIELDA X’123F’ X’123F’
FIELDB X’404040’ X’123F40’
3) FIELDA X’12345F’ X’12345F’
FIELDB X’1234’ X’1234’
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 40
One More Sample - MOVE
MOVE ‘TRUCK’ TO FIELDB
Before After
FIELDB bbbbbb TRUCK
MOVE ‘CAR’ TO FIELDB
Before After
FIELDB TRUCK CARCK
Assigning Values to Fields
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 41
Decision and Branching Logic
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 42
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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 43
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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 44
More on the IF
• IF statements can be nested
• Each IF must have corresponding END-IF
• Recommend indentation of nested IF’s for readability
• Can use logical connectors “AND” or “OR”
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 45
Imbedded “IF” Example
IF condition1
IF condition2
statement(s)
ELSE
statement(s)
END-IF
END-IF
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 46
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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 47
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?”
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 48
Common Condition types
• Field Relation Condition
• Field Series Condition
• Field Class Condition
• File Presence Condition (not covered in this class)
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 49
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.
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 50
Field Relation Examples
IF FIELD-A = FIELD-B
IF PAY-TYPE = ‘HOURLY’
IF HOURS-WORKED > 40
IF TOTAL-COMM-AMT < (COMM-AMT * .5)
• Remember, each IF must end with an END-IF
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 51
Valid Relational Operators
Operator Values
Equal = EQ
Not Equal ^= NE NQ
Less Than < LT LS
Less Than or Equal <= LE LQ ^<
Greater Than > GT GR
Greater Than or Equal >= GE GQ ^<
• As always, be careful when using AND or OR with negative operators (i.e. NE)
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 52
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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 53
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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 54
Field Class Condition
• Used to determine whether ALL positions of a field contain alphabetic, numeric, space or zero characters
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 55
Field Class Example - NUMERIC
IF HOURS-WORKED NUMERIC
• The field is tested for digits 0 through 9 in the correct format for the field’s 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
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 56
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 field’s definition (same as NUMERIC check)
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 57
Field Class Example - ALPHABETIC
IF FIRST-NAME ALPHABETIC
• Each byte of the field is tested for the letters A through Z or a space.
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 58
Field Class Example - SPACES
IF FIRST-NAME SPACES
• SPACE or SPACES valid
• Each byte of the field is tested for a space (x’40’)
DECISION and BRANCHING LOGIC
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 59
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 60
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
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 61
Printing a Report - Cont’d
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”)
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 62
Build onto Library Section
FILE INFILENAME 1 30 A
CITY 31 15 A
STATE 46 2 A
ZIP 48 5 N
JOBPRINT RPT1
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 63
REPORT Activity
• The description of a report is considered a sub-activity.
• The REPORT statement describes the characteristics of the report.
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 64
REPORT Activity - Cont’d
• 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.
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 65
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
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 66
Report Titles
• May specify up to 99 title lines
• Automatically centers each line on the page (can be manually controlled with default overrides)
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 67
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)
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 68
Sample TITLE Statements
TITLE ‘CSC FSG’
TITLE 2 ‘BASIC EZTRIEVE TRAINING’
TITLE 3 ‘SAMPLE REPORT TITLES’
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 69
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
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 70
Detail Lines - Cont’d
• Unless specified otherwise, the field name is used as the column heading on the report
• Line is automatically centered on the page
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 71
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
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 72
Sample LINE Statements
LINE NAME
LINE 2 CITY ‘, ‘ STATE ZIP
LINE 3 ‘ ‘
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 73
Put it Together - A Second Look
FILE INFILE
NAME 1 30 A
CITY 31 15 A
STATE 46 2 A
ZIP 48 5 N
JOBPRINT RPT1
REPORT RPT1TITLE ‘CSC FSG’TITLE 2 ‘BASIC EZTRIEVE TRAINING’TITLE 3 ‘SAMPLE REPORT TITLES’LINE NAME CITY STATE ZIP
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 74
Sample with multiple reports
JOBPRINT DETAIL-RPTPRINT 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 .........
Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 75
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 76
Column Headings
• Defaults to the field name
• Can be overridden on the DEFINE statement
• Can be overridden in the REPORT sub-activity section
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 77
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 78
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’
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 79
POLICY-NUMBER 1 15 A HEADING (‘POL’ ‘NUM’)
Replaces the literal POLICY-NUMBER as a column heading with a two
line heading ‘ POL ’ NUM
Advanced Reporting
Sample HEADING – II
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 80
HEADING parm in the REPORT sub-activity
REPORT <rptname>TITLE literal1HEADING fieldname (‘literal’)
LINE fields/literals
• Coded after the TITLE lines
• If coded here, must specify the field name
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 81
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.
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 82
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 83
Sample SEQUENCE statement
REPORT ...... SEQUENCE PLAN-CODE POLICY-NUM
TITLE ..... LINE .......
• This example will report records by POLICY-NUM within PLAN-CODE
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 84
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)
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 85
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 86
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 87
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.
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 88
Sample CONTROL statement
REPORT ......SEQUENCE PLAN-CODE POLICY-NUMCONTROLTITLE .....LINE .......
• This example will report records by POLICY-NUM within PLAN-CODE and will add up any column specified on the LINE statement which is defined with decimal places
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 89
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.
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 90
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 91
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)
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 92
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 93
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
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 94
Counting Records
• Use the TALLY command on the LINE statement
• Report sub-activity must include the CONTROL statement (with or without any control fields)
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 95
Sample TALLY statement
REPORT RPT1SEQUENCE PLAN-CODE POLICY-NUMCONTROL TITLE .....LINE PLAN-CODE POLICY-NUM TALLY
• This example will provide a record count at the end of the report
Advanced Reporting
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 96
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 97
• 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
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 98
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.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 99
• 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.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 100
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 operation performed successfully
4 end-of-file during a GET
16 record not found during a READ.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 101
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.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 102
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.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 103
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 >=).
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 104
WRITE statement
• WRITE < file name > (UPDATE/ADD/DELETE) <from file name> STATUS
• Used to update a VSAM File.
File Processing
CSC Proprietary 04/08/23 12:37 AM 008_fmt_wht 105
Basic Eztrieve Plus
THANK YOU
HAVE FUN!!