DEFINITION Vrai_660003961 1
DEFINITION Faux_660003961 0
DEFINITION NUMTAB_660003961 1
DEFINITION ZONEMETRO_660003961 7
DEFINITION TD_Imsi_660003961 0
DEFINITION STCK_KO_660003961 0
DEFINITION MODULE_DISTR_660003961 0xA000
DEFINITION ERR_DUPL_660003961 0x0D0
DEFINITION ERR_DISTR_660003961 0x110
DEFINITION EFFICACE_660003961 0x01
DEFINITION FORMAT_ECC_660003961 "Format_ECC"
REGISTRE ENTIER erreur_660003961
REGISTRE ENTIER code_rejet_660003961
REGISTRE ENTIER ic_network_660003961
REGISTRE ENTIER type_cra_660003961
REGISTRE ENTIER date_cra_660003961
REGISTRE ENTIER gmt_date_cra_660003961
REGISTRE ENTIER date_fin_660003961
REGISTRE ENTIER indice_660003961
REGISTRE ENTIER indice2_660003961
REGISTRE ENTIER val_champ_660003961
REGISTRE ENTIER SSCode1_660003961
REGISTRE ENTIER SSCode2_660003961
REGISTRE ENTIER SSCode3_660003961
REGISTRE ENTIER SSCode4_660003961
REGISTRE ENTIER UTCOffcode_660003961
REGISTRE ENTIER UTCOffcode_map_660003961
REGISTRE ENTIER chrgdItem_prio_660003961
REGISTRE ENTIER chrgdItem_priout_660003961
REGISTRE ENTIER ic_chrgItem_prio_660003961
REGISTRE ENTIER ic_chrgItem_660003961
REGISTRE ENTIER ic_charge_660003961
REGISTRE ENTIER ic_chgblUnit_660003961
REGISTRE ENTIER val_chgblUnit_660003961
REGISTRE ENTIER val_chgdUnit_660003961
REGISTRE ENTIER val_charge_660003961
REGISTRE ENTIER maj_ChrgUnitsTotalDur_660003961
REGISTRE ENTIER chargeSM_660003961
REGISTRE ENTIER chargeSM_00_660003961
REGISTRE ENTIER chgblUnitsSM_660003961
REGISTRE ENTIER chgdUnitsSM_660003961
REGISTRE ENTIER appel_sms_660003961
REGISTRE ENTIER instECC_660003961
REGISTRE ENTIER instanceECC_660003961
REGISTRE ENTIER nombreECC_660003961
REGISTRE ENTIER res_660003961
REGISTRE ENTIER instMSFDCH_660003961
REGISTRE ENTIER instNVDDCH_660003961
REGISTRE ENTIER instVDIDCH_660003961
REGISTRE ENTIER instOLADCH_660003961
REGISTRE ENTIER instOL2DCH_660003961
REGISTRE ENTIER instOL3DCH_660003961
REGISTRE ENTIER instOR5DCH_660003961
REGISTRE ENTIER instCMODCH_660003961
REGISTRE ENTIER instM1GDCH_660003961
REGISTRE ENTIER instFEGSM_660003961
REGISTRE ENTIER instNVCDCH_660003961
REGISTRE POINTEUR pt_IMSI_660003961
REGISTRE POINTEUR pt_Min_DCB_660003961
REGISTRE POINTEUR pt_ChargeDatePtr_660003961
REGISTRE POINTEUR pt_ChargeDateRes_660003961
REGISTRE POINTEUR pt_callingNumber_660003961
REGISTRE POINTEUR pt_chrgItem_cour_660003961
REGISTRE POINTEUR pt_chrgItem_660003961
REGISTRE POINTEUR pt_ic_chrgItem_660003961
REGISTRE POINTEUR pt_ic1_chgblUns_660003961
REGISTRE POINTEUR pt_ic2_chgblUns_660003961
REGISTRE POINTEUR pt_ic3_chgblUns_660003961
REGISTRE POINTEUR pt_ic_chgblUns_660003961
REGISTRE POINTEUR pt_ic1_charge_660003961
REGISTRE POINTEUR pt_ic2_charge_660003961
REGISTRE POINTEUR pt_ic3_charge_660003961
REGISTRE POINTEUR pt_ic_charge_660003961
REGISTRE POINTEUR pt_chargeType_660003961
REGISTRE POINTEUR pt_chgblUnitsSM_660003961
REGISTRE POINTEUR pt_chgdUnitsSM_660003961
REGISTRE POINTEUR pt_resultat_660003961
REGISTRE POINTEUR pt_champ_660003961
REGISTRE POINTEUR pt_LibelleAlarme_660003961
REGISTRE POINTEUR pt_NameOfFile_660003961
REGISTRE POINTEUR ptchp_format_660003961
REGISTRE ENTIER b_COMESI_660003961
REGISTRE ENTIER IMSI_Transnational_M2M_660003961
REGISTRE ENTIER REDIST_IMSI_Transnational_M2M_660003961
REGISTRE POINTEUR pt_MCCMNCx_660003961
REGISTRE POINTEUR pt_IMSIy_660003961
REGISTRE POINTEUR str_conteneur_660003961
REGISTRE POINTEUR ptr_res_660003961
#            **   **  *********    ****
#            * * * *      *       *
#            *  *  *      *       *
#            *     *      *       *
#            *     *      *         ***
#
#                     - Pcode du module de distribution : CRAE MTC, article : Tcrae_mtc
#                         - creation le 04/10/2006
#                         - Auteur : RAS
# Ttapin30
# g_iartin   : Tcrae_mtc
# g_iartout  (TAP2++)
# g_iartout5 (TAP2.5)
# g_iartout2 : rejet
#
# HISTORIQUE:
# creation : 04/10/2006
# 18/12/2006: FO381 decalgae du mapping de TAPIN30/UTCTimeOff
# 22/12/2006: FO383 passage des champs <SupSvcActCode> en HEXA
# 27/12/2006: FO395 Mis a jour du champ chargedItem
# 09/02/2007: FO381 annulee
# 14/11/2007: TT0052
# 21/12/2007 : URS G1R6 : retrait ADV-VI et PANEL
# 21/02/2008 : URS G1R6 : report G1R5 (SOFRECOM 3.0/586)
# 19/08/2008 - URS - Param ME-G1R9
# 08/09/2008 - URS - Param ME-G1R9 QC184
# 24/11/2008 - DECI - G2R1 lot2 Transmission des CRAs vers FE
# 04/12/2008 - DECI - G2R1 lot2 Correction QC267 distribution vers IRIS si IMSI FE
# 01/12/2009 - DECI - G2R6 JLGTHE item NFF
# 17/12/2009 - DECI - G2R6 report QC 500 : initialisation pt_champ + lecture de TeleserviceCode si present
# 23/12/2009 - DECI - G2R6 QC367 : (report G2R3C7) le mapping se fait maintenant dans le pcode IECC
# 17/06/2010 - DECI - G3R1 QC657 condition -1 au lieu de 0 pour UTCcode
# 12/10/2010 - DECI - G3R1  QC711
# 10/12/2010 - JLG - G3R1lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 17/08/2011 - DECI - G3R4 lot3 QC852, CRAE enrichissement du libelle des alarmes par le nom du fichier collecte
# 05/09/2011 - DECI - G3R4 evol suite non-reg G3R2C3, G3R3C9 : reinit pt et modif des fcts Ajuster_taille
# 04/10/2011 - DECI - G3R4 QC913 interrogation du referentiel a tort en LocalTime au lieu de GmtTime
# 04/02/2013 - DECI - G3R9 lot2 item COME
# 16/10/2014 - JLG  - G5R2 lot2 : QC1448, filtre IMSI transnational
# 06/11/2014 - JLG  - G5R2 : contournement core sur verbe pcode i_adequation_chaine_expreg (QC1441)
# 03/03/2015 - DERS/JLG  - G4R5lot2 suppresion de VPF
#---------------------------------------------------------------------------------------

#QC913



#QC913

#QC267
#G2R6
#G4R5lot2 suppresion de VPF


#/G2R6

# G5R2lot2, QC1448
#/G5R2lot2, QC1448

# initialisation des variables

type_cra_660003961 = 0x1E
appel_sms_660003961 = 0x00
maj_ChrgUnitsTotalDur_660003961=0
SSCode1_660003961 = 0
SSCode2_660003961 = 0
SSCode3_660003961 = 0
SSCode4_660003961 = 0
instMSFDCH_660003961  = -1

instVDIDCH_660003961  = -1
instOLADCH_660003961  = -1
instOL2DCH_660003961  = -1
instOL3DCH_660003961  = -1
instOR5DCH_660003961  = -1
#G2R6
#G4R5lot2 suppresion de VPF
#/G2R6
instCMODCH_660003961  = -1
instM1GDCH_660003961  = -1
# QC267
instFEGSM_660003961   = -1

