tldm-universe/Ardent/UV/APP.PROGS/INDIRECT

70 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
subroutine INDIRECT( result, pib, sib, pob, sob, obn, reference )
*******************************************************************************
*
* INDIRECT Resolves indirect buffer references (user exit)
*
* 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/14/98 23801 SAP Change copyrights.
* 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10.
*
*******************************************************************************
*
* This routine provides the user exits with an indirect reference
* capability. If the reference is not a well-formed indirect reference,
* then it is returned itself as the result. If it is a well-formed
* indirect reference, then the links are chased, and the final value is
* returned as the result.
*
* Arguments to this subroutine are:
* result - the returned value
* pib - the primary input buffer
* sib - the secondary input buffer
* pob - the primary output buffer
* sob - the secondary output buffer
* obn - the current output buffer number (0 = primary;
* 1 = secondary)
* reference - the indirect reference to be resolved
*
*****************************************************************************/
result = reference
BEGIN CASE
CASE reference[ 1, 1 ] = "%"
*
* Reference through primary input buffer
*
CALL $INDIRECT( result, pib, sib, pob, sob, obn, reference[ 2, 99999 ])
result = pib< result >
CASE reference[ 1, 1 ] = "#"
*
* Reference through an output buffer
*
CALL $INDIRECT( result, pib, sib, pob, sob, obn, reference[ 2, 99999 ])
IF obn THEN
result = sob< result >
END ELSE
result = pob< result >
END
CASE 1
*
* literal reference
*
result = reference
END CASE
RETURN
END