000-349 · Question #42
Given the following scenario: There is one input file (SOHeader), which contains 200,000 records. The records in SOHeader file are comprised of three fields: SONumber, SOOrdType, and ShipToCustomer…
The correct answer is A. LOOKUP(). LOOKUP is the most efficient function for finding the first record in a file that matches a specific field value, as it directly retrieves a matching entry without full sequential iteration.
Question
Given the following scenario:
There is one input file (SOHeader), which contains 200,000 records. The records in SOHeader file are comprised of three fields: SONumber, SOOrdType, and ShipToCustomer. The file is sorted by SOOrdType (ascending order). Given a snapshot of a few records in the file:
1000ORRyan 1098OTPeter 1056PAJohn 1075PAJoanne 1020QDAlice 1099ZPAaron 1036ZXAali What is the most efficient function to use to find the first record where ShipToCustomer = "John".
Options
- ALOOKUP()
- BCHOOSE()
- CEXTRACT()
- DSEARCHUP()
- ESEARCHDOWN()
How the community answered
(46 responses)- A80% (37)
- B4% (2)
- C2% (1)
- D2% (1)
- E11% (5)
Why each option
LOOKUP is the most efficient function for finding the first record in a file that matches a specific field value, as it directly retrieves a matching entry without full sequential iteration.
LOOKUP directly searches the input file for the first record where ShipToCustomer matches 'John' by using the value as a key, making it the most efficient choice. It does not require iterating through every record in sequence, which is critical for performance against a 200,000-record file.
CHOOSE selects a value from a list by position or condition and is not designed to search for matching records within a large input file.
EXTRACT filters multiple records matching a condition into a subset and is not optimized for pinpointing a single first-matching record efficiently.
SEARCHUP searches backward from the current record position, making it inefficient and potentially incorrect for finding the first matching record from the start of the file.
SEARCHDOWN searches forward sequentially from the current position, which is less efficient than LOOKUP for locating a specific record by value in a large unsorted field.
Concept tested: LOOKUP function efficiency for record retrieval
Source: https://www.ibm.com/docs/en/b2b-integrator/6.1.2?topic=functions-lookup
Topics
Community Discussion
No community discussion yet for this question.