b_COMESI_660003961  = 0

pt_IMSI_660003961 = "pt_IMSI24680135790246801111111111111111"
pt_Min_DCB_660003961 = "pt_Min_DCB54714568791"
pt_ChargeDatePtr_660003961 ="19791225102412"
pt_ChargeDateRes_660003961 ="20061026143021"
pt_callingNumber_660003961="pt_callingNumber89765432109876543210"
pt_ic_chrgItem_660003961 ="Ms12"
pt_chrgItem_cour_660003961 ="Ns12"
pt_chrgItem_660003961="chargedItem1234"
pt_ic1_chgblUns_660003961="3120"
pt_ic2_chgblUns_660003961="1122"
pt_ic3_chgblUns_660003961="1113_1111"
pt_ic_chgblUns_660003961="chgblUnits1113_1111"
pt_chgblUnitsSM_660003961="241256"
pt_chgdUnitsSM_660003961 ="475478"
pt_ic1_charge_660003961="5555"
pt_ic2_charge_660003961="1717"
pt_ic3_charge_660003961="5555_1717"
pt_ic_charge_660003961 ="charge5555_1717"
pt_resultat_660003961="745894512356748"
pt_chargeType_660003961 ="5927"
pt_champ_660003961="57682"
ptchp_format_660003961="ptchp_formatptchp_format"

pt_LibelleAlarme_660003961="pt_LibelleAlarme_111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
i_strcpy(pt_LibelleAlarme_660003961,"")
pt_NameOfFile_660003961="NameOfFile0123456780111111111111189012345678901234567890123456789012345672345678190123456789012345678901234567890123456789012345"
i_strcpy(pt_NameOfFile_660003961,"")

# G5R2lot2, QC1448
IMSI_Transnational_M2M_660003961 = 0
REDIST_IMSI_Transnational_M2M_660003961 = 0
pt_MCCMNCx_660003961 = "pt_MCCMNCx12"
i_strcpy(pt_MCCMNCx_660003961,"")
pt_IMSIy_660003961   = "pt_IMSIy1234"
i_strcpy(pt_IMSIy_660003961,"")
str_conteneur_660003961 = "str_conteneur123456789"
i_strcpy(str_conteneur_660003961,"")
ptr_res_660003961    = "ptr_res12345"
i_strcpy(ptr_res_660003961,"")
#/G5R2lot2, QC1448


trace("   -----------------------------------------------"   )
trace("  |  TCRAE_MTC :DEBUT PCODE DE DISTRIBUTION MTC   |"  )
trace("   -----------------------------------------------"   )

i_strcpy(pt_IMSI_660003961,"")
i_strcpy(pt_Min_DCB_660003961,"")
i_strcpy(pt_ChargeDateRes_660003961,"")
i_strcpy(pt_callingNumber_660003961,"")
i_strcpy(pt_chrgItem_cour_660003961,"")
i_strcpy(pt_ic_chrgItem_660003961,"")
i_strcpy(pt_ic1_chgblUns_660003961,"")
i_strcpy(pt_ic2_chgblUns_660003961,"")
i_strcpy(pt_ic1_charge_660003961,"")
i_strcpy(pt_ic2_charge_660003961,"")
i_strcpy(pt_chargeType_660003961,"")
#i_strcpy(pt_chgblUnitsSM,"") fait plus bas
#i_strcpy(pt_chgdUnitsSM,"") fait plus bas
#i_strcpy(pt_resultat,"")  fait plus bas


# QC 500 : initialisation pt_champ
#i_strcpy(pt_champ, "") fait plus bas

# G3R4 QC852
erreur_660003961 = i_get_art_str(g_iartin, $Tcrae_mtc::NameOfFile, pt_NameOfFile_660003961)
# /G3R4 QC852

# --------------------------------------------------------------------------
#| Recherer IMSI a partir du MSISDN                                         |
# --------------------------------------------------------------------------
date_cra_660003961  = i_get_art_field(g_iartin, $Tcrae_mtc::ddebut)
#QC913
gmt_date_cra_660003961 = i_DHgetCe2gTime(NUMTAB_660003961,ZONEMETRO_660003961,date_cra_660003961)

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::IMSI))
ALORS
  trace("<<<__LINE__<<<__FILE__<<< MAJ du champ <IMSI> avec le champ IMSI  d entree")
  erreur_660003961 = i_get_art_str(g_iartin, $Tcrae_mtc::IMSI, pt_IMSI_660003961)
SINON
  trace("<<<__LINE__<<<__FILE__<<< MAJ du champ <IMSI> avec le champ Min  d entree")
  erreur_660003961 = i_get_art_str(g_iartin, $Tcrae_mtc::Min, pt_IMSI_660003961)
FINSI

# G5R2 lot2
# calcul de pt_MCCMNCx, pt_IMSIy, IMSI_Transnational_M2M
i_get_sub_str(pt_IMSI_660003961, 0, 5, pt_MCCMNCx_660003961)
i_get_sub_str(pt_IMSI_660003961, 6, 6, pt_IMSIy_660003961)
erreur_660003961 = i_format_str2(str_conteneur_660003961, "%s%s", "M2M_", pt_MCCMNCx_660003961)
i_strcpy(ptr_res_660003961, i_get_tab_field("MVNO", date_cra_660003961, str_conteneur_660003961))
# equivallent a QC1441 : anomalie core de i_adequation_chaine_expreg
SI (i_strcmp(pt_IMSIy_660003961, "") != 0 && i_strcmp(ptr_res_660003961, "") != 0)
ALORS
  SI ( i_strcmp(ptr_res_660003961,"Tous") == 0 || i_adequation_chaine_expreg(ptr_res_660003961, pt_IMSIy_660003961) == 0)
  ALORS
    IMSI_Transnational_M2M_660003961 = Vrai_660003961
  SINON
    IMSI_Transnational_M2M_660003961 = Faux_660003961
  FINSI
SINON
  IMSI_Transnational_M2M_660003961 = Faux_660003961
FINSI
#/QC1441
#/G5R2 lot2

erreur_660003961 = i_conv_ascii_dcb(pt_IMSI_660003961 , pt_Min_DCB_660003961)
erreur_660003961 = i_EnvoiReqConsTabDist(TD_Imsi_660003961, gmt_date_cra_660003961, pt_Min_DCB_660003961, 8, 0, 1)

trace1("Retour de i_EnvoiReqConsTabDist TD_Imsi = <%d>",erreur_660003961)


SI (erreur_660003961 != 0)
ALORS
  # IMSI inconnu
  SI IMSI_Transnational_M2M_660003961
  ALORS
    REDIST_IMSI_Transnational_M2M_660003961 = 1
  SINON
    SAUT REDISTRIB
  FINSI
FINSI
#/G5R2 lot2

#  ----------------------------------------------------------------------------------
# | duplication vers le format TAP2++ et TAP2.5                                      |
# | g_iartout = TAP2++ et g_iartout2 = TAP2.5                                       |
#  ----------------------------------------------------------------------------------

erreur_660003961 = i_dup_art_dest(g_iartin , g_iartout , "Ttapin30")

SI (erreur_660003961 !=0)
ALORS
  trace("Tcrae_mtc, erreur de duplication vers le format TAPIN30**")
  code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
  erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "Ttapin30", pt_NameOfFile_660003961)
  erreur_660003961 = i_PlvMessEmettre(8852, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
  SAUT STOCKE_ERRONE
FINSI

# complement de duplication hors table  TAPIN40

# mis a jour du champ RecordType
#-----------------------------------------------
erreur_660003961 = i_memcpy_art_field_n(g_iartout , $Ttapin30::RecordType, "30" ,2)

# mis a jour du champ NetworkType
#---------------------------------

erreur_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::NetworkType)
SI( erreur_660003961 == 0)
ALORS
  ic_network_660003961 = $Tcrae_mtc::MtNetworkType
SINON
  ic_network_660003961 = $Tcrae_mtc::NetworkType
FINSI

erreur_660003961 = i_get_art_field(g_iartin, ic_network_660003961)

SI(erreur_660003961 == 1)
ALORS
  erreur_660003961 = i_memcpy_art_field_n(g_iartout, $Ttapin30::NetworkType, "A", 1)
SINON
  SI(erreur_660003961 == 2)
  ALORS
    erreur_660003961 = i_memcpy_art_field_n(g_iartout, $Ttapin30::NetworkType, "B", 1)
  FINSI
FINSI

# mis a jour du champ IMSI
#---------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::IMSI))
ALORS
  erreur_660003961 = i_get_field_str(g_iartin, "IMSI", pt_IMSI_660003961)
