added LSL2 stored procedures
This commit is contained in:
112
LSL2/STPROC/OBJ_JCH_LOG.txt
Normal file
112
LSL2/STPROC/OBJ_JCH_LOG.txt
Normal file
@ -0,0 +1,112 @@
|
||||
COMPILE FUNCTION obj_JCH_Log(Method,Parms)
|
||||
/*
|
||||
Methods for the JCH_Log table
|
||||
|
||||
04/9/2013 JCH - Initial Coding
|
||||
|
||||
Properties:
|
||||
|
||||
Methods:
|
||||
|
||||
Extract() ;* Restructures data log records
|
||||
|
||||
*/
|
||||
|
||||
|
||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey, obj_Prod_Spec
|
||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, RList, ErrMsg, Btree.Extract
|
||||
|
||||
EQU TAB$ TO \09\
|
||||
EQU CRLF$ TO \0D0A\
|
||||
|
||||
EQU ROUTINE$ TO 1
|
||||
EQU METHOD$ TO 2
|
||||
EQU TABLE$ TO 3
|
||||
EQU WO_NOS$ TO 4
|
||||
EQU CASS_NOS$ TO 5
|
||||
EQU LOC_KEY$ TO 6
|
||||
EQU ACTION$ TO 7
|
||||
EQU TRANS_DTM$ TO 8
|
||||
EQU USER_ID$ TO 9
|
||||
EQU TAGS$ TO 10
|
||||
EQU TOOL_ID$ TO 11
|
||||
EQU ERR_MSG$ TO 12
|
||||
EQU POST_VALS TO 13
|
||||
EQU STATION TO 14
|
||||
EQU LOG_DTM TO 15
|
||||
|
||||
|
||||
|
||||
ErrTitle = 'Error in Stored Procedure "obj_JCH_Log"'
|
||||
ErrorMsg = ''
|
||||
|
||||
IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
|
||||
IF NOT(ASSIGNED(Parms)) THEN Parms = ''
|
||||
|
||||
IF ErrorMsg NE '' THEN
|
||||
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
|
||||
RETURN ''
|
||||
END
|
||||
|
||||
Result = ''
|
||||
|
||||
BEGIN CASE
|
||||
CASE Method = 'Extract' ; GOSUB Extract
|
||||
CASE 1
|
||||
ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to object.'
|
||||
|
||||
END CASE
|
||||
|
||||
IF ErrorMsg NE '' THEN
|
||||
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
|
||||
RETURN ''
|
||||
END
|
||||
|
||||
RETURN Result
|
||||
|
||||
|
||||
* * * * * * *
|
||||
Extract:
|
||||
* * * * * * *
|
||||
|
||||
LogKey = Parms[1,@RM]
|
||||
LogRec = Parms[COL2()+1,@RM]
|
||||
FieldNo = Parms[COL2()+1,@RM]
|
||||
|
||||
|
||||
IF LogKey = '' THEN RETURN
|
||||
|
||||
IF LogRec = '' THEN
|
||||
LogRec = XLATE('JCH_LOG',LogKey,'','X')
|
||||
END
|
||||
|
||||
IF LogRec = '' THEN RETURN
|
||||
Part1 = LogRec<1>
|
||||
Part2 = LogRec<2>
|
||||
|
||||
IF INDEX(Part2<1,1>,@SVM,1) THEN
|
||||
TitleMessage = Part2<1,1>
|
||||
Parms = Part2<1,2>
|
||||
|
||||
CONVERT @SVM TO ' - ' IN TitleMessage
|
||||
|
||||
Part2 = TitleMessage:@VM:Parms
|
||||
END
|
||||
|
||||
*DEBUG
|
||||
|
||||
*CONVERT @VM:@SVM TO TAB$:@VM IN Part1
|
||||
|
||||
LogRec = Part1:TAB$:Part2
|
||||
|
||||
|
||||
IF FieldNo = TRANS_DTM$ THEN
|
||||
Result = ICONV(FIELD(LogRec,TAB$,FieldNo),'DT')
|
||||
END ELSE
|
||||
Result = FIELD(LogRec,TAB$,FieldNo)
|
||||
END
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user