tldm-universe/Ardent/UV/APP.PROGS/GETPARTNUM.B

86 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
********************************************************************************
*
* Support of PR1ME INFORMATION subroutine '!GET.PARTNUM'
*
* 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.
* 10/08/93 12299 LA Initial implementation.
*
*******************************************************************************
$OPTIONS DEFAULT
subroutine PR1ME(PF.FVAR, RECORD.ID, PART.NUM, RETURN.STATUS)
$INCLUDE UNIVERSE.INCLUDE FILEINFO.H
$INCLUDE UNIVERSE.INCLUDE INFO_ERRS.H
* To do this simply in basic, we need the filename rather than the file
* variable as the partitioning algorithm is stored in the dictionary of
* the file. When we have the algorithm, set @ID temporarily and run the
* algorithm through the itype code.
file.open = 0
RETURN.STATUS = 0
algorithm = ''
* First check its a partitioned file (NOTE: file types returned are PI/open
* file type numbers)
if fileinfo(PF.FVAR, FINFO$TYPE) ne 7 THEN
RETURN.STATUS = IE$NOT.DISTFILE
goto exit.get.partnum
end
filename = fileinfo(PF.FVAR, FINFO$VOCNAME)
open 'DICT', filename to dict.fvar on error
RETURN.STATUS = IE$DIST.DICT.OPEN.FAIL
goto exit.get.partnum
end else
RETURN.STATUS = IE$DIST.DICT.OPEN.FAIL
goto exit.get.partnum
end
file.open = 1
read algorithm from dict.fvar, "@PART.ALGORITHM" on error
RETURN.STATUS = IE$DIST.ALG.READ.FAIL
goto exit.get.partnum
end else
RETURN.STATUS = IE$DIST.ALG.READ.FAIL
goto exit.get.partnum
end
stored.id = @ID
@ID = RECORD.ID
PART.NUM = itype(algorithm)
if not(num(PART.NUM)) then
RETURN.STATUS = IE$NO.MAP.TO.PARTNUM
goto exit.get.partnum
end
if PART.NUM < 1 then
RETURN.STATUS = IE$NO.MAP.TO.PARTNUM
goto exit.get.partnum
end
exit.get.partnum:
if file.open then close dict.fvar
if RETURN.STATUS ne 0 then
PART.NUM = 0
end
return
end