SINON
  erreur_660003961 = i_get_field_str(g_iartin, "Min", pt_IMSI_660003961)
FINSI

erreur_660003961 = i_memcpy_art_field_n(g_iartout, $Ttapin30::IMSI, pt_IMSI_660003961, i_strlen(pt_IMSI_660003961))
SI(erreur_660003961!=0)
ALORS
  trace("Tcrae_mtc , erreur de mise a jour du champ <IMSI>")
  code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
  erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "IMSI", pt_NameOfFile_660003961)
  erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
  SAUT STOCKE_ERRONE
FINSI


# mis a jour du champ IMEI
#--------------------------

SI( i_valid_field_n(g_iartin, $Tcrae_mtc::IMEI))
ALORS
  erreur_660003961 = i_get_field_str(g_iartin, "IMEI", pt_IMSI_660003961)
  erreur_660003961 = i_memcpy_art_field_n(g_iartout, $Ttapin30::IMEI ,pt_IMSI_660003961, i_strlen(pt_IMSI_660003961))
  SI(erreur_660003961!=0)
  ALORS
    trace("Tcrae_mtc , erreur de mise a jour du champ <IMEI>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "IMEI", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

# mis a jour des champs Modification Indicator, TON et NPI
#----------------------------------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::callingNumber))
ALORS
  erreur_660003961 = i_memset_field_n(g_iartout, $Ttapin30::ModifIndic, 0x30)
  erreur_660003961 = i_memset_field_n(g_iartout, $Ttapin30::TON, 0x58)
  erreur_660003961 = i_memset_field_n(g_iartout, $Ttapin30::NPI, 0x58)
FINSI

# mis a jour du champ callingNumber
#---------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::callingNumber))
ALORS
  erreur_660003961 = i_get_field_str(g_iartin, "callingNumber", pt_callingNumber_660003961)
  erreur_660003961 = i_memcpy_art_field_n(g_iartout, $Ttapin30::CallingNumber, pt_callingNumber_660003961, i_strlen(pt_callingNumber_660003961))
  SI(erreur_660003961!=0)
  ALORS
    trace("Tcrae_mtc , erreur de mise a jour du champ <CallingNumber>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "CallingNumber", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

# mis a jour des champs ServiceType et ServiceCode
# SI TelserviceCode est present => 0  , Si BearederServiceCode present => 1
#--------------------------------------------------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::TeleserviceCode))
ALORS
  erreur_660003961 = i_memset_field_n(g_iartout ,$Ttapin30::ServiceType, 0x30)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "ServiceCode", g_iartin.TeleserviceCode[], 2)
SINON
  erreur_660003961 = i_memset_field_n(g_iartout ,$Ttapin30::ServiceType, 0x31)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "ServiceCode", g_iartin.BearerSvcCode[], 2)
FINSI

# mis a jour des champs DualServiceType et DualServiceCode
#----------------------------------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::DualTeleservice))
ALORS
  erreur_660003961 = i_memset_field_n(g_iartout ,$Ttapin30::DualSvcType, 0x30)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "DualSvcCode", g_iartin.DualTeleservice[], 2)
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::DualBearerSvc))
ALORS
  erreur_660003961 = i_memset_field_n(g_iartout ,$Ttapin30::DualSvcType, 0x31)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "DualSvcCode", g_iartin.DualBearerSvc[], 2)
FINSI

# mis a jour du champ RadioChanelRequest
#---------------------------------------

val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::RadioChnlReq)
SI( val_champ_660003961 >=0 && val_champ_660003961 <=3)
ALORS
  val_champ_660003961 = val_champ_660003961 + 0x30
  erreur_660003961 =i_memset_field_n(g_iartout, $Ttapin30::RadioChnlReq, val_champ_660003961)
FINSI

# mis a jour du champ RadioChanelUsed
#------------------------------------

val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::RadioChnlUsed)
SI( (val_champ_660003961 ==0 )||(val_champ_660003961 ==1))
ALORS
  val_champ_660003961 = val_champ_660003961 +0x30
  erreur_660003961 =i_memset_field_n(g_iartout, $Ttapin30::RadioChnlUsed, val_champ_660003961)
FINSI

# mis a jour du champ Transparency Indicator
#--------------------------------------------

val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::TransparcIndic)
SI( (val_champ_660003961 ==0)|| (val_champ_660003961 ==1))
ALORS
  val_champ_660003961 = val_champ_660003961 +0x30
  erreur_660003961 =i_memset_field_n(g_iartout, $Ttapin30::TranspIndic, val_champ_660003961)
FINSI

#  -------------------------------------------------------------
# | mis a jour des champs SSCode1,2 et ActionCode1,2            |
#  -------------------------------------------------------------
# FO 383: Passage du champ SupSvcActCode en HEXA

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode1))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode1)
  SI( val_champ_660003961==0x05 )
  ALORS
    trace1("GR1 SupSvcActCode1 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode1", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR1 SupSvcCode1 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode1", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode1",g_iartin.SupSvcCode1[],2)
      SSCode1_660003961 = 1
      # SSCode1 est pris par le premier groupe
      SAUT  DEUXM_SSCODE
    FINSI
  FINSI
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode2))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode2)
  SI( val_champ_660003961==0x05 )
  ALORS
    trace1("GR1 SupSvcActCode2 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode2", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR1 SupSvcCode2 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode1", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode1",g_iartin.SupSvcCode2[],2)
      SSCode2_660003961 = 1
      # SSCode2 est pris par le premier groupe
      SAUT  DEUXM_SSCODE
    FINSI
  FINSI
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode3))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode3)
  SI( val_champ_660003961==0x05 )
  ALORS
    trace1("GR1 SupSvcActCode3 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode3", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR1 SupSvcCode3 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode1", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode1",g_iartin.SupSvcCode3[],2)
      SSCode3_660003961 = 1
      # SSCode2 est pris par le premier groupe
      SAUT  DEUXM_SSCODE
    FINSI
  FINSI
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode4))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode4)
  SI( val_champ_660003961==0x05 )
  ALORS
    trace1("GR1 SupSvcActCode4 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode4", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR1 SupSvcCode4 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode1", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode1",g_iartin.SupSvcCode4[],2)
      SSCode4_660003961 = 1
      # SSCode4 est pris par le premier groupe
      SAUT  DEUXM_SSCODE
    FINSI
  FINSI
FINSI

POINT  DEUXM_SSCODE
## recherche du deuxieme groupe SupSvcAvtCode,SupSvcCode
# si SSCode1,2,3 sont libres , probablement le 4 est pris par le premier groupe
# le test devra se faire jusqu'au le 5 code (4 est provisoire)
# SI( (SSCode1==0) && (SSCode2==0) && (SSCode3==0) && (SSCode4==0))
#-------------------------------------------------------------------------------

SI( (SSCode1_660003961==0) && (SSCode2_660003961==0) && (SSCode3_660003961==0))
ALORS
  SAUT SUITE_MAJ_DUPL
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode2))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode2)
  SI((val_champ_660003961==0x05)&&(SSCode2_660003961==0))
  ALORS
    trace1("GR2 SupSvcActCode2 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode2", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR2 SupSvcCode2 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode2", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode2",g_iartin.SupSvcCode2[],2)
      SAUT SUITE_MAJ_DUPL
    FINSI
  FINSI
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode3))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode3)
  SI((val_champ_660003961==0x05)&&(SSCode3_660003961==0) )
  ALORS
    trace1("GR2 SupSvcActCode3 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode3", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR2 SupSvcCode3 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode2", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode2",g_iartin.SupSvcCode3[],2)
      SAUT SUITE_MAJ_DUPL
    FINSI
  FINSI
FINSI

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::SupSvcActCode4))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::SupSvcActCode4)
  SI((val_champ_660003961==0x05)&&(SSCode4_660003961==0))
  ALORS
    trace1("GR2 SupSvcActCode4 =0x0%x", val_champ_660003961)
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = i_get_field_str(g_iartin, "SupSvcCode4", pt_champ_660003961)
    SI((!i_strcmp(pt_champ_660003961,"28"))||(!i_strcmp(pt_champ_660003961,"29"))||(!i_strcmp(pt_champ_660003961,"2A"))||(!i_strcmp(pt_champ_660003961,"2B")))
    ALORS
      trace2("GR2 SupSvcCode4 =%s", pt_champ_660003961, 0)
      erreur_660003961 = i_memset_field(g_iartout, "ActionCode2", 0x35)
      erreur_660003961 = i_memcpy_art_field(g_iartout,"SSCode2",g_iartin.SupSvcCode4[],2)
    FINSI
  FINSI
