Professional Documents
Culture Documents
Introduction
Easy Language Easytrieve
Definition of array
diag-code W 5 A OCCURS 5
Mask is used to print the numeric variable
with certain mask
For E.g.
AD-DATE W 8 N MASK(’99/99/9999’)
We can also suppress leading zeros by using z
in mask.
Activity Section
Syntax
JOB INPUT filename START initial-proc FINISH final-proc
E.g.
JOB INPUT MEMBFILE START initial-proc FINISH final-
proc
Initial-proc will get executed at the beginning of
the program and final-proc at the end of the
program
In between these two proc, file records will be
read.
Procedures
Syntax
CASE var1
WHEN abc
perform read-membfile
WHEN xyz
perform read-claimfile
END-CASE
When var1 equals to abc then first condition will be executed
and when var1 equals to xyz second condition will get
executed.
How to assign value
Assignments (using EQ or =)
assigns the value in right side to the variable in the
left side.
Example : MSR-7061-CURR-RREP-SOURCE EQ 'P'
PUT Verb
For writing a record in the output file command is
PUT outfile.
GOTO JOB Verb
Whenever we want to read next record in the file
GOTO JOB command is used.
STOP Verb
STOP verb terminates the execution of that particular
job alone, whereas STOP EXECUTE terminates the
execution of the program itself.
Sample Program
*****************************************************************************
FILE FILE1 FB (40 400)
*
************************************************************************
* INPUT FILE1 LAYOUT
************************************************************************
FILE1-RECORD 1 40 A
EMP-NBR1 1 5 N
EMP-NAME1 7 10 A
EMP-SALARY1 18 6 N
*
FILE FILE2 FB (30 300)
*
************************************************************************
* INPUT FILE2 LAYOUT
************************************************************************
FILE2-RECORD 1 30 A
EMP-NBR2 1 5 N
EMP-SALARY2 7 6 N
EMP-ROLE2 14 3 A
*
FILE FILE3 FB (20 200)
************************************************************************
* OUTPUT FILE LAYOUT
************************************************************************
FILE3-RECORD 1 20 A
EMP-NBR3 1 5 N
EMP-NAME3 7 10 A
EMP-ROLE3 18 3 A
*
************************************************************************
Sample Program
JOB INPUT (FILE1 KEY(EMP-NBR1) +
FILE2 KEY(EMP-NBR2))
*
IF MATCHED
MOVE EMP-NBR1 TO EMP-NBR3
MOVE EMP-NAME1 TO EMP-NAME3
MOVE EMP-ROLE2 TO EMP-ROLE3
PUT FILE3
ELSE
IF FILE1
MOVE EMP-NBR1 TO EMP-NBR3
MOVE EMP-NAME1 TO EMP-NAME3
MOVE SPACES TO EMP-ROLE3
PUT FILE3
END-IF
END-IF
*
GO TO JOB
*
Report