Example
This example searches a table containing six occurrences of department numbers. Department names that correspond to the department number are retrieved and printed.
The following code:
The value of INDEX is tested for a return of zero (no key found). If true, a value corresponding to the seventh occurrence of DEPARTMENT-NAME is moved to INDEX and UNKNOWN is printed for department numbers not found in the DEPT-NUMBER table.
INPUT 80 F 80 REC NAME 1 20 REC ACCOUNT 33 4 3 REC IN-DEPT 37 3 013CULLUS62 0141*001 ' ' 0151*001 NAME HH 'NAME' 0151*002 ACCOUNT FN HH 'ACCOUNT' 0151*003 DEPARTMENT-NAME.INDEX HH 'DEPARTMENT' 'NAME' 010 DEPT-NUMBER.6 '111' '222' '333' '444' '555' '666' 010 DEPARTMENT-NAME.7 'TECH SUPPORT ' 'SALES ' * 'MARKETING ' 'SYSTEM SUPPORT' * 'ADMINISTRATION' 'EDUCATION ' * 'UNKNOWN ' 010 INDEX 017001 CALL US62 (DEPT-NUMBER 'A' 3 6 'S' IN-DEPT INDEX) 017 IF INDEX EQ 0 50 017 TAKE 017050 MOVE 7 TO INDEX 017 TAKE 01OUT D
REPORT NO. 01 CULLUS62 mm/dd/yy PAGE 1 DEPARTMENT NAME ACCOUNT NAME JONES MARY 1112222 TECH SUPPORT SMITH PETER 3334444 MARKETING BROWN JACK 5556666 ADMINISTRATION MACINTOSH JUNE 7778888 UNKNOWN RICHARDS MICHAEL 9991111 UNKNOWN PAPPAS DICK 2223333 SALES BURNS FAY 4445555 SYSTEM SUPPORT C750009 RECORDS WRITTEN FOR REPORT 01 -- 12
Copyright © 2014 CA.
All rights reserved.
|
|