FINSI

POINT  SUITE_MAJ_DUPL

# mis a jour du champ RecEntity
#------------------------------
SI(i_valid_field_n(g_iartin, $Tcrae_mtc::RecEntityId))
ALORS
  erreur_660003961 = i_get_field_str(g_iartin, "RecEntityId" , pt_IMSI_660003961)
SINON
  erreur_660003961 = i_get_field_str(g_iartin, "Recipient" , pt_IMSI_660003961)
FINSI

# QC711
SI(erreur_660003961 == 0)
ALORS
  res_660003961 = i_strlen(pt_IMSI_660003961)
  SI( res_660003961 > 15)
  ALORS
    res_660003961 = 15
  FINSI
  erreur_660003961= i_memcpy_art_field(g_iartout,"MscId", pt_IMSI_660003961, res_660003961)
  SI(erreur_660003961 != 0)
  ALORS
    trace("**Tcrae_mtc , erreur de mis a jour du champ <MscId>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "MscId", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

# mis a jour du champ Location Area
#-----------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::LocationArea))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::LocationArea)
# ano 3315
  SI( (val_champ_660003961 >= 0) && (val_champ_660003961 <= 99999) )
# /ano 3315
  ALORS
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = Ajuster_taille_entier2_660003942(val_champ_660003961, 5, pt_champ_660003961)
    erreur_660003961 = i_memcpy_art_field(g_iartout, "LocationArea", pt_champ_660003961 , 5)
  SINON
    erreur_660003961 = i_memcpy_art_field(g_iartout, "LocationArea", "99999", 5)
  FINSI
SINON
  erreur_660003961 = i_memcpy_art_field(g_iartout, "LocationArea", "99999", 5)
FINSI

# mis a jour du champ cellId
#----------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::cellID))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::cellID)
# ano 3315
  SI( (val_champ_660003961 >= 0) && (val_champ_660003961 <= 99999) )
# /ano 3315
  ALORS
    i_strcpy(pt_champ_660003961, "")
    erreur_660003961 = Ajuster_taille_entier2_660003942(val_champ_660003961, 5, pt_champ_660003961)
    erreur_660003961 = i_memcpy_art_field(g_iartout, "CellId", pt_champ_660003961,5)
  SINON
    erreur_660003961 = i_memcpy_art_field(g_iartout, "CellId", "99999", 5)
  FINSI
SINON
  erreur_660003961 = i_memcpy_art_field(g_iartout, "CellId", "99999", 5)
FINSI

# mis a jour du champ Mobile Station Mark  HEXA sign ASCII
#---------------------------------------------------------
SI(!i_valid_field_n(g_iartin, $Tcrae_mtc::mblStMark))
ALORS
  val_champ_660003961 =0x34
SINON
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::mblStMark)
  SI((val_champ_660003961 >=0) && (val_champ_660003961 <=9))
  ALORS
    val_champ_660003961 = val_champ_660003961 + 0x30
  SINON
    val_champ_660003961 = Most_sgn_digit_660003942(val_champ_660003961)
    val_champ_660003961 = val_champ_660003961 + 0x30
  FINSI
FINSI

trace1(" mblStMark = %d", val_champ_660003961)
erreur_660003961 = i_memset_field(g_iartout, "mblStatMark", val_champ_660003961)

# mis a jour du champ CharginDate
#---------------------------------

SI(! i_valid_field_n(g_iartin, $Tcrae_mtc::ChargeDate))
ALORS
  pt_ChargeDatePtr_660003961 = i_get_art_fieldptr(g_iartin, $Tcrae_mtc::ChrgStartTime)
  i_get_sub_str(pt_ChargeDatePtr_660003961 ,2 ,13 , pt_ChargeDateRes_660003961)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "CharginDate", pt_ChargeDateRes_660003961, 12)
FINSI

# mis a jour du champ UTCTimeoffsetCode
#--------------------------------------
UTCOffcode_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::COffsetCode)
UTCOffcode_map_660003961 =0x00
SI(UTCOffcode_660003961 == -1)
ALORS
  UTCOffcode_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::CESOffsetCode)
FINSI
#QC367 : le mapping se fait maintenant dans le pcode IECC
# mapping offssetCode TLV - >TAPIN
#---------------------------------
UTCOffcode_map_660003961 = UTCOffcode_660003961
trace1("**Tcrae_mtc UTCOffcode TLV :<0x%x>", UTCOffcode_660003961)
trace1("**Tcrae_mtc UTCOffcode_map:<0x%x>", UTCOffcode_map_660003961)
#si pas de mapping le champ garde sa valeur par  defaut (espace)
#QC657
SI (UTCOffcode_map_660003961 != -1)
ALORS
  erreur_660003961 = i_memset_field_n(g_iartout ,$Ttapin30::UTCTimeOff, UTCOffcode_map_660003961)
FINSI

#  -----------------------------------------------------------------------------------
# |  Algorithme de calcul des chamsp chargedItem , chgblUnits et chgdUnits            |
# |                                                                                   |
#  -----------------------------------------------------------------------------------
chrgdItem_prio_660003961 ='Z'
ic_chrgItem_prio_660003961 = -1
# QC 500 : lecture de TeleserviceCode si present
SI(i_valid_field_n(g_iartin, $Tcrae_mtc::TeleserviceCode))
ALORS
  i_strcpy(pt_champ_660003961, "")
  erreur_660003961 = i_get_field_str(g_iartin, "TeleserviceCode", pt_champ_660003961)
FINSI

SI(!i_strcmp(pt_champ_660003961, "21"))
ALORS
  trace(" Tcrae_mtc , appel sms ")
  appel_sms_660003961 = 1
FINSI

#  -----------------------------------------------------------------
# | Boucle CHARGED_ITEM_PRIOR determiner le chargedItem prioritaire |
#  -----------------------------------------------------------------
ic_chrgItem_660003961 = 1
ic_chrgItem_prio_660003961 = -1

POINT   CHARGED_ITEM_PRIOR

erreur_660003961 = i_EntierToString(ic_chrgItem_660003961,pt_ic_chrgItem_660003961,4)
erreur_660003961 = i_format_str2(pt_chrgItem_660003961,"%s%s","chargedItem",pt_ic_chrgItem_660003961)
trace2("**Tcrae_mtc champs chargedItem courant est :<%s>", pt_chrgItem_660003961, 0)
erreur_660003961 = i_get_field_str(g_iartin,pt_chrgItem_660003961,pt_chrgItem_cour_660003961)

SI(erreur_660003961 ==0)
ALORS
  trace2("pt_chrgItem est :<%s>", pt_chrgItem_cour_660003961, 0)
  SI(!i_strcmp(pt_chrgItem_cour_660003961,"D") && (chrgdItem_prio_660003961 != 'D'))
  ALORS
    chrgdItem_prio_660003961 = 'D'
    ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
  SINON
    SI(!i_strcmp(pt_chrgItem_cour_660003961,"V") && (chrgdItem_prio_660003961 != 'D') &&(chrgdItem_prio_660003961 != 'V'))
    ALORS
      chrgdItem_prio_660003961 = 'V'
      ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
    SINON
      SI(!i_strcmp(pt_chrgItem_cour_660003961,"E") && (chrgdItem_prio_660003961 != 'D') && (chrgdItem_prio_660003961 != 'V')&&(chrgdItem_prio_660003961 != 'E'))
      ALORS
        chrgdItem_prio_660003961 = 'E'
        ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
      SINON
        SI(!i_strcmp(pt_chrgItem_cour_660003961,"I") && (chrgdItem_prio_660003961 != 'D') && (chrgdItem_prio_660003961 != 'V') && (chrgdItem_prio_660003961 != 'E') && (chrgdItem_prio_660003961 != 'I'))
        ALORS
          chrgdItem_prio_660003961 = 'I'
          ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
        SINON
          SI(!i_strcmp(pt_chrgItem_cour_660003961,"F") && ((chrgdItem_prio_660003961 == 'A') || (chrgdItem_prio_660003961 =='N' ) ||(chrgdItem_prio_660003961 == 'Z')))
          ALORS
            chrgdItem_prio_660003961 = 'F'
            ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
          SINON
            SI(!i_strcmp(pt_chrgItem_cour_660003961,"A") && ((chrgdItem_prio_660003961 == 'N') || (chrgdItem_prio_660003961 == 'Z')))
            ALORS
              chrgdItem_prio_660003961 = 'A'
              ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
            SINON
              SI(!i_strcmp(pt_chrgItem_cour_660003961,"N") && ((chrgdItem_prio_660003961 != 'N') || (chrgdItem_prio_660003961 == 'Z')))
              ALORS
                chrgdItem_prio_660003961 = 'N'
                ic_chrgItem_prio_660003961 = ic_chrgItem_660003961
              FINSI
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI

  ic_chrgItem_660003961 = ic_chrgItem_660003961 +1

  SI( ic_chrgItem_660003961 <5)
  ALORS
    SAUT  CHARGED_ITEM_PRIOR
  FINSI
