Skip to main content

AB INITIO - LOOKUP FUNCTION

                                                LOOKUP FUNCTION

 lookup_next()
§  Lookup_next will give you the next available match in the Lookup file.
§  Lookup_next should be Preceded after successful call to lookup, lookup_count, lookup_match, lookup_nth, lookup_range, or lookup_next itself.
§  The lookup_next function returns NULL if you call it more times than the number of matching records in the file, or if the next matching record does not exist.
§  Behavior of lookup_next() on different calls
                  The next successive matching record after the previous call to lookup or lookup_range.
                  The first matching record after the previous call to lookup_count or lookup_match.
                  The (n+1)st successive matching record after the previous call to lookup_nth.
                  The next successive matching record after the previous call to lookup_next itself.

SYNTAX AND EXAMPLE


  • Syntax -
          lookup_next(lookup_file)

  • Example –
           Preceding lookup_next with lookup_count can be useful when you need to know how many records         
          will be returned.
          Once you have the count of records, you call lookup_next inside a loop to retrieve them all.
                    let integer(4) i = 0;
                    let integer(4) n = lookup_count("MyLookup", in.key);
                    let my_type[integer(4)] result_vector = for (i, i < n) : lookup_next("MyLookup");

          The first call to lookup_next, following the call to lookup_count, returns the first matching record from
          MyLookup.
          Subsequent loop iterations return the balance of the n matching records and store them in     
          result_vector.

Popular posts from this blog

UNIX - AIR COMMANDS

air object changed: Compares two branches or versions of a single technical repository or two repositories, and identifies which objects have changed.    The command outputs the list of files that have been added, removed, or changed between the source and target as follows: Code (meaning) Description A  (Added) The file exists in the target but not in the source. R  (Removed) The file exists in the source but not in the target. M  (Modified) The file is different in the source and the target. S  (Same) The file is the same in the source and the target. U  (Unknown) The difference could not be determined. Occurs due to permission errors or when an object cannot be checked out. N  (No object) The specified object does not exist in either the source or the target. air tag diff: ...

TERADATA-PIVOT FUNCTION

                                  PIVOT FUNCTION §   Splits records by data fields (Columns) §   Converts Rows to Columns or Columns to Rows §   Converts an input records into multiple output records.                                                                      EXA MPLE Execute the below query for the results. §   Before pivot query:             sel cost_cntr_id , DATASET_NBR , cat , r...