Hi!
I need to make a validation in a program. For that, I put all the valids numbers in a table. After, I want to make a search instruction for each record of my input file to know if the record is valid.
I'm in home and I don't have a cobol compilator here.
Anyone can compile this code for my and tell me if it works?
The table is:
01 TAB-NIFS.
05 TABLE-NIF OCCURS 50
DEPENDING ON CONT-REG-NIF
INDEXED BY WS-INDEX-NIF.
10 TABLE-NIF-SIZE PIC 9(02) VALUE ZEROS.
10 TABLE-NIF-VALUE PIC X(09) VALUE SPACES.
01 CONT-REG-NIF PIC 9(02) USAGE COMP-3 VALUE ZEROS.
An example of the load table is.
TABLE-NIF-SIZE | TABLE-NIF-VALUE
2 | 21
1 | 1
4 | 1233
3 | 123
9 | 123456789
The search instruction is:
Set ws-index-NIF to 1.
SEARCH TABLE-NIF
At end
set SW-NOTFND to true
When TABLE-NIF-VALUE( 1: TABLE-NIF-SIZE(WS-INDEX-NIF) )(ws-index-NIF) = FILEIN-NIF(1: TABLE-NIF-SIZE(WS-INDEX-NIF) )
set sw-FND to true
End-Search.
Thanks