FINSI

# si chargedItem non trouve on utilisera la valeur par defaut 'N'

#### Debut FO 395

SI(ic_chrgItem_prio_660003961 != -1)
ALORS
  trace1("indice chargeItem prioritaire :<%d>",ic_chrgItem_prio_660003961)
  trace1("Valeur du chargeItem prioritaire :<%x>",chrgdItem_prio_660003961)
  chrgdItem_priout_660003961 = chrgdItem_prio_660003961
FINSI

SI( ic_chrgItem_prio_660003961 == -1)
ALORS
  trace("chargeItem prioritaire non trouve on utilisera la valeur 'N' ")
  chrgdItem_priout_660003961 = 'N'
FINSI

# ---------------------------- ETAPE 2-------------------------------------------------------------------
#| si chargedItem est trouve et vaut N                                                                   |
#|   si Appel SMS et TotalCallEventDuration>0 -> chargedIteme='D' et chargeableUnits=TotalaCallDuration  |
#|   sinon chargedItem = blanc                                                                           |
# --------------------------------------------------------------------------------------------------------
SI(( ic_chrgItem_prio_660003961 != -1) && (chrgdItem_prio_660003961 =='N'))
ALORS
  chrgdItem_priout_660003961 = ' '
SINON
  #  ----------------------- ETAPE 3 ------------
  # | Si Appel SMS  mettre le chargedItem a 'E'  |
  #  --------------------------------------------
  SI(appel_sms_660003961 == 1)
  ALORS
    chrgdItem_priout_660003961 = 'E'
# Ano 3319
  SINON
    chrgdItem_priout_660003961 = 'D'
# /Ano 3319
  FINSI
FINSI

#  ----------------------------- ETAPE 4 -------------------------------------
# | calcul des chargeablesUnits pour le chargedItem courant                   |
# |  et les charges pour tous les chargedItem confondus                       |                            #  ---------------------------------------------------------------------------

SI((ic_chrgItem_prio_660003961 != -1)&&(maj_ChrgUnitsTotalDur_660003961!=1))
ALORS
  chgblUnitsSM_660003961 = 0
  erreur_660003961 = i_EntierToString(ic_chrgItem_prio_660003961,pt_ic1_chgblUns_660003961,4)

  indice_660003961 =10

  POINT  SOM_CHGBLUNITS

  erreur_660003961 = i_EntierToString(indice_660003961,pt_ic2_chgblUns_660003961,4)
  erreur_660003961 = i_format_str2(pt_ic3_chgblUns_660003961,"%s_%s", pt_ic1_chgblUns_660003961, pt_ic2_chgblUns_660003961)
  erreur_660003961  = i_format_str2(pt_ic_chgblUns_660003961, "%s%s", "chgblUnits", pt_ic3_chgblUns_660003961)
  trace2("**Tcrae_mtc ,chargeableUnits nom :<%s>",pt_ic_chgblUns_660003961, 0)
  ic_chgblUnit_660003961 = i_get_field_num(g_iartin, pt_ic_chgblUns_660003961)

  SI( ic_chgblUnit_660003961 != -1)
  ALORS
    val_chgblUnit_660003961 = i_get_art_field(g_iartin, ic_chgblUnit_660003961)
    trace1("val_chgblUnit:<%d>", val_chgblUnit_660003961)

    SI( val_chgblUnit_660003961!=-1 )
    ALORS
      chgblUnitsSM_660003961 = chgblUnitsSM_660003961 + val_chgblUnit_660003961
    FINSI
  FINSI

  SI(indice_660003961 <= 19)
  ALORS
    indice_660003961 = indice_660003961 +1
    SAUT SOM_CHGBLUNITS
  FINSI
FINSI

# calcul des charges pour tous les chargeItem confondus

chargeSM_660003961 =0
indice2_660003961 = 1
chargeSM_00_660003961 = 0

#  SI pas de T3t27.1_charge , ne pas faire des calculs

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::chargedItem1-4))
ALORS

  POINT  SOM_CHARGE_LIST

  indice_660003961 = 10
  erreur_660003961 = i_EntierToString(indice2_660003961 ,pt_ic1_charge_660003961,4)

  POINT  SOM_CHARGES

  erreur_660003961 = i_EntierToString(indice_660003961,pt_ic2_charge_660003961,4)
  erreur_660003961 = i_format_str2(pt_ic3_charge_660003961,"%s_%s", pt_ic1_charge_660003961, pt_ic2_charge_660003961)
  erreur_660003961  = i_format_str2(pt_ic_charge_660003961, "%s%s", "charge", pt_ic3_charge_660003961)
  trace2("**Tcrae_mtc ,charge nom :<%s>",pt_ic_charge_660003961, 0)
  ic_charge_660003961 = i_get_field_num(g_iartin, pt_ic_charge_660003961)
  SI( ic_charge_660003961 != -1)
  ALORS
    val_charge_660003961 = i_get_art_field(g_iartin, ic_charge_660003961)
    trace1("Tcrae_mtc ,ic_charge <%d>", ic_charge_660003961)
    trace1("Tcrae_mtc ,val_charge <%d>", val_charge_660003961)
    SI( val_charge_660003961!=-1 )
    ALORS
      chargeSM_660003961 = chargeSM_660003961 + val_charge_660003961
    FINSI
# calcul des charges dont le charge type est a 0
    erreur_660003961 = i_get_art_str(g_iartin, ic_charge_660003961 +3, pt_chargeType_660003961)
# FO 572
    SI( (i_strcmp(pt_chargeType_660003961, "00")==0) || (i_strcmp(pt_chargeType_660003961, "0")==0) || (i_strcmp(pt_chargeType_660003961, "000")==0) )
# /FO 572
    ALORS
      SI( val_charge_660003961!=-1 )
      ALORS
        chargeSM_00_660003961 = chargeSM_00_660003961 +  val_charge_660003961
      FINSI
    FINSI
  FINSI

  SI(indice_660003961 <=19 )
  ALORS
    indice_660003961 = indice_660003961 +1
    SAUT SOM_CHARGES
  FINSI
  indice2_660003961 = indice2_660003961 +1

#  test provisoire sur 4 (il faut mettre 5)

  SI(indice2_660003961 <= 4)
  ALORS
    SAUT  SOM_CHARGE_LIST
  FINSI
FINSI

trace1("Somme totale des charges :<%d>",chargeSM_660003961)
trace1("Somme totale des charges dont le chargeType=00 :<%d>",chargeSM_00_660003961)
trace1("Somme totale des chgblUnitsSM :<%d>", chgblUnitsSM_660003961 )
#  ------------------------------------------- ETAPE 5 ------------------------------------------------
# | si charedItem n'est pas blanc                                                                      |
# |   si charge > 0 ou chargeableUnits > 0 et appel non SMS et chargedItem !=V => chargedItem =D       |
# |   si charge = 0 et chargeableUnits = 0 => chargedItem => espace                                    |
#  ----------------------------------------------------------------------------------------------------

SI(maj_ChrgUnitsTotalDur_660003961 == 0)
ALORS
  SI(chrgdItem_priout_660003961 != ' ')
  ALORS
    SI((chargeSM_660003961 > 0 || chgblUnitsSM_660003961 > 0) &&(appel_sms_660003961 ==0) &&
      (chrgdItem_prio_660003961 !='V') &&(ic_chrgItem_prio_660003961!=-1))
    ALORS
      chrgdItem_priout_660003961 = 'D'
    FINSI

    SI((chargeSM_660003961 == 0) &&(chgblUnitsSM_660003961 == 0))
    ALORS
      chrgdItem_priout_660003961 = ' '
    FINSI
  FINSI
FINSI
#  -----------------------------------------------------------------------------------
# | chgblUnits = Somme des chgblUnits dont le chargItem est prioritaire                |
# | et chargeType ="00"                                                                |
# | chgdUnits = Somme des chgdUnits dont le chargItem est prioritaire                  |
# | et chargeType ="00"                                                                |
#  ------------------------------------------------------------------------------------

# SI  APPEL SMS , Ne pas faire ces calculs
# Et aussi si le champ est a mettre a jour par TotalCallDuration

