USER 'XYZ COMPANY, INC.'
PERSONEL: INPUT DATACOM RECORD EQ 375 NAME EQ PMF DBID EQ 001
DEFINE PERSONEL-COMMAND 001-005 X
DEFINE PERSONEL-KEY 006-010 X
DEFINE PERSONEL-ELMLIST 191-201 X
DEFINE PERSONEL-NUMBER 301-305 X ' ID ' 'NUMBER'
DEFINE PERSONEL-NAME 306-329 X 'EMPLOYEE NAME'
DEFINE PERSONEL-CITY 354-368 X 'CITY'
DEFINE PERSONEL-STATE 369-370 X
DEFINE PERSONEL-ZIP-CODE 371-375 X 'ZIP' 'CODE'
MOVE 'GETIT' TO PERSONEL-COMMAND
MOVE 'EMPNO' TO PERSONEL-KEY
MOVE 'ADEMP' TO PERSONEL-ELMLIST
GET PERSONEL
GOTO EOJ WHEN PERSONEL EQ 'E'
REPORT 'EMPLOYEE SUMMARY - TEXAS'
SELECT PERSONEL-STATE EQ 'TX'
CONTROL PERSONEL-CITY
PRINT PERSONEL-NAME PERSONEL-NUMBER PERSONEL-CITY
PERSONEL-ZIP-CODE
END
The GOTO statement transfers control to a previously defined label statement.
Code the general GOTO command in the following format:
►►─ GOTO ─ label ─┬──────────────────────┬────────────────────────────────────►◄ └─ logical expression ─┘
The GOTO statement in the sample program looks like this:
GOTO EOJ WHEN PERSONEL EQ 'E'
The word GOTO is coded as shown. EOJ is a predefined procedural label to which the program branches when the end of the table is reached. At that time, the program terminates all table reading and produces a report containing only the records selected up to the point of termination.
PERSONEL EQ 'E' is the optional logical expression. A logical expression specifies the logical constraint that must be satisfied prior to performing the branch. In the Reporting Facility, logical expressions may consist of one or more elementary conditions. The format of an elementary condition is:
field1 operator field2
A previously defined field name
Any of the following:
Equal to
Not equal to
Greater than
Not greater than
Less than
Not less than
One of the following:
In the GOTO statement, PERSONEL is the predefined field name and 'E' is the alphanumeric literal.
The GOTO statement tells the Reporting Facility to branch to the end-of-job procedure when it finds the alphanumeric value, 'E', in the return code field, PERSONEL.
|
Copyright © 2014 CA.
All rights reserved.
|
|