Wednesday, September 11, 2019

FILE operations in Easytrieve

GET statement: Used to READ a file sequentially.

SYNTAX - GET <filename> STATUS
If STATUS is specified FILE STATUS is returned after the GET operation

Example

GET PERSNL STATUS

IF PERSNL:FILE-STATUS NE 0
   DISPLAY PERSNL:FILE-STATUS
END-IF

POINT statement: Equivalent to START in COBOL.

SYNTAX - POINT <filename> <relational operator> <field name> STATUS

Example

POINT DUPIN GE HD-IN-KEY STATUS

PRINT : PRINT statement requests report output

SYNTAX - PRINT <rptname>

If report name is not specified default will be assumed

PUT : performs sequential file output

SYNTAX – PUT <filename> FROM <recname> STATUS
this clause is optional

READ : Read statement is used for Random Access to VSAM datasets.
SYNTAX - READ <file-name> KEY <field-name>  STATUS

WRITE : Write statement is used for writing recs into VSAM files. Its used to Update, Add or Delete record from VSAM files. To update a record, UPDATE subparameter must have been coded in the FILE definition.

SYNTAX – WRITE <filename> <activity> FROM <recname> STATUS

can have “UPDATE” or “ADD” or “DELETE”.

UPDATE is the default operation.

Example

FILE INFILE VS (UPDATE) -> File definition
WRITE INFILE UPDATE STATUS -> Write stmt in JOB

No comments:

Post a Comment