SI((appel_sms_660003961 == 0) && (maj_ChrgUnitsTotalDur_660003961!=1))
ALORS
  chgblUnitsSM_660003961 = 0
  chgdUnitsSM_660003961 = 0

  SI(ic_chrgItem_prio_660003961 !=-1)
  ALORS
    erreur_660003961 = i_EntierToString(ic_chrgItem_prio_660003961,pt_ic1_chgblUns_660003961,4)
    indice_660003961 =10

    POINT  SOM_CHGBLUNITS_00

    erreur_660003961 = i_EntierToString(indice_660003961,pt_ic2_chgblUns_660003961,4)
    erreur_660003961 = i_format_str2(pt_ic3_chgblUns_660003961,"%s_%s", pt_ic1_chgblUns_660003961, pt_ic2_chgblUns_660003961)
    erreur_660003961  = i_format_str2(pt_ic_chgblUns_660003961, "%s%s", "chgblUnits", pt_ic3_chgblUns_660003961)
    trace2("**Tcrae_mtc ,chargeableUnits nom :<%s>",pt_ic_chgblUns_660003961, 0)
    ic_chgblUnit_660003961 = i_get_field_num(g_iartin,pt_ic_chgblUns_660003961)
    erreur_660003961 = i_get_art_str(g_iartin, ic_chgblUnit_660003961 +2, pt_chargeType_660003961)
    trace2("pt_chargeType = %s",pt_chargeType_660003961,0)
    # FO 572
    SI( (i_strcmp(pt_chargeType_660003961, "00")==0) || (i_strcmp(pt_chargeType_660003961, "0")==0) || (i_strcmp(pt_chargeType_660003961, "000")==0))
      # /FO 572
    ALORS
      val_chgblUnit_660003961 = i_get_art_field(g_iartin, ic_chgblUnit_660003961)
      val_chgdUnit_660003961 = i_get_art_field(g_iartin, ic_chgblUnit_660003961 +1)
      trace1("val_chgblUnit = %x",val_chgblUnit_660003961)
      trace1("val_chgdUnit = %x",val_chgdUnit_660003961)

      SI( val_chgblUnit_660003961 != -1)
      ALORS
        chgblUnitsSM_660003961 = chgblUnitsSM_660003961 + val_chgblUnit_660003961
      FINSI

      SI( val_chgdUnit_660003961 != -1)
      ALORS
        chgdUnitsSM_660003961 = chgdUnitsSM_660003961 + val_chgdUnit_660003961
      FINSI
    FINSI
    SI(indice_660003961 <= 19 )
    ALORS
      indice_660003961 = indice_660003961 +1
      SAUT SOM_CHGBLUNITS_00
    FINSI
  FINSI
FINSI

# mis a jour du champ charge
# charge <- somme des charges
#-----------------------------
i_strcpy(pt_resultat_660003961, "")
erreur_660003961  = Ajuster_taille_entier2_660003942(chargeSM_00_660003961, 9, pt_resultat_660003961)
erreur_660003961 = i_memcpy_art_field(g_iartout , "Charge", pt_resultat_660003961, 9)
SI(erreur_660003961!=0)
ALORS
  trace("Tcrae_mtc , erreur de mise a jour du champ <charge>")
  code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
  erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "charge", pt_NameOfFile_660003961)
  erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
  SAUT STOCKE_ERRONE
FINSI

# mis a jour du champ chargedItem
#---------------------------------

erreur_660003961 = i_memset_field(g_iartout, "ChargedItem", chrgdItem_priout_660003961)

#### Fin FO 395

# mis a jour du champ TaxeRateCode
#----------------------------------

# mis a jour du champ du champ ExchngRateCode
#---------------------------------------------
SI(chargeSM_00_660003961 != 0)
ALORS
  erreur_660003961 = i_memset_field(g_iartout,"ExchngRate", 0x45)
FINSI

# mis a jour du champ ClirIndic
#-----------------------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::ClirIndic))
ALORS
  val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::ClirIndic)
  SI((val_champ_660003961 >=0) && (val_champ_660003961 <=9))
  ALORS
    val_champ_660003961 = val_champ_660003961 + 0x30
  SINON
    val_champ_660003961 = Most_sgn_digit_660003942(val_champ_660003961)
    val_champ_660003961 = val_champ_660003961 + 0x30
  FINSI
  trace1("ClirIndic = %d", val_champ_660003961)
  erreur_660003961 = i_memset_field(g_iartout, "ClirIndic",val_champ_660003961)
FINSI

# mis a jour du champ IdCrae
#---------------------------

SI(i_valid_field_n(g_iartin, $Tcrae_mtc::IdCrae))
ALORS
  erreur_660003961 = i_memcpy_art_field(g_iartout, "IdCrae" , g_iartin.IdCrae[], 8)
FINSI

# Duplication de g_iartout(TAP2++) dans g_iartout5 (TAP2.5)
#----------------------------------------------------------

erreur_660003961 = i_dup_art_id(g_iartout, g_iartout5)

SI(maj_ChrgUnitsTotalDur_660003961 == 0)
ALORS

  #  ----------------------------------------------------------------------
  # |mis a jour du champ chgblUnits <- somme des chargeableUnits [TAP2++]  |
  #  ----------------------------------------------------------------------

  SI(appel_sms_660003961 == 1)
  ALORS
    erreur_660003961 = i_memcpy_art_field(g_iartout , "ChgblUnits", "000001",6)
  SINON
    trace1("chgblUnitsSM =<%d>", chgblUnitsSM_660003961)
    i_strcpy(pt_chgblUnitsSM_660003961, "")
    erreur_660003961 = Ajuster_taille_entier2_660003942(chgblUnitsSM_660003961, 6, pt_chgblUnitsSM_660003961)
    trace2("pt_chgblUnitsSM =<%s>", pt_chgblUnitsSM_660003961,0)
    erreur_660003961 = i_memcpy_art_field(g_iartout , "ChgblUnits",  pt_chgblUnitsSM_660003961, 6)
    SI(erreur_660003961!=0)
    ALORS
      trace("Tcrae_mtc , erreur de mise a jour du champ <chgblUnits>")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "chgblUnits", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

  #  -------------------------------------------------------------------
  # |mis a jour du champ chgblUnits <- somme des chargedUnits [TAP2.5]  |
  #  -------------------------------------------------------------------

  SI(appel_sms_660003961 == 1)
  ALORS
    erreur_660003961 = i_memcpy_art_field(g_iartout5 , "ChgblUnits", "000000",6)
  SINON
    trace1("chgdUnitsSM :<%d>", chgdUnitsSM_660003961)
    i_strcpy(pt_chgdUnitsSM_660003961, "")
    erreur_660003961 = Ajuster_taille_entier2_660003942(chgdUnitsSM_660003961, 6, pt_chgdUnitsSM_660003961)
    trace2("pt_chgdUnitsSM =<%s>", pt_chgdUnitsSM_660003961,0)
    erreur_660003961 = i_memcpy_art_field(g_iartout5 , "ChgblUnits",  pt_chgdUnitsSM_660003961, 6)
    SI(erreur_660003961!=0)
    ALORS
      trace("Tcrae_mtc , erreur de mise a jour du champ <chgblUnits>")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "chgblUnits", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI
FINSI

#  -----------------------------------------------------------------------------
# | mis a jour du champ DatVolumeReference              [TAP2++]                |
# | DatVolumRef -> somme des chargeableUnits                                    |
#  -----------------------------------------------------------------------------

val_champ_660003961 = i_get_art_field(g_iartin, $Tcrae_mtc::DataVolumeRef)
SI(( val_champ_660003961 >= 0) && (val_champ_660003961 <= 999999))
ALORS
  i_strcpy(pt_resultat_660003961, "")
  erreur_660003961 = Ajuster_taille_entier2_660003942(val_champ_660003961, 6, pt_resultat_660003961)
  erreur_660003961 = i_memcpy_art_field(g_iartout, "DataVolumeRef", pt_resultat_660003961, 6)
SINON
  erreur_660003961 =  i_memcpy_art_field(g_iartout, "DataVolumeRef","000000", 6)
FINSI

SI(erreur_660003961!=0)
ALORS
  trace("Tcrae_mtc , erreur de mise a jour du champ <DataVolumRef>")
  code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
  erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "DataVolumRef", pt_NameOfFile_660003961)
  erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
  SAUT STOCKE_ERRONE
FINSI

#  -----------------------------------------------------------------------------
# | mis a jour du champ DatVolumeReference              [TAP2.5]                |
# | DatVolumRef -> somme des chargeableUnits                                    |
#  -----------------------------------------------------------------------------

SI(appel_sms_660003961 == 1)
ALORS
  erreur_660003961 = i_memcpy_art_field(g_iartout5 , "DataVolumeRef", "000001",6)
