The activity definition section of your program contains the Easytrieve statements that perform the tasks for which you created your program: reading in, processing, and writing out data. These tasks are divided into two activity types - JOB activities and SORT activities.
JOB activities, identified by the JOB statement, read data from input files described in the library section of your program.
They examine and manipulate this data, and write data to output files and the appropriate report declaratives.
SORT activities, initiated by the SORT statement, sequence files in the order specified by parameters of this statement. These sequenced files can in turn be processed by one or more JOB activities.
You can code any number of JOB and/or SORT activities in your program.
This chapter discusses the JOB and SORT statements and their associated parameters. These statements provide the information required for automatic input and output of data. Data under your control is input with the GET and READ statements, and output with the PUT and WRITE statements.
The Activity Definition section of the Sample Program copied below.
22 * 23 JOB INPUT PERSNL 24 %GETDATE CURR-DATE 42 SALARY = PAY-GROSS * 52 43 PERFORM SERVICE-CALC 44 IF SERVICE LT 1 45 GO TO JOB 46 END-IF 47 PERFORM RAISE-CALC 48 BONUS = 0 49 IF SERVICE GT 14 50 PERFORM BONUS-CALC 51 END-IF 52 SALARY = SALARY + RAISE + BONUS 53 PRINT UPD-RPT 54 * 55 SERVICE-CALC. PROC 57 SERVICE = CURR-YY - HIRE-YY 58 IF CURR-MM LT HIRE-MM 59 SERVICE = SERVICE - 1 60 END-IF 61 IF CURR-MM NE HIRE-MM 62 GOTO QUIT-SERV-CALC 63 END-IF 64 IF CURR-DD LT HIRE-DD 65 SERVICE = SERVICE - 1 66 END-IF 67 QUIT-SERV-CALC 68 END-PROC 69 * 70 RAISE-CALC. PROC 72 IF DEPT LT 940 73 RAISE = SALARY * 0.1 74 ELSE 75 RAISE = SALARY * 0.15 76 END-IF 77 END-PROC 78 * 79 BONUS-CALC. PROC 81 IF SALARY GT 29999 82 DISPLAY ERRPRINT, LAST-NAME, +5, + 'INELIGIBLE FOR BONUS' 83 GOTO QUIT-BONUS 84 END-IF 85 IF SERVICE GT 19 86 BONUS = 2000 87 ELSE 88 BONUS = 1000 89 END-IF 90 PRINT BONUSRPT 91 QUIT-BONUS 92 END-PROC 93 * 94 REPORT UPD-RPT PAGESIZE 51 LINESIZE 63 NODATE NOPAGE 95 SEQUENCE DEPT LAST-NAME 96 CONTROL DEPT 97 TITLE 1 'ANNUAL UPDATE REPORT - SALARIED EMPLOYEES' 98 HEADING LAST-NAME 'NAME' 99 HEADING SERVICE 'SERV' 100 LINE DEPT LAST-NAME SERVICE RAISE SALARY 101 * 102 REPORT BONUSRPT LINESIZE 60 NODATE NOPAGE 103 SEQUENCE DEPT LAST-NAME 105 TITLE 1 'ANNUAL BONUS REPORT - SENIOR EMPLOYEES' 106 LINE DEPT LAST-NAME SERVICE BONUS 107 * |
We will look into the JOB and SORT Statement in next chapter.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!