tldm-universe/Ardent/UV/APP.PROGS/LOC.BY.FLD.B

43 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
*******************************************************************************
*
* New System Admin - This routine will search for a particular value in
* a dynamic array, and return the location at which it was found.
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/13/98 23801 RGA Change copyright info.
* 11/05/90 7393 DPB Routine first created and admin'd.
*******************************************************************************
subroutine loc.by.fld (dyn.array, siz, start.field, val, expr, ret.field)
* Searches through dynamic array dyn.array, of size siz, starting
* at field start.field,
* and returns the ret.field which is the field whose value val
* is equal to expr.
* Starts search at field specified
* Returns 0 if not found.
* This is like an execution of select, find me the field whose third value
* is this expression.
* Weakness - doesn't handle subvalues.
start.from = if start.field <= 1 then 1 else start.field
ret.field = 0
* print @(0,22):@(-3):@SYS.BELL:"LOC.BY.FLD called."
for i = start.field to siz
while ret.field = 0 ; * For efficiency - return first hit
if dyn.array<i,val> = expr
then
ret.field = i
end
next i
return