SINON
  i_strcpy(pt_chgblUnitsSM_660003961, "")
  erreur_660003961 = Ajuster_taille_entier2_660003942(chgblUnitsSM_660003961, 6, pt_chgblUnitsSM_660003961)
  erreur_660003961 = i_memcpy_art_field(g_iartout5 , "DataVolumeRef", pt_chgblUnitsSM_660003961, 6)
  SI(erreur_660003961!=0)
  ALORS
    trace("Tcrae_mtc , erreur de mise a jour du champ <DataVolumRef>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DUPL_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "DataVolumRef", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8851, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

#------------------------------- FIN DE DUPLICATION ------------------------------

# G5R2lot2, QC1448
SI REDIST_IMSI_Transnational_M2M_660003961
ALORS
	SAUT PT_REDIS_Transnational
FINSI
#/G5R2lot2, QC1448

# -------------------------------------------------------------------------------
#| Attente requete Table de Distribution                                         |
# -------------------------------------------------------------------------------
date_fin_660003961  = i_get_art_field(g_iartin, $Tcrae_mtc::dfin)

erreur_660003961 = i_LireReqConsTabDist()

SI (erreur_660003961 != 0)
ALORS
  # IMSI inconnu
  # G5R2lot2, QC1448
  SI IMSI_Transnational_M2M_660003961
  ALORS
    # IMSI Inconnu et transnational
    REDIST_IMSI_Transnational_M2M_660003961 = 1
    SAUT PT_REDIS_Transnational
  SINON
    # ---------------------------------------------------
    # Redistribution
    # ---------------------------------------------------
    SAUT REDISTRIB
  FINSI
  #/G5R2lot2, QC1448
FINSI


nombreECC_660003961 = i_LireNombreECC()
trace1("<<<__LINE__<<<__FILE__<<<  Retour i_LireNombreECC :<%d>", nombreECC_660003961)

SI (nombreECC_660003961 == 0)
ALORS
  # ECC absente
  # G5R2lot2, QC1448
  SI IMSI_Transnational_M2M_660003961
  ALORS
    # IMSI Inconnu et transnational
    REDIST_IMSI_Transnational_M2M_660003961 = 1
    SAUT PT_REDIS_Transnational
  SINON
    SAUT REDISTRIB
  FINSI
  #/G5R2lot2, QC1448
FINSI

instECC_660003961 = i_LireEntierECC(0)

SI (instECC_660003961 == -1)
ALORS
  # IMSI inconnu
  # G5R2lot2, QC1448
  SI IMSI_Transnational_M2M_660003961
  ALORS
    # IMSI Inconnu et transnational
    REDIST_IMSI_Transnational_M2M_660003961 = 1
    SAUT PT_REDIS_Transnational
  SINON
    SAUT REDISTRIB
  FINSI
  #/G5R2lot2, QC1448
FINSI


# G5R2lot2, QC1448
POINT PT_REDIS_Transnational

SI REDIST_IMSI_Transnational_M2M_660003961
ALORS
  trace("<<<__LINE__<<<__FILE__<<< **** NVDDCH ****")
  
  # Ajout dans le CRA du champ numero de filtre
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)
  SI (erreur_660003961!=0)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Erreur d'ajout du TLV <T3t3_NumOfFilte>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NumOfFilter", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8833, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  
  # Enrichissement du CRA par le numero de filtre
  erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x38)
  
  # Distribution vers NVDDCH
  instanceECC_660003961 = i_LireInstanceECC("NVDDCH")
  SI (instanceECC_660003961 == -1)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Pas d'instance : NVDDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVDDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8834, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("<<<__LINE__<<<__FILE__<<< application NVDDCH")
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "NVDDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instanceECC_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)
  
  SAUT ECC_SECONDAIRES
FINSI
#/G5R2lot2, QC1448

trace1("<<<__LINE__<<<__FILE__<<< Retour de i_LireEntierECC = <%d>",instECC_660003961 )

POINT CRITERES_DISTRI

# -------------------------------- MSFDCH (DISE) poubelle NVDDCH ---------------------------------------------
# ------------------------------------------------------
#| Critre de distribution vers DISE                     |
# ------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("MSFGSM"))
ALORS
  instMSFDCH_660003961 = i_LireInstanceECC("MSFDCH")
  SI( chargeSM_00_660003961 != 0x00)
  ALORS
    trace("**** MSFDCH ****")
    # recherche dans la table externe Format_ECC le format de l'application
    SI(instMSFDCH_660003961 == -1)
    ALORS
      trace("Pas d'instance : MSFDCH")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "MSFDCH", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
    trace("aplication MSFDCH")
    instanceECC_660003961 = instMSFDCH_660003961
    
    ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "MSFDCH")
  SINON

# NVDDCG recoit les CRAS dont le montant des charges est nul

    trace("**** NVDDCH ****")
    # Enrichissement du CRA par le numero de filter
    erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
    erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)

    SI(erreur_660003961!=0)
    ALORS
      trace("Erreur d'ajout du TLV <T3t3_NumOfFilte>")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NumOfFilter", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8853, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
    erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x10)
    instanceECC_660003961 = i_LireInstanceECC("NVDDCH")

    SI(instanceECC_660003961 == -1)
    ALORS
      trace("Pas d'instance : NVDDCH")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVDDCH", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
    trace("aplication NVDCH")
    
    ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "NVDDCH")
  FINSI
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instanceECC_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application MSFDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "MSFDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI

# G3R9 item COME
# -------------------------------- COMCH ou FRCDCH poubelle NVCDCH -------------------------------------------
# calcul de b_COMESI et des ID-instance de COMDCH et sinon FRCDCH
SI (instECC_660003961 == i_LireInstanceECC("COMGSM"))
ALORS
	b_COMESI_660003961 = 1
SINON
	SI (instECC_660003961 == i_LireInstanceECC("FRCGSM"))
	ALORS
		b_COMESI_660003961 = 2
	FINSI
FINSI

SI (b_COMESI_660003961)
ALORS
  instNVCDCH_660003961 = i_LireInstanceECC("NVCDCH")
  SI (instNVCDCH_660003961 == -1)
  ALORS
    trace("Pas d'instance : NVCDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVCDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  # Enrichissement du CRA par le numero de filter
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)
  erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x14)

  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "NVCDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instNVCDCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)
  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application NVCDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVCDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  SAUT ECC_SECONDAIRES
FINSI

