project QadFinancials > class BSharedSetMerge > method MergeValidateValidateInput


Parameters


icSharedSetTypeCodeinputcharacter
icMasterSharedSetCodeinputcharacter
icRedundantSharedSetCodeinputcharacter
oiMasterSharedSetIdoutputinteger
oiRedundantSharedSetIdoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BSharedSetMerge.MergeValidateInit


program code (program6/bsharedsetmerge.p)

/* =================================================================================================== */
/* Method      : MergeValidateValidateInput                                                            */
/* Desc        : This method validates input parameters                                                */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (B)  SharedSetyTypeCode     Shared set type of merged shared set                           */
/*          (B)  MasterSharedSetCode    Code of master shared set                                      */
/*          (B)  RedundantSharedSetCode Code of redundant shared set                                   */
/* =================================================================================================== */

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

/* =================================================================================================== */
/* Default output values                                                                               */
/* =================================================================================================== */
assign oiMasterSharedSetId    = ?
       oiRedundantSharedSetId = ?.

/* =================================================================================================== */
/* Shared set type is mandatory                                                                        */
/* =================================================================================================== */
if icSharedSetTypeCode = ?
then do:
    assign vcMessage = #T-1'You must specify the shared set type.':255(64379)T-1#.
    <M-2 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-6545':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>

    if viLocalReturnStatus >= 0
    then assign viLocalReturnStatus = -1.
end.

/* =================================================================================================== */
/* Target shared set                                                                                   */
/* =================================================================================================== */
/* Master shared set code is mandatory */
if icMasterSharedSetCode = ?
then do:
    assign vcMessage = #T-3'Target Shared Set is mandatory.':255(733713644)T-3#.
    <M-4 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-6546':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>

    if viLocalReturnStatus >= 0
    then assign viLocalReturnStatus = -1.
end.
else do:
    /* Master shared set has to exist */
    <Q-6 run SharedSetByCode (all) (Read) (NoCache)
       (input icMasterSharedSetCode, (SharedSetCode)
        output dataset tqSharedSetByCode) in BSharedSet >
    
    find first tqSharedSetByCode where
               tqSharedSetByCode.tcSharedSetCode = icMasterSharedSetCode no-error.
    
    if not available tqSharedSetByCode
    then do:
        assign vcMessage = #T-8'The specified Target Shared Set code (&1) is invalid.':255(73433685)T-8#
               vcMessage = substitute(vcMessage, icMasterSharedSetCode).
        <M-7 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'QadFin-6547':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>

        if viLocalReturnStatus >= 0
        then assign viLocalReturnStatus = -1.
    end.
    else do:
        /* Return ID of master shared set */
        assign oiMasterSharedSetId = tqSharedSetByCode.tiSharedSet_ID.

        /* Master shared set has to belong to entered shared set type */
        if tqSharedSetByCode.tcSharedSetTypeCode <> icSharedSetTypeCode
        then do:
            assign vcMessage = #T-10'The Target Shared Set &1 is not of type &2.':255(413925989)T-10#
                   vcMessage = substitute(vcMessage, icMasterSharedSetCode, icSharedSetTypeCode).

            <M-9 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-6548':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
    
            if viLocalReturnStatus >= 0
            then assign viLocalReturnStatus = -1.
        end.
    end.
end.

/* =================================================================================================== */
/* Source shared set                                                                                   */
/* =================================================================================================== */
/* Source shared set code is mandatory */
if icRedundantSharedSetCode = ?
then do:
    assign vcMessage = #T-15'Source Shared Set is mandatory':255(591249069)T-15#.
    <M-11 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-6549':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>

    if viLocalReturnStatus >= 0
    then assign viLocalReturnStatus = -1.
end.
else do:
    /* Redundant shared set has to exist */
    <Q-12 run SharedSetByCode (all) (Read) (NoCache)
       (input icRedundantSharedSetCode, (SharedSetCode)
        output dataset tqSharedSetByCode) in BSharedSet >
    
    find first tqSharedSetByCode where
               tqSharedSetByCode.tcSharedSetCode = icRedundantSharedSetCode no-error.
    
    if not available tqSharedSetByCode
    then do:
        assign vcMessage = #T-16'The specified Source Shared Set (&1) is invalid.':255(332029090)T-16#
               vcMessage = substitute(vcMessage, icRedundantSharedSetCode).
        <M-13 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'QadFin-6550':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>

        if viLocalReturnStatus >= 0
        then assign viLocalReturnStatus = -1.
    end.
    else do:
        /* Return ID of redundant shared set */
        assign oiRedundantSharedSetId = tqSharedSetByCode.tiSharedSet_ID.

        /* Redundant shared set has to belong to entered shared set type */
        if tqSharedSetByCode.tcSharedSetTypeCode <> icSharedSetTypeCode
        then do:
            assign vcMessage = #T-17'The Source Shared Set &1 is not of type &2.':255(227611555)T-17#
                   vcMessage = substitute(vcMessage, icRedundantSharedSetCode, icSharedSetTypeCode).

            <M-14 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-6551':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
    
            if viLocalReturnStatus >= 0
            then assign viLocalReturnStatus = -1.
        end.

        /* Redundant and master shared set's cannot be the same */
        if icMasterSharedSetCode = icRedundantSharedSetCode
        then do:
            assign vcMessage = #T-19'Target and Source Shared Sets cannot be the same (Target = &1, Source = &2).':255(825480736)T-19#
                   vcMessage = substitute(vcMessage, icMasterSharedSetCode, icRedundantSharedSetCode).

            <M-18 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-6552':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
    
            if viLocalReturnStatus >= 0
            then assign viLocalReturnStatus = -1.

        end.
    end.
end.

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturnStatus.