An extract reads a master or a prior day's file and writes a smaller sequential file of the rows a later step should see. Payroll feeds, insurance claims, and SAS analysis jobs all start this way. The Easytrieve program owns the selection rule. The next program reads a clean file and does not repeat the IF.
| Piece | What it does |
|---|---|
| Input FILE | JOB INPUT reads each master record |
| IF | Decides selected versus rejected |
| Output FILE CREATE | PUT writes one selected record |
| Counts | Input equals selected plus rejected |
1234567891011121314FILE MASTER FB(120 12000) EMP-NO 1 5 N STATUS 6 1 A GROSS 7 5 P 2 FILE ACTIVE FB(80 8000) CREATE OUT-EMP 1 5 N OUT-GROSS 6 5 P 2 JOB INPUT MASTER IF STATUS EQ 'A' MOVE EMP-NO TO OUT-EMP MOVE GROSS TO OUT-GROSS PUT ACTIVE END-IF
Move into the output layout before PUT. The output FILE has its own positions. They do not have to match the master if the next job wants a shorter record.
DD ACTIVE matches FILE ACTIVE. DISP=(NEW,CATLG) or a GDG (+1) is the usual disposition. LRECL must match the output record length. A missing DD, or LRECL 120 against an 80-byte layout, fails the step before any row is useful.
Add 1 to a selected counter on the PUT path and 1 to a rejected counter on the other path. At end of job, selected plus rejected equals the records JOB INPUT presented. Print those three numbers on SYSPRINT. Operations compares them to the output data set's record count.
You have a big box of cards. You look at each card and, if it says active, you copy two numbers onto a new smaller card and drop that card in a second box. The second box is what the next person reads. You also count how many cards you copied and how many you skipped, and the two counts have to add up to the big box.
1. An extract program writes rows with:
2. The output FILE usually includes:
3. A balanced extract means:
4. Shops extract before a SAS or report step because:
5. Fields on the output record are: