project BLF > class BDomain > method ValDomainCode
validation procedure
Parameters
icTargetField | input | character | Value of the business field to validate. |
icTargetFieldName | input | character | Name of the business field to validate. |
icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/bdomain.p)
assign oiReturnStatus = -98.
VALDOMAINCODE: do:
/* The 'QADRSRV' domain is reserved for system use */
if icTargetField = "QADRSRV":U
then do:
assign
oiReturnStatus = -1
vcMessage = trim(#T-3'The QADRSRV domain is reserved for system use.':100(6681)T-3#).
<M-1 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input icTargetField (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'BLF-75':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
leave VALDOMAINCODE.
end.
/* Domain code may only contain alphanumeric characters */
vito = length(icTargetField, "CHARACTER").
ALPHACHECK: do viCounter = 1 to vito:
if index("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789":U,
substring(icTargetField, viCounter, 1, "CHARACTER")) = 0
then do:
assign
oiReturnStatus = -1
vcMessage = trim(#T-4'Domain code can only contain alphanumeric characters.':200(6687)T-4#).
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input icTargetField (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'BLF-76':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
leave ALPHACHECK.
end.
end.
end.
if oiReturnStatus = -98 then
assign oiReturnStatus = 0.