Sunday 4 August 2013

Easytrieve Basic Conditions.


JOB Statement
The JOB statement defines and initiates processing activity. It also identifies the name of the automatic input file.

JOB   INPUT     file – name     NAME    job-name

Logic
Data selection and manipulation takes place in the logic section of an EASYTRIEVE PLUS program. Logic is coded immediately after the JOB statement.
IF Statement
Processing within a JOB activity is dependent on the conditional (IF) statements present in the program.

  • When an IF statement is present, each record read from the input file is processed against this condition.
  • Every IF statement must end with END-IF.



Example :

IF      DEPT    =     910
IF      NAME   =    ‘SMITH’
IF      AMT     GE  500

The value in another field:

IF      DIV        =    HOLD-DIV
IF      STATE   =   ‘GA’ ‘SC’ ‘TN’
IF      CLASS  =   ‘A’ THRU ‘E’
IF      AMT      NE     100   THRU    500
IF      DEPT   =  900  940   THRU   950   960   970  THRU  980

IF / ELSE
ELSE specifies alternative processing when the condition established by the IF statement is not met.
  • For true IF’s all commands up to the ELSE (or END-IF if no ELSE is present) are executed.
  • For false IF’s, commands between ELSE and END-IF are executed.
  • Following END-IF, processing continues regardless of the result of the IF.
Example

IF    DIV   =    ‘A’     THRU    ‘L’
          DEDUCTIONS   =   GROSS * .15
ELSE
         DEDUCTIONS    =   GROSS * .18
END-IF
Records with the DIV in the A through L range are processed according to the statement(s) between the IF and ELSE. For all records with DIV not in the range A through L , the statement(s) following ELSE is executed until END-IF is reached.




Assignment Statement
The assignment statement establishes a value in a field by copying the value from another field or literal. The assignment statement also accomplishes data conversion, such as packing or unpacking data.
Syntax

                          Field-name-2 
 Field-name   =     literal
                     EQ  arithmetic expression


Created with Artisteer

No comments:

Post a Comment

New In-feed ads