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
-
From Laptop to Cloud: Deploy Your First Production DB Using Amazon RDS
Learn how to move from a local database to a production-ready cloud setup using Amazon RDS. A beginner-friendly step-by-step guide covering setup, backups, scaling, and best practices.






