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

111 lines
3.6 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
******************************************************************************
*
* Function to read a messsage from sys.message file
*
* 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.
* 11/23/92 10214 PVW Make UV.INTERNAL common block a separate entity
* and include PI/open DEVSYS common block.
* 11/01/91 8871 DTM Made it correctly handle formatted messages
* 09/07/90 7412 DPB Fixed handling of multi line records.
* 09/06/90 7421 DPB Initial put.
*
*******************************************************************************
FUNCTION UVREADMSG( MESSAGE.NO, MESSAGE.PARAM)
ID = "%W%"
$INCLUDE UNIVERSE.INCLUDE UV.COM
MESSAGE.ID = MESSAGE.NO "R%6"
READ MESSAGE.REC FROM SYS.MESSAGE, MESSAGE.ID
ELSE
MESSAGE.TEXT = "[":MESSAGE.ID:"]"
RETURN(MESSAGE.TEXT)
END
MESSAGE.LEN = LEN(MESSAGE.REC)
MESSAGE.TEXT = ""
PARAM.COUNT = 0
FOR I = 1 TO MESSAGE.LEN
M.CHAR = MESSAGE.REC[I,1]
BEGIN CASE
CASE M.CHAR = @FM
MESSAGE.TEXT := @FM
CASE M.CHAR = "%"
IF I = MESSAGE.LEN THEN MESSAGE.TEXT := M.CHAR
ELSE
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
IF M.CHAR2 = "%"
THEN MESSAGE.TEXT := "%"
ELSE
PARAM.COUNT += 1
NEXT.PARAM = MESSAGE.PARAM<PARAM.COUNT>
PARAM.FORMAT = ""
IF M.CHAR2 = "("
THEN
LOOP
IF I = MESSAGE.LEN
THEN
MESSAGE.TEXT := MESSAGE.TEXT:"[MESSAGE ":MESSAGE.ID:", SCAN ERROR]"
RETURN(MESSAGE.TEXT)
END
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
UNTIL M.CHAR2 = ")" DO
PARAM.FORMAT := M.CHAR2
REPEAT
IF I = MESSAGE.LEN
THEN
MESSAGE.TEXT := MESSAGE.TEXT:"[MESSAGE ":MESSAGE.ID:", SCAN ERROR]"
RETURN(MESSAGE.TEXT)
END
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
END
BEGIN CASE
CASE M.CHAR2 = "I" OR M.CHAR2 = "i"
NEXT.PARAM = INT(NEXT.PARAM)
CASE M.CHAR2 = "L" OR M.CHAR2 = "l"
NEXT.PARAM = INT(NEXT.PARAM)
CASE M.CHAR2 = "D" OR M.CHAR2 = "d"
NEXT.PARAM = NEXT.PARAM + 0
CASE M.CHAR2 = "F" OR M.CHAR2 = "f"
NEXT.PARAM = NEXT.PARAM + 0
CASE M.CHAR2 = "X" OR M.CHAR2 = "x"
NEXT.PARAM = OCONV(INT(NEXT.PARAM),"MX0C")
CASE M.CHAR2 = "S" OR M.CHAR2 = "s"
NULL
CASE M.CHAR2 = "N" OR M.CHAR2 = "n"
NULL
CASE M.CHAR2 = "C" OR M.CHAR2 = "c"
NEXT.PARAM = NEXT.PARAM[1,1]
CASE 1
NEXT.PARAM = "[MESSAGE ":MESSAGE.ID:", BAD FORMAT %":M.CHAR2:" ]"
END CASE
IF PARAM.FORMAT THEN NEXT.PARAM = NEXT.PARAM PARAM.FORMAT
MESSAGE.TEXT := NEXT.PARAM
END
END
CASE 1
MESSAGE.TEXT := M.CHAR
END CASE
NEXT I
RETURN(MESSAGE.TEXT)