Search Table using PERFORM
PERFORM statement you can use when you defined an array with a subscript.
Method-1
PERFORM P200-READ-SALES-FILE.
MOVE '*** NO PART DESCRIPTION' TO RPT-DTL-PART-DESC.
PERFORM VARYING WS-SUB FROM 1 BY 1 UNTIL (WS-SUB > WS-TBL-MAX)
OR (IN-PRT-NBR = PART-NBR (WS-SUB))
IF IN-PRT-NBR = PART-NBR (WS-SUB)
MOVE PART-DESC TO RPT-DTL-PART-DESC
END-IF
END-PERFORM.
Search Table using SEARCH statement
Method-2
You can use SEARCH logic when your Table defined with an index.
PERFORM P200-READ-SALES-FILE.
SET WS-INDX TO 1.
SEARCH PART-TABLE
AT END MOVE '*** NO PART DESCRIPTION' TO RPT-DTL-PART-DESC
WHEN IN-PRT-NBR = PART-NBR (WS-INDX)
MOVE PART-DESC TO RPT-DTL-PART-DESC END-SEARCH.
Related Posts
-
JCL MSGCLASS Vs. MSGLEVEL Top Differences
The MSGCLASS and MSGLEVEL control the print of messages to the output listing. Here are the detailed meanings and default values.