# -------------------------------- FEDCH poubelle NVDDCH -----------------------------------------------------
#----------------#
#G3R9 lot2 FE
#----------------#
# QC267
SI (instECC_660003961 == i_LireInstanceECC("FEGSM"))
ALORS
  trace("**** NVDDCH ****")
  instFEGSM_660003961 = i_LireInstanceECC("FEGSM")
  # Enrichissement du CRA par le numero de filter
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)
  SI(erreur_660003961!=0)
  ALORS
    trace("Erreur d'ajout du TLV <T3t3_NumOfFilte>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NumOfFilter", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8853, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x13)
  instNVDDCH_660003961 = i_LireInstanceECC("NVDDCH")

  SI (instNVDDCH_660003961 == -1)
  ALORS
    trace("Pas d'instance : NVDDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVDDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("aplication NVDCH")
  
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "NVDDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instNVDDCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)
  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application NVDDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NVDDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  SAUT ECC_SECONDAIRES
FINSI

#/G3R9 lot2 FE

# -------------------- VDIDCH, OLADCH, OL2DCH, OL3DCH, OR5DCH (ADV) poubelle NVADCH --------------------------
# ----------------------------------------------------
#| criteres de distribution vers ADV                  |
# ----------------------------------------------------
#| Distribution vers l' application VDIDCH            |
# ----------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("VDIGSM"))
ALORS
  trace("**** VDIDCH ****")
  instVDIDCH_660003961 = i_LireInstanceECC("VDIDCH")

  SI(instVDIDCH_660003961 == -1)
  ALORS
    trace("Pas d'ECC : VDIDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "VDIDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("aplication VDIDCH")
  # recherche dans la table externe Format_ECC le format de l'application
  
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "VDIDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instVDIDCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application VDIDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "VDIDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI

# -------------------------------------------------------------------------------
#|  Distribution vers l'application OLADCH                                       |
# -------------------------------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("OLAGSM"))
ALORS
  trace("**** OLADCH ****")
  instOLADCH_660003961 = i_LireInstanceECC("OLADCH")

  SI(instOLADCH_660003961 == -1)
  ALORS
    trace("Pas d'ECC : OLADCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OLADCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application OLADCH")
  # recherche dans la table externe Format_ECC le format de l'application
  
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "OLADCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instOLADCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application OLADCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OLADCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI

# --------------------------------------------------------------------------------
#|  Distribution vers l'application OL2DCH                                        |
# --------------------------------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("OL2GSM"))
ALORS
  trace("**** OL2DCH ****")
  instOL2DCH_660003961 = i_LireInstanceECC("OL2DCH")

  SI(instOL2DCH_660003961 == -1)
  ALORS
    trace("Pas d'ECC : OLA2DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OL2DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application OL2DCH")
  # recherche dans la table externe Format_ECC le format de l'application
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "OL2DCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instOL2DCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application OL2DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OL2DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI
# --------------------------------------------------------------------------------
#| Distribution vers l'application OL3DCH                                         |
# --------------------------------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("OL3GSM"))
ALORS
  trace("**** OL3DCH ****")
  instOL3DCH_660003961 = i_LireInstanceECC("OL3DCH")

  SI(instOL3DCH_660003961 == -1)
  ALORS
    trace("Pas d'ECC : OLA3DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OL3DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application OL3DCH")
  # recherche dans la table externe Format_ECC le format de l'application
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "OL3DCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instOL3DCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application OL3DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OL3DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI
# -------------------------------------------------------------------------------
#| Distribution vers l'application OR5DCH                                        |
# -------------------------------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("OR5GSM"))
ALORS
  trace("**** OR5DCH ****")
  instOR5DCH_660003961 = i_LireInstanceECC("OR5DCH")

  SI(instOR5DCH_660003961 == -1)
  ALORS
    trace("pas d'instance OR5DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OR5DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application OR5DCH")
  # recherche dans la table externe Format_ECC le format de l'application
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "OR5DCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instOR5DCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application OR5DCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "OR5DCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  SAUT ECC_SECONDAIRES
FINSI

#-------- Fin distribition vers lme le groupe ADV ---------------------

#G4R5lot2 suppresion de VPF -------------------------------- VPFDCH poubelle NVFDCH ----------------------------------------------------
# -------------------------------- SHACHEM Mobicarte, CMODCH, M1GDCH------------------------------------------
#  -------------------------------------------------------------------
# | Distribution vers SHACHEM Mobicarte                               |
# | M1GDCH application poubelle de SHACHEM Mobicarte                  |
#  -------------------------------------------------------------------

SI(instECC_660003961 == i_LireInstanceECC("SHMGSM"))
ALORS
  trace("**** M1GDCH ****")
  instM1GDCH_660003961 = i_LireInstanceECC("M1GDCH")

  SI(instM1GDCH_660003961 == -1)
  ALORS
    trace("pas d'instance M1GDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "M1GDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application M1GDCH")
  # Enrichissement du CRA par le numero de filter
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)

  SI(erreur_660003961!=0)
  ALORS
    trace("Erreur d'ajout du TLV <T3t3_NumOfFilte>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NumOfFilter", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8853, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x11)

  # recherche dans la table externe Format_ECC le format de l'application
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "M1GDCH")

  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instM1GDCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)
  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application M1GDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "M1GDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI

# -------------------------------- SHACHEM CMO, CMODCH -------------------------------------------------------
#  -------------------------------------------------------------------
# | Distribution vers SHACHEM CMO                                     |
# | CMODCH application poubelle de SHACHEM CMO                        |
#  -------------------------------------------------------------------
SI(instECC_660003961 == i_LireInstanceECC("SHPGSM"))
ALORS
  trace("**** CMODCH ****")
  instCMODCH_660003961 = i_LireInstanceECC("CMODCH")

  SI(instCMODCH_660003961 == -1)
  ALORS
    trace("Tcrae_mtc: pas d'ECC CMODCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "CMODCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8854, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  trace("application CMODCH")
  # Enrichissement du CRA par le numero de filter
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t3_NumOfFilte", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t3_NumOfFilte", "NumOfFilter", 1)

  SI(erreur_660003961!=0)
  ALORS
    trace("Erreur d'ajout du TLV <T3t3_NumOfFilte>")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "NumOfFilter", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8853, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
  erreur_660003961 = i_set_art_field(g_iartin, $Tcrae_mtc::NumOfFilter, 0x12)

  # recherche dans la table externe Format_ECC le format de l'application
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "CMODCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instCMODCH_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'apllication CMODCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "CMODCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI

  SAUT ECC_SECONDAIRES
FINSI

#  ----------------------------------------------------------------------
# | Application de redistribution                                        |
# | si CRA issu redistribue pendant 7 jours  => FRAUDE                   |
# | sinon envoi vers l'application poubelle                              |
#  ----------------------------------------------------------------------

POINT REDISTRIB

SI (i_valid_field_n(g_iartin, $Tcrae_mtc::T3t2_DateOfRedi) == 0)
ALORS
  erreur_660003961 = i_ajout_tlv(g_iartin, "T3t2_DateOfRedi", "")
  erreur_660003961 = i_resize_tlv(g_iartin, "T3t2_DateOfRedi", "DateOfRedistri",4)
  erreur_660003961 = i_set_art_field(g_iartin ,$Tcrae_mtc::DateOfRedistri ,i_cur_time())
FINSI

val_champ_660003961 = i_get_art_field(g_iartin ,$Tcrae_mtc::DateOfRedistri)


# ----------------------------------------------------------------------------------
#| Envoi vers l'application ECDDCH tout CRA redistribue entre 0 et 6 jours          |
# ----------------------------------------------------------------------------------
# G1R9 QC184
instanceECC_660003961 =i_LireInstanceECC("ECDDCH")

SI(instanceECC_660003961 != -1)
ALORS
  trace("application ECDHDCH")
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "ECDDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instanceECC_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961 == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application ECDDCH")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "ECDDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI
# / G1R9 QC184

POINT  ECC_SECONDAIRES

# ----------------------------------------------------
#| envoi inconditionnel vers l'application SYMPHONIE  |
# ----------------------------------------------------
instanceECC_660003961 = i_LireInstanceECC("SYMDCH")
SI(instanceECC_660003961 != -1)
ALORS
  trace("application SYMPHONIE")
  ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "SYMDCH")
  res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instanceECC_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)

  SI(res_660003961  == STCK_KO_660003961)
  ALORS
    trace("**Tcrae_mtc , erreur d'envoi de l'article vers l'application SYMPHONIE")
    code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
    erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "SYMDCH", pt_NameOfFile_660003961)
    erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

#  -----------------------------------------------------------------------------------------------
# | application secondaire de (ADV, DISE, COME, SHACHEM Mobicarte et SHACHEM CMO)            |
# | IRIS                                                                                          |
#  -----------------------------------------------------------------------------------------------
# G3R9 lot2 item COME
#G4R5lot2 suppresion de VPF
SI (instMSFDCH_660003961 > 0 || instVDIDCH_660003961 > 0 || instOLADCH_660003961 > 0 || instFEGSM_660003961  > 0 ||
    instOL2DCH_660003961 > 0 || instOL3DCH_660003961 > 0 || instOR5DCH_660003961 > 0 || instM1GDCH_660003961 > 0 ||
    instCMODCH_660003961 > 0 || b_COMESI_660003961)
ALORS
  #  Application IRIS
  #-------------------------------------------------------------------------------------
  instanceECC_660003961 = i_LireInstanceECC("IRIDCH")

  SI(instanceECC_660003961 != -1)
  ALORS
    trace("application IRIS")
    ptchp_format_660003961 = i_get_tab_field(FORMAT_ECC_660003961, date_cra_660003961, "IRIDCH")
    res_660003961 = Stockage_Article_660003942(g_iartin, g_iartout, g_iartout5, instanceECC_660003961 , ptchp_format_660003961, date_fin_660003961, type_cra_660003961)
    SI(res_660003961  == STCK_KO_660003961)
    ALORS
      trace("**Tcrae_mtc , erreur d'envoi de l'article a l'application IRIS")
      code_rejet_660003961 = MODULE_DISTR_660003961 + ERR_DISTR_660003961 + EFFICACE_660003961
      erreur_660003961 = i_format_str2(pt_LibelleAlarme_660003961, "%s> <f=%s", "IRIDCH", pt_NameOfFile_660003961)
      erreur_660003961 = i_PlvMessEmettre(8855, 2, g_iartin, "", 2, code_rejet_660003961, pt_LibelleAlarme_660003961, 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI
FINSI


trace("****TCRAE_MTC : FIN PCODE DU MODULE DE DISTRIBUTION OK****")

#-----------------------------------FIN PCODE DISTRIBUTION MTC -----------------------------------------

RETOUR TRAIT_OK

# stockage de l'article en errone

POINT STOCKE_ERRONE

erreur_660003961 = i_make_art_rej(g_iartin, g_iartout2, code_rejet_660003961)
erreur_660003961 = i_stocke_art(g_iartout2,0,PT_ERRONE,0)
trace("**Tcrae_mtc , Artcile stocke en errone**")
#      RETOUR TRAIT_OK
RETOUR BAD_BLOC
#------------------------------------------- FIN Tcrae_mtc_dis.src --------------------------------------------
