DEFINITION C_Article_860026627 "Tbivsip"
DEFINITION NUMTABSEL_860026627 1
DEFINITION NUMTAB_860026627 1
DEFINITION ZONE_METROPOLE_860026627 7
DEFINITION CATEG_860026627 0
DEFINITION CODE_ARTICLE_860026627 3
DEFINITION BASE_860026627 1
DEFINITION RES_CCD_860026627 1
DEFINITION RES_TYPCTR_860026627 2
DEFINITION RES_CODCIR_860026627 3
DEFINITION RES_CODCIRDR_860026627 5
DEFINITION RES_UNITE_860026627 6
DEFINITION UTC_860026627 0
DEFINITION UTCDR_860026627 100
DEFINITION MILEURODR_860026627 110
DEFINITION CTR_REJET_860026627 11
DEFINITION CTR_REJET2_860026627 10
DEFINITION CTR_REJET3_860026627 12
DEFINITION CTR_REJET5_860026627 9
DEFINITION modulo_860026627 1000
DEFINITION C_InstFERPV_860026627 "FERPV"
DEFINITION C_InstSYMP_860026627 "SYMP"
DEFINITION C_InstSPOT_860026627 "SPOT_IMS"
DEFINITION C_InstAFDBBIV_860026627 "AFDBBIV"
DEFINITION C_TSymTbivsip_860026627 "TsymTbivsip"
DEFINITION C_Tferpv_860026627 "Tfe_rpv"
DEFINITION C_Tspot_860026627 "TspotTbivsip"
DEFINITION C_Tafdbbiv_860026627 "Tafdbbiv"
DEFINITION C_Inst45S_860026627 "45S"
DEFINITION C_InstACLA_860026627 "ACLA"
DEFINITION C_phone_860026627 ";phone-context=+33"
DEFINITION RES_TYPCOM_860026627 0
DEFINITION C_InstCOME_860026627 "COME"
DEFINITION C_InstELIG_860026627 "ELIGIBLE"
DEFINITION C_Tcome_860026627 "Tcome"
DEFINITION ZONEMETRO_860026627 7
DEFINITION C_InstCOM_ELIG_860026627 "COME_ELIGIBLE"
DEFINITION C_InstFE_860026627 "FE"
DEFINITION C_Jour_860026627 86400
DEFINITION CTR_CPSRI_860026627 17
DEFINITION CTR_CPSLOC_860026627 16
DEFINITION TD_ALICE_860026627 9
DEFINITION C_instALICE_860026627 "ALICE"
REGISTRE ENTIER Duree_860026627
REGISTRE ENTIER EFFICACE_860026627
REGISTRE ENTIER code_rejet_860026627
REGISTRE ENTIER FACTURABLE_860026627
REGISTRE ENTIER RoleNode_860026627
REGISTRE ENTIER b_ORIGINATING_860026627
REGISTRE ENTIER b_TERMINATING_860026627
REGISTRE ENTIER DATE_GMT_860026627
REGISTRE ENTIER ICAR_ABS_860026627
REGISTRE ENTIER HLAHM1_860026627
REGISTRE ENTIER DEDE_INF_860026627
REGISTRE ENTIER IDUS_INF_860026627
REGISTRE ENTIER NDI_INF_860026627
REGISTRE ENTIER DEDE_INTERNAT_860026627
REGISTRE ENTIER retour_BNC_860026627
REGISTRE ENTIER CCD_860026627
REGISTRE ENTIER UNITE_860026627
REGISTRE ENTIER TYPCTR_860026627
REGISTRE ENTIER vc_860026627
REGISTRE ENTIER taille_860026627
REGISTRE ENTIER erreur_860026627
REGISTRE ENTIER inst45S_860026627
REGISTRE ENTIER EPORTABILITE_SRP_860026627
REGISTRE ENTIER SPORTABILITE_SRP_860026627
REGISTRE ENTIER instACLA_860026627
REGISTRE ENTIER EPORTABILITE_SCP_860026627
REGISTRE ENTIER SPORTABILITE_SCP_860026627
REGISTRE ENTIER CCD_REEL_860026627
REGISTRE ENTIER CODCIR_860026627
REGISTRE ENTIER CODCIRDR_860026627
REGISTRE ENTIER NB_CSV_860026627
REGISTRE ENTIER instFERPV_860026627
REGISTRE ENTIER instSYMP_860026627
REGISTRE ENTIER instSPOT_860026627
REGISTRE ENTIER instAFDBBIV_860026627
REGISTRE ENTIER Num1_860026627
REGISTRE ENTIER ZonTrav_860026627
REGISTRE ENTIER SomZonTrav_860026627
REGISTRE ENTIER lg_860026627
REGISTRE ENTIER I_860026627
REGISTRE ENTIER ICID_CONVERTI_860026627
REGISTRE ENTIER LONGUEUR_860026627
REGISTRE ENTIER res_860026627
REGISTRE ENTIER TYPCOM_860026627
REGISTRE ENTIER b_Emessage_IP_860026627
REGISTRE ENTIER NUMZONE_860026627
REGISTRE ENTIER Indicator_860026627
REGISTRE ENTIER b_DEDE_absent_860026627
REGISTRE ENTIER b_SRP_TIERS_PTD_860026627
REGISTRE ENTIER b_118_TIERS_PTD_860026627
REGISTRE ENTIER CPT_RDT_860026627
REGISTRE ENTIER ICAR_UTC_SDA_860026627
REGISTRE ENTIER ICAR_UTC_NDI_860026627
REGISTRE ENTIER instCOME_860026627
REGISTRE ENTIER instELIG_860026627
REGISTRE ENTIER b_Come_860026627
REGISTRE ENTIER b_Eligible_860026627
REGISTRE ENTIER b_Ferpv_860026627
REGISTRE ENTIER b_Redist_860026627
REGISTRE ENTIER date_audit_860026627
REGISTRE ENTIER val_860026627
REGISTRE ENTIER DATE_AUDIT_METRO_860026627
REGISTRE ENTIER instCOM_ELIG_860026627
REGISTRE ENTIER valeur_860026627
REGISTRE ENTIER instFE_860026627
REGISTRE ENTIER DATE_LOCALE_860026627
REGISTRE ENTIER RedirectingNb_format_860026627
REGISTRE ENTIER CallingNb_format_860026627
REGISTRE ENTIER CallPartAddr02Data_format_860026627
REGISTRE ENTIER Flag_860026627
REGISTRE ENTIER b_Fact_CPS_Loc_860026627
REGISTRE ENTIER b_Fact_CPS_RI_860026627
REGISTRE ENTIER b_Fact_CPS_Act_860026627
REGISTRE ENTIER b_ALICE_860026627
REGISTRE ENTIER instALICE_860026627
REGISTRE ENTIER date_table_860026627
REGISTRE ENTIER code_errone_860026627
REGISTRE POINTEUR pt_DEDE_N_860026627
REGISTRE POINTEUR pt_Info7_860026627
REGISTRE POINTEUR pt_RedirecNb_860026627
REGISTRE POINTEUR pt_BUF1_860026627
REGISTRE POINTEUR pt_BUF2_860026627
REGISTRE POINTEUR pt_temp2_860026627
REGISTRE POINTEUR pt_RedirecNbASCII_860026627
REGISTRE POINTEUR pt_CallingParty02Ascii_860026627
REGISTRE POINTEUR pt_Computeinfo05Ascii_860026627
REGISTRE POINTEUR pt_Computeinfo05_860026627
REGISTRE POINTEUR pt_NDI_860026627
REGISTRE POINTEUR pt_CallingParty02_860026627
REGISTRE POINTEUR pt_IDUS_NUM_860026627
REGISTRE POINTEUR pt_IDUS_N2_860026627
REGISTRE POINTEUR pt_Z_860026627
REGISTRE POINTEUR pt_debChamp1_860026627
REGISTRE POINTEUR pt_debChamp2_860026627
REGISTRE POINTEUR pt_debChamp3_860026627
REGISTRE POINTEUR pt_DialleDigitsAscii_860026627
REGISTRE POINTEUR pt_CalledPartyAdressAscii_860026627
REGISTRE POINTEUR pt_DEDE_NUM1_860026627
REGISTRE POINTEUR pt_NDI_NUM_860026627
REGISTRE POINTEUR pt_DEDE_NUM_860026627
REGISTRE POINTEUR pt_ZAB_860026627
REGISTRE POINTEUR pt_CODESRP_860026627
REGISTRE POINTEUR pt_CODESCP_860026627
REGISTRE POINTEUR pt_NUMDDR_860026627
REGISTRE POINTEUR pt_C_CSV_860026627
REGISTRE POINTEUR pt_OP_CSV_860026627
REGISTRE POINTEUR pt_EccFact_860026627
REGISTRE POINTEUR pt_sgtqs_860026627
REGISTRE POINTEUR pt_NDIAscii_860026627
REGISTRE POINTEUR pt_Num_860026627
REGISTRE POINTEUR pt_Num1_860026627
REGISTRE POINTEUR pt_temp_860026627
REGISTRE POINTEUR pt_message_860026627
REGISTRE POINTEUR pt_DEDE_NUM_FAC_860026627
REGISTRE POINTEUR pt_SDA_Norm_860026627
REGISTRE POINTEUR pt_NDI_Norm_860026627
REGISTRE POINTEUR pt_NDI_COME_860026627
REGISTRE POINTEUR pt_LIBELREDIST_860026627
REGISTRE POINTEUR pt_datCPLUSS_860026627
REGISTRE POINTEUR pt_TARIF_860026627
REGISTRE POINTEUR pt_EDIT_860026627
############################################################################################
# DISTRIBUTION Tbivsip : DC de facturation transmises par la PF CGW-IMS
############################################################################################
# SORTIE :
# ECC distribuees + conversion + erronees
#COME_ELIGIBLE	 ( g_iartout2,  Tcome )
#COME 			 ( g_iartout2,  Tcome )
#SPOT			 ( g_iartout6,  TspotTbivsip )
#AFDBBIV		 ( g_iartout7,  Tafdbbiv )
#FERPV			 ( g_iartout4,  Tfe_rpv )
#Symphonie		 ( g_iartout5,  TsymTbivsip )
#
############################################################################################
#	HISTORIQUE
# 08/10/10 - PKH - G3R17 lot1 Creation
# 29/04/10 - PKH - G3R17 lot1 QC358 creation nouvelle instance ECC AFDBBIV
# 11/05/10 - PKH - Modification specif retour arriere suppression de la conversion "+" en "D"
# 14/05/10 - PKH - QC364 Correction sur la valorisation de DEDE_NUM1
# 14/05/10 - PKH - QC364 Correction intitule alarme 7306 qui impacte le controle croise
# 14/05/10 - PKH - QC364 Modif specif valorisation de DEDE_NUM1, Correction sur CCD
# 21/05/10 - DRE - G3R17 Reprise avec Spec BIVSIP_S0F7.doc et S0F8.doc
# 03/06/10 - PKH - G3R17 - QC374 initialisation de C_CSV et OP_CSV a blanc
# 04/06/10 - PKH - G3R17 - QC375 modification de la methode de calcul pour EFFICACE
# 14/06/10 - PKH - G3R17 - QC correction affectation de g_iartout6 a spot et non g_iartout7 (AFDBBIV)
# 15/06/10 - DRE - G3R17 QC380 Transformation de la date Sdate NTP (normalise) en Sdate platine
# 23/06/10 - DRE - G3R17 QC388 Suppression pour AFDB de HLAHM1
# 16/07/10 - DRE - G3R17 QC401 Envoi a tort des DC dans le flux SPOT_CS au lieu de SPOT_ETEL
# 08/10/10 - PKH - G3R18Cy	Ajout dans fe_rpv  nature du numero demande (champ INFDDE et valorisation du champ NUMDDE avec DEDE_NUM
# 29/10/10 - pkh - G3R18Cy QC428 correction de la valorisation de INFDDE pour Tfe_rpv
# 14/01/10 - THE - G3R19 QC450 (DEDE_INTERNAT 2 livraisons )
# 28/01/11 - DRE - G3R19 QC453 Reprise QC423 oubli? dans version precedente
# 22/04/11 - THE - G3R20 QC468 Modif calcul efficacite
# 15/02/11 - DRE - G3R20 QC457 Dans DialledDigits_DCB: 	Si present, suppression du ";phone-context=+33"
#							Si present, suppression du dernier "#" en fin de numero
# 10/06/11 - DRE - G3R21 QC478 spec BIVSIP_S2F3.doc : Utilisation de TYPCOM au lieu de CCD - Prise en compte du PTD - Modif INDDDE de FERPV
# 09/08/11 - THE - G3R22 QC508 Allongement pointeur
# 01/09/11 - DRE - G3R22 QC514 Reprise G3R21Cy oublie lors de la fusion
# 01/09/11 - DRE - G3R22 QC512 Modif NUMDEDE de facturation pour FERPV
# 26/09/11 - THE - VerifPcode
# 10/01/2012 - THE - G3R22C6 QC554 Valorisation DEDE_INF
# 21/03/2012 - DRE - G3R24 : nouveau palier tarifaire 0898PQ : SRP Tiers Deterministe
# 11/02/2012 - THE - G4R2 : QC677 interrogation des tables ACLA et 45S
# 25/02/2013 - THE - G4R2 Envoi COME et ELIGIBLE
# 04/03/2013 - THE - G4R02 QC693 Ajout ECC COME_ELIGIBLE
# 08/03/2013 - THE - G4R2 QC695 lecture IC referentiel
# 12/03/2013 - THE - G4R2 QC695 Champs portabilite dans Tcome (couleur)
# 12/03/2013 - THE - G4R2 QC696 champ portabilite dans Tcome (couleur) (Retiree)
# 29/03/2013 - THE - G4R2 QC703 Modif interro Tcome... + Tcome ...
# 15/04/2013 - THE - G4R2 QC710 Modir champ T3t65
# 15/04/2013 - THE - G4R2 QC720 Interro de FE et FERPV
# 31/05/2013 - DRE - Mise en conformit? Pcodes suite recompil Pdistribution (suppression suffixe fonctions)
# 26/06/2013 - THE - G4R3C3 QC730 
# 30/08/2013 - DRE - G4R3C5 QC744 : Conversion %23 en # avant suppression
# 02/09/2013 - DRE - G4R3C5 QC736 : Modification libelle d'erreur
# 05/09/2013 - THE - G4R3C6 Reprise QC 733 et 736 
# 11/10/2013 - THE - G4R4 QC756 correction  mise au format GASCII pour COME 
# 11/10/2013 - THE - G4R4 QC755 tous les DC vont ? Symphonie, Spot et AFDB apres redist
# 13/12/2013 - DRE - G4R4 QC773 Envoi de la date locale pour COME et COME ELIGIBLE
# 16/12/2013 - THE-DRE - G4R4 QC775 Probleme de normalisation du demandeur
# 17/12/2013 - DRE - G4R5 QC772 Suppression des caracteres a partir de ";" au lieu de ";phone-context=+33"
# 03/01/2014 - DRE - G4R5 Lot2 
# 17/02/2014 - DRE - G4R5C6 QC793 Ajout initialisation NB_CSV, C_CSV, OP_CSV
# 06/03/2014 - THE - G4R6 Lot1 QC779 Aiguillage alarmes 8503, 8703
# 25/03/2014 - THE - G4R6 Lot2  Creation C+S 
# 18/04/2014 - THE - ##### G4R6 QC804 ##### suppression des caract. apres ; dans ComputeInfo04 
# 24/06/2014 - THE - ##### G4R7 Lot1 ##### Appel ACLA avec tous les dde
# 25/07/2014 - THE - #G4R7 Lot3 QC834 envoi en redist si IC ALICE vide
# 07/01/2015 - THE - # G4R9 Lot1 ####
#
############################################################################################
#G4R2
#G4R4C5
#G4R6 Lot2 


########################################################################
# VerifPcode
#G3R24 reprise QC478
#G3R24
#G3R24
# G3R22C6 QC554
#G3R24
#G4R2
# G4R4 DRE QC773
#G4R5 Lot2
#G4R6 Lot1 QC779
#G4R6 Lot2 


########################################################################
#G3R22 DRE QC512
# G4R2
#G4R6 Lot2 


############# Initialisation ###########################################
# VerifPcode
#Status		 = -1
code_rejet_860026627	 = 0
Indicator_860026627	 = -1
Duree_860026627		 = -1
RoleNode_860026627	 = -1
EFFICACE_860026627	 = 0
FACTURABLE_860026627	 = 0
b_ORIGINATING_860026627	 = 0
b_TERMINATING_860026627	 = 0
DATE_GMT_860026627	 = 0
ICAR_ABS_860026627	 = 0
NUMZONE_860026627		 = -1
HLAHM1_860026627		 = -1
DEDE_INF_860026627	 = 0
IDUS_INF_860026627	 = 0
NDI_INF_860026627		 = 0
DEDE_INTERNAT_860026627	 = 0
retour_BNC_860026627	 = 0
UNITE_860026627		 = -1
taille_860026627		 = 0
LONGUEUR_860026627	 = 0
erreur_860026627		 = 0
NB_CSV_860026627		 = 0
instFERPV_860026627	 = -1
instSYMP_860026627	 = -1
instSPOT_860026627	 = -1
instAFDBBIV_860026627	 = -1
Num1_860026627		 = 0
ZonTrav_860026627		 = 0
ICID_CONVERTI_860026627	 = 0
res_860026627		 = 0
b_Emessage_IP_860026627	 = 0
# G3R22C6 QC554
b_DEDE_absent_860026627	 = 0
# G4R2
instCOME_860026627	 = -1
instELIG_860026627	 = -1
b_Come_860026627	 = 0
b_Eligible_860026627	 = 0
b_Ferpv_860026627	 = 0
b_Redist_860026627	 = 0
date_audit_860026627 = -1
val_860026627 = 0
instCOM_ELIG_860026627	 = -1
valeur_860026627 = 0
instFE_860026627	 = -1
# G4R4 DRE QC773
DATE_LOCALE_860026627 = -1
#G4R5 Lot2
RedirectingNb_format_860026627	= 0
CallingNb_format_860026627	= 0
CallPartAddr02Data_format_860026627	= 0
#G4R6 Lot1 QC779
Flag_860026627 = 0
#G4R6 Lot2 
b_Fact_CPS_Act_860026627 = 0
b_Fact_CPS_Loc_860026627 = 0
b_Fact_CPS_RI_860026627 = 0
b_ALICE_860026627 = 0
date_table_860026627 = 0


########################################################################
pt_Info7_860026627		 = "pt_Info71234567890"
pt_RedirecNb_860026627		 = "pt_RedirecNb12312312312312312312312312132132131231231231231231231231231231231231213213123121312131213121312131213121311"
pt_BUF1_860026627			 = "pt_BUF2525252525252522552255225252525252552525225252552252525255252552525525255252552525252552525252525252525552525252525252525252525252525"
pt_BUF2_860026627			 = "pt_BUF272172172172172172172172172172172172712712717277127712271"
pt_temp2_860026627		 = "pt_temp21781781781781781781781781781718718178171817181781171817811781171817181718171817181781718"
pt_RedirecNbASCII_860026627	 = "pt_RedirecNbASCII77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"
pt_CallingParty02_860026627	 = "pt_CallingParty02818181818181881818188181818818818818181818818181818811818111818881818181181818181881818181811881180123456789012345"
pt_CallingParty02Ascii_860026627	 = "pt_CallingParty02Ascii022121212122121221212212121221212121212122121211212121212121212212112121212212112121221121212211212120123456789"
pt_Computeinfo05_860026627	 = "pt_Computeinfo0599999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
pt_Computeinfo05Ascii_860026627	 = "pt_Computeinfo05Ascii987667899876678998766789987667899876678998767898767898767898987667896789876789876789876"
pt_IDUS_NUM_860026627		 = "pt_IDUS_NUM331313131313131331313131313131313131313313313133113133131331131313313313131313331313331133133131313131313133131311313313"
pt_NDI_860026627			 = "pt_NDI12121212121212121211212121212121212121212121212121212121212121212121212112121212121212121"
pt_debChamp1_860026627		 = "pt_debChamp179797979797979797979797979797979797979797979797979797979797979797979797979797"
pt_debChamp2_860026627		 = "pt_debChamp2484848484848484848484848484848484848484848484848484848484848484848484848484848"
pt_debChamp3_860026627		 =  "pt_debChamp39494949494949494949494949494949494949494949494949494949949494994949499494949"
pt_DialleDigitsAscii_860026627	 = "pt_DialleDigitsAscii198198198198198198198198198198198198191819819189189189189181981918"
pt_CalledPartyAdressAscii_860026627 = "pt_CalledPartyAdressAscii3131331313113131313313131311313131313131313131311313131313313"
pt_DEDE_NUM1_860026627		 = "pt_DEDE_NUM109090909090909090909090909999099090099009909909090090909909090909090909090909090909090909"
pt_NDI_NUM_860026627		 = "pt_NDI_NUM19191919191919191919191191919191911919191919191919191919191919191919191919191911991191991191919"
pt_DEDE_NUM_860026627		 = "pt_DEDE_NUM282882822828282828282828282828282828282828288282882828288282822828828228282882822882282828282"
pt_Z_860026627			 = "pt_Z99999999"
pt_ZAB_860026627			 = "pt_ZAB94949494"
pt_IDUS_N2_860026627		 = "pt_IDUS_N2213121321312132131121321312131211312131213121312131213121321"
pt_CODESRP_860026627		 = "pt_CODESRP91791791791917917917917917917917917"
pt_CODESCP_860026627		 = "pt_CODESCP32132132132132132132132132132132113"
pt_NUMDDR_860026627		 = "pt_NUMDDR454545445544545454545454545454545544545544545454545"
pt_C_CSV_860026627		 = "pt_C_CSV9898"
pt_OP_CSV_860026627		 = "OP_CSV07070707"
pt_EccFact_860026627		 = "pt_EccFact17617617617616176176"
pt_sgtqs_860026627		 = "pt_sgtqs7777777497507597407694876"
pt_DEDE_N_860026627		 = "pt_DEDE_N1974197419741974197419741974197419741974197419543209876543456788990898765654334556778899000098765432"
pt_Num_860026627			 = "pt_Num325999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234\
99991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123555555554"
pt_Num1_860026627			 = "99999999912345999912"
pt_NDIAscii_860026627		 = "pt_NDIAscii83218321832183283218321879879879879879978978978978978978978978797978978978798797879787978797879"
pt_temp_860026627			 = "pt_temp178917891789178917891789178917899178917891789179178917917917917917197187"
pt_message_860026627		 = "pt_message007007007007007077000700780070070070070070070907007007007007007007007007007007007007007007007007"
#G3R22 DRE QC512
pt_DEDE_NUM_FAC_860026627	= "pt_DEDE_NUM_FAC08888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888"
#G4R2
pt_SDA_Norm_860026627		= "pt_SDA_Norm123456789012345678901234567890123456789012345678901234567890"
pt_NDI_Norm_860026627		= "pt_NDI_Norm123456789012345678901234567890123456789012345678901234567890"
pt_NDI_COME_860026627		= "pt_NDI_COME25864653214789632147695254585225545655455554"
#G3R4C6
pt_LIBELREDIST_860026627	= "pt_LIBELREDIST9876543210987654321098765432109876543210pt_LIBELREDIST9876543210987654321098765432109876543210"
#G4R6 Lot2 
pt_datCPLUSS_860026627 = "pt_datCPLUSS98765432109876543210"
pt_TARIF_860026627 = "pt_TARIF0123456789"
pt_EDIT_860026627 = "pt_EDIT0123456789"


########################################################################
i_strcpy (pt_Info7_860026627,"" )
i_strcpy (pt_RedirecNb_860026627,"")
i_strcpy (pt_BUF1_860026627,"")
i_strcpy (pt_BUF2_860026627,"")
i_strcpy (pt_temp2_860026627,"")
i_strcpy (pt_RedirecNbASCII_860026627,"")
i_strcpy (pt_CallingParty02Ascii_860026627,"")
i_strcpy (pt_Computeinfo05_860026627,"")
i_strcpy (pt_Computeinfo05Ascii_860026627 ,"")
i_strcpy (pt_IDUS_NUM_860026627,"")
i_strcpy (pt_debChamp1_860026627,"")
i_strcpy (pt_debChamp2_860026627,"")
i_strcpy (pt_debChamp3_860026627,"")
i_strcpy (pt_DialleDigitsAscii_860026627,"")
i_strcpy (pt_CalledPartyAdressAscii_860026627,"")
i_strcpy (pt_DEDE_NUM1_860026627,"")
i_strcpy (pt_NDI_NUM_860026627,"")
i_strcpy (pt_DEDE_NUM_860026627,"")
i_strcpy (pt_Z_860026627,"")
i_strcpy (pt_ZAB_860026627,"")
i_strcpy (pt_NUMDDR_860026627,"")
#i_strcpy (pt_C_CSV,"0")
i_strcpy (pt_EccFact_860026627,"")
i_strcpy (pt_Num_860026627,"")
i_strcpy (pt_Num1_860026627,"")
i_strcpy (pt_DEDE_N_860026627,"")
i_strcpy (pt_NDIAscii_860026627,"")
#i_strcpy (pt_OP_CSV,"0")
i_strcpy (pt_temp_860026627,"")
i_strcpy (pt_message_860026627,"")
i_strcpy (pt_IDUS_N2_860026627,"")
i_strcpy (pt_CallingParty02_860026627,"")
i_strcpy (pt_CODESRP_860026627,"")
i_strcpy (pt_CODESCP_860026627,"")
i_strcpy (pt_C_CSV_860026627,"")
i_strcpy (pt_OP_CSV_860026627," ")
i_strcpy (pt_sgtqs_860026627,"")
#G3R22 DRE QC512
i_strcpy (pt_DEDE_NUM_FAC_860026627,"")
# G4R2
i_strcpy (pt_SDA_Norm_860026627,"")
i_strcpy (pt_NDI_Norm_860026627,"")
i_strcpy (pt_NDI_COME_860026627,"")
i_strcpy (pt_LIBELREDIST_860026627,"")
#G4R6 Lot2 
i_strcpy (pt_datCPLUSS_860026627,"")
i_strcpy(pt_TARIF_860026627,"    ")
i_strcpy(pt_EDIT_860026627," ")


#============================================================
trace("## Debut traitement -  [ __FILE__ ] ")
#============================================================

erreur_860026627 = i_dup_art_id(g_iartin, g_iartout)

# Creation  article Conversion
erreur_860026627 = i_cree_art("Conversion",g_iartout10)

# champ RoleNode 
# 	RoleNode = 0 appel sortant (ORIGINATING)
# 	RoleNode = 1 appel entrant (TERMINATING)

RoleNode_860026627 = i_get_art_field(g_iartout, $Tbivsip::RoleNode)
SI (RoleNode_860026627 == 0)
ALORS
	b_ORIGINATING_860026627 = 1
SINON
	SI (RoleNode_860026627 == 1)
	ALORS
		b_TERMINATING_860026627 = 1
	FINSI
FINSI
#trace1 ("__LINE__ ##  b_ORIGINATING = %d ==========",b_ORIGINATING)
#trace1 ("__LINE__ ##  b_TERMINATING = %d ===========",b_TERMINATING)

#====================================
# Variables fonctionnelles globales
#====================================


#====================================
#Determination de l'efficacite du DC
#====================================

SI (i_valid_field_n(g_iartout,$Tbivsip::AnswerIndicator))
ALORS
	Indicator_860026627 = i_get_art_field(g_iartout, $Tbivsip::AnswerIndicator)

	SI (Indicator_860026627 == 0x00 || Indicator_860026627 == 0x02)
	ALORS

		SI (i_valid_field_n(g_iartout, $Tbivsip::CallDuration))
		ALORS
			Duree_860026627 = i_get_art_field(g_iartout, $Tbivsip::CallDuration)

			SI (Duree_860026627 > 0x00)
			ALORS

				SI (i_valid_field_n(g_iartout, $Tbivsip::CORLStatus))
				ALORS
					erreur_860026627 = i_get_art_str(g_iartout,$Tbivsip::CORLStatus,pt_Info7_860026627)

					SI (i_strcmp(pt_Info7_860026627,"6") != 0)
					ALORS
						EFFICACE_860026627 = 1
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

# -------------------------------------------------------------
# Identification de la provenance de l'article (redistribution)
# -------------------------------------------------------------

# CPT_RDT : nb de passage en redistribution
CPT_RDT_860026627 = -1
CPT_RDT_860026627 = i_LireRedistCpt()

#trace1(" ============= nb de passage en redistribution Cpt = <%d> ===",CPT_RDT)

########################################################################
# IMPORTANT NE PAS CHANGER L'ORDRE DE FORMATAGE CI-DESSOUS (Computeinfo05 puis CallingParty02 puis RedirecNb)

#- $Tbivsip::Computeinfo05 : suppression du + forme : +33164478888
SI i_valid_field_n(g_iartout, $Tbivsip::Computeinfo05)
ALORS
	i_strcpy (pt_BUF1_860026627,"")

	erreur_860026627 = i_get_art_str(g_iartout,$Tbivsip::Computeinfo05,pt_Computeinfo05_860026627)

	LONGUEUR_860026627 = i_strlen(pt_Computeinfo05_860026627)
	erreur_860026627 = i_recupererValeur(pt_Computeinfo05_860026627,pt_BUF1_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_Computeinfo05 = %s ======= pt_BUF1 = %s ====",pt_Computeinfo05,pt_BUF1)

	SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0 )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
	FINSI

	SI (i_strplcmp(pt_BUF1_860026627,"+",0,1) == 0)
	ALORS
		CallingNb_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	

	SI (i_strplcmp(pt_BUF1_860026627,"00",0,2) == 0)
	ALORS
		CallingNb_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
	FINSI

	SI ( (CallingNb_format_860026627 == 0) && (i_strplcmp(pt_BUF1_860026627,"0",0,1) == 0)  &&  (i_strplcmp(pt_BUF1_860026627,"0",1,1) != 0) )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	
	# determination du IDUS_INF et IDUS_NUM  pour Computeinfo05 present
# QC775
	SI CallingNb_format_860026627 == 0
	ALORS
		IDUS_INF_860026627 = 0x80
	SINON
		# Demandeur format international
#DRE G4R5 Lot2 sup 269 et 508
		SI (i_strplcmp( pt_BUF1_860026627,"33",0,2) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
			IDUS_INF_860026627 = 0x80
		SINON
			SI ( i_strplcmp(pt_BUF1_860026627,"262",0,3) == 0 
#			  || i_strplcmp(pt_BUF1,"269",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"590",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"594",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"596",0,3) == 0 )
#			  || i_strplcmp(pt_BUF1,"508",0,3) == 0 )
			ALORS
				i_get_sub_str(pt_BUF1_860026627,3,-1,pt_BUF1_860026627)
				IDUS_INF_860026627 = 0x80
			SINON
				IDUS_INF_860026627 = 0xC0
			FINSI
		FINSI
	FINSI
	i_strcpy (pt_Computeinfo05Ascii_860026627,pt_BUF1_860026627)
	i_strcpy(pt_SDA_Norm_860026627,pt_Computeinfo05Ascii_860026627)
	i_strcpy(pt_IDUS_NUM_860026627,pt_Computeinfo05Ascii_860026627)
FINSI
#trace1 (">>>__LINE__>>>========= 2 IDUS_INF = 0x%x ============",IDUS_INF)

#- $Tbivsip::CallingParty02 : suppression du + forme : +33164478888

SI i_valid_field_n(g_iartout, $Tbivsip::CallingPart02)
ALORS
	i_strcpy (pt_BUF1_860026627,"")
	erreur_860026627 = i_get_art_str(g_iartout,$Tbivsip::CallingPart02,pt_CallingParty02_860026627)

	LONGUEUR_860026627 = i_strlen(pt_CallingParty02_860026627)
	erreur_860026627 = i_recupererValeur(pt_CallingParty02_860026627,pt_BUF1_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_CallingParty02 = %s ======= pt_BUF1 = %s ====",pt_CallingParty02,pt_BUF1)

	SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0 )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
	FINSI

	SI (i_strplcmp(pt_BUF1_860026627,"+",0,1) == 0)
	ALORS
		CallPartAddr02Data_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	

	SI (i_strplcmp(pt_BUF1_860026627,"00",0,2) == 0)
	ALORS
		CallPartAddr02Data_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
	FINSI

	SI ( (CallPartAddr02Data_format_860026627 == 0) && (i_strplcmp(pt_BUF1_860026627,"0",0,1) == 0)  &&  (i_strplcmp(pt_BUF1_860026627,"0",1,1) != 0) )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	
	# determination du IDUS_INF et IDUS_NUM  pour CallingParty02 present
# QC775
	SI CallPartAddr02Data_format_860026627 == 0
	ALORS
		IDUS_INF_860026627 = 0x80
	SINON
		# Demandeur format international
#DRE G4R5 Lot2 sup 269 et 508
		SI (i_strplcmp( pt_BUF1_860026627,"33",0,2) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
			IDUS_INF_860026627 = 0x80
		SINON
			SI ( i_strplcmp(pt_BUF1_860026627,"262",0,3) == 0 
#			  || i_strplcmp(pt_BUF1,"269",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"590",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"594",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"596",0,3) == 0 )
#			  || i_strplcmp(pt_BUF1,"508",0,3) == 0 )
			ALORS
				i_get_sub_str(pt_BUF1_860026627,3,-1,pt_BUF1_860026627)
				IDUS_INF_860026627 = 0x80
			SINON
				IDUS_INF_860026627 = 0xC0
			FINSI
		FINSI
	FINSI
	i_strcpy (pt_CallingParty02Ascii_860026627,pt_BUF1_860026627)
	i_strcpy(pt_SDA_Norm_860026627,pt_CallingParty02Ascii_860026627)
	i_strcpy(pt_IDUS_NUM_860026627,pt_CallingParty02Ascii_860026627)
FINSI
#trace1 (">>>__LINE__>>>========= 2 IDUS_INF = 0x%x ============",IDUS_INF)

#- $Tbivsip::RedirecNb : suppression du + forme : +33164478888

SI i_valid_field_n(g_iartout, $Tbivsip::RedirecNb)
ALORS
#17/02/2014 - DRE - G4R5C6 QC793 Ajout initialisation NB_CSV, C_CSV, OP_CSV
	NB_CSV_860026627 = 1
	i_strcpy (pt_C_CSV_860026627,"T")
	i_strcpy (pt_OP_CSV_860026627,"U")
	IDUS_INF_860026627 = 0x40
#\ 17/02/2014 - DRE - G4R5C6 QC793

	i_strcpy (pt_BUF1_860026627,"")
	erreur_860026627 = i_get_art_str(g_iartout,$Tbivsip::RedirecNb,pt_RedirecNb_860026627)

	LONGUEUR_860026627 = i_strlen(pt_RedirecNb_860026627)
	erreur_860026627 = i_recupererValeur(pt_RedirecNb_860026627,pt_BUF1_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_RedirecNb = %s ======= pt_BUF1 = %s ====",pt_RedirecNb,pt_BUF1)

	SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0 )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
	FINSI

	SI (i_strplcmp(pt_BUF1_860026627,"+",0,1) == 0)
	ALORS
		RedirectingNb_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	

	SI (i_strplcmp(pt_BUF1_860026627,"00",0,2) == 0)
	ALORS
		RedirectingNb_format_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
	FINSI

	SI ( (RedirectingNb_format_860026627 == 0) && (i_strplcmp(pt_BUF1_860026627,"0",0,1) == 0)  &&  (i_strplcmp(pt_BUF1_860026627,"0",1,1) != 0) )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI
	
	# determination du IDUS_INF et IDUS_NUM pour RedirecNb present
# QC775
	SI RedirectingNb_format_860026627 == 0
	ALORS
		IDUS_INF_860026627 = 0x80
	SINON
		# Demandeur format international
#DRE G4R5 Lot2 sup 269 et 508
		SI (i_strplcmp( pt_BUF1_860026627,"33",0,2) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
			IDUS_INF_860026627 = 0x80
		SINON
			SI ( i_strplcmp(pt_BUF1_860026627,"262",0,3) == 0 
#			  || i_strplcmp(pt_BUF1,"269",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"590",0,3) == 0
			  || i_strplcmp(pt_BUF1_860026627,"594",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"596",0,3) == 0 )
#			  || i_strplcmp(pt_BUF1,"508",0,3) == 0 )
			ALORS
				i_get_sub_str(pt_BUF1_860026627,3,-1,pt_BUF1_860026627)
				IDUS_INF_860026627 = 0x80
			SINON
				IDUS_INF_860026627 = 0xC0
			FINSI
		FINSI
	FINSI
	i_strcpy (pt_RedirecNbASCII_860026627,pt_BUF1_860026627)
	i_strcpy(pt_SDA_Norm_860026627,pt_RedirecNbASCII_860026627)
	i_strcpy(pt_IDUS_NUM_860026627,pt_RedirecNbASCII_860026627)
FINSI
#trace1 (">>>__LINE__>>>========= 2 IDUS_INF = 0x%x ============",IDUS_INF)

# IMPORTANT NE PAS CHANGER L'ORDRE DE FORMATAGE CI-DESSUS (Computeinfo05 puis CallingParty02 puis RedirecNb)
###########################################################################


########################################################################
# NDI_INF mise au format INF du demandeur NDI
# + Mise au format numero demandeur NDI_NUM
# pt_NDI_NUM
########################################################################

#FD/svcCompinfo06/Computeinfo06 (NDI)
i_strcpy(pt_NDI_NUM_860026627,"")
i_strcpy(pt_NDI_860026627,"")

SI (i_valid_field_n(g_iartout, $Tbivsip::NDI))
ALORS
	erreur_860026627 = i_get_art_str(g_iartout,$Tbivsip::NDI,pt_NDI_860026627)

	i_strcpy(pt_NDIAscii_860026627,pt_NDI_860026627)
	LONGUEUR_860026627 = i_strlen(pt_NDIAscii_860026627)
	erreur_860026627 = i_recupererValeur(pt_NDIAscii_860026627,pt_BUF1_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_NDIAscii = %s ======= pt_BUF1 = %s ====",pt_NDIAscii,pt_BUF1)

	res_860026627 = 0
#	SI (i_strplcmp(pt_BUF1,"sip:+",0,5) == 0 || i_strplcmp(pt_BUF1,"tel:+",0,5) == 0 )
	SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0 )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
	FINSI

	SI (i_strplcmp(pt_BUF1_860026627,"+",0,1) == 0)
	ALORS
		res_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
	FINSI

	SI (i_strplcmp(pt_BUF1_860026627,"00",0,2) == 0)
	ALORS
		res_860026627 = 1
		i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
	FINSI


	SI res_860026627 == 0
	ALORS
		NDI_INF_860026627 = 0x80
		# DRE QC 775
		SI ( (i_strplcmp(pt_BUF1_860026627,"0",0,1) == 0)  &&  (i_strplcmp(pt_BUF1_860026627,"0",1,1) != 0) )
		ALORS
			i_get_sub_str(pt_BUF1_860026627,1,-1,pt_BUF1_860026627)
		FINSI
	SINON
		# Demandeur format international
		SI (i_strplcmp(pt_BUF1_860026627,"33",0,2)==0)
		ALORS
			#national
			NDI_INF_860026627 = 0x80
			i_get_sub_str(pt_BUF1_860026627,2,-1,pt_BUF1_860026627)
		SINON
#DRE G4R5 Lot2 sup 269 et 508
			SI ( i_strplcmp(pt_BUF1_860026627,"262",0,3) == 0 
#			  || i_strplcmp(pt_BUF1,"269",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"590",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"594",0,3) == 0 
			  || i_strplcmp(pt_BUF1_860026627,"596",0,3) == 0 )
#			  || i_strplcmp(pt_BUF1,"508",0,3) == 0 )
			ALORS
				#national
				NDI_INF_860026627 = 0x80
				i_get_sub_str(pt_BUF1_860026627,3,-1,pt_BUF1_860026627)
			SINON
				#international
				NDI_INF_860026627 = 0xC0
			FINSI
		FINSI
	FINSI

	########################################################################
	#Mise au format numero demandeur NDI_NUM
	#pt_NDI_NUM
	########################################################################

	i_strcpy (pt_NDI_NUM_860026627,pt_BUF1_860026627)
	
	#trace2(">>>__LINE__>>>====== pt_NDI = %s ======= pt_NDI_NUM = %s ====",pt_NDI,pt_NDI_NUM)

	SI (b_ORIGINATING_860026627)
	ALORS
		#cas appel sortant
		IDUS_INF_860026627 = NDI_INF_860026627
	FINSI
FINSI
#trace1 (">>>__LINE__>>>=======NDI_INF = 0x%x =========",NDI_INF)

########################################################################
# SGTQS
########################################################################

i_strcpy(pt_sgtqs_860026627, i_LireEECSGTQS(g_ieec))

#################### Normalisation du demandeur ##############################

########################################################################
# ICAR_ABS en DATE_GMT metropole
########################################################################

# DATE_GMT UTC
DATE_GMT_860026627 = i_get_art_field(g_iartout, $Tbivsip::StartTime_SDATE)

# Metropole
ICAR_ABS_860026627 = i_DHgetLocalTime(NUMTAB_860026627,ZONE_METROPOLE_860026627,DATE_GMT_860026627)

#G4R6 Lot2 TDATCPS
#-----------------------------------------------------------
# DATCPS : Determine si la Tv2oip::DATE est egale ou posteriereure a celle
# retournee par la table TDATCPS
#------------------------------------------------------------
i_strcpy (pt_datCPLUSS_860026627,i_get_tab_field("TDATCPS", DATE_GMT_860026627, "DATCPS"))
erreur_860026627 = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_datCPLUSS_860026627)
date_table_860026627 = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)

SI DATE_GMT_860026627 >= date_table_860026627
ALORS
	b_Fact_CPS_Act_860026627 = 1
FINSI

# HLAHM1
#########################

# national
#########################

# DC FACTURABLE
#########################

#trace1 (">>>__LINE__>>>======= IDUS_INF = 0x%x ============",IDUS_INF)
SI (EFFICACE_860026627 && b_ORIGINATING_860026627 && IDUS_INF_860026627 == 0x80)
ALORS
	FACTURABLE_860026627 = 1
FINSI
#trace1 (">>>__LINE__>>>========= FACTURABLE = %d =============",FACTURABLE)

# deplacement  controle champ croise

########################################################################
# Controles croises entre champs connus du dc
########################################################################

SI (FACTURABLE_860026627)
ALORS
#	SI (!i_valid_field_n(g_iartin, $Tbivsip::NDI))
#	ALORS
#		i_strcpy (pt_message,"champ NDI absent")
#		code_rejet = 0xA041
#		erreur = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet,C_Article,pt_message)
#		SAUT DISTRI_ERR
#	FINSI

	SI ( !i_valid_field_n(g_iartout,$Tbivsip::DialledDigits) && 
	     !i_valid_field_n(g_iartout,$Tbivsip::AsCalledPartyAd) )
	ALORS
		i_strcpy (pt_message_860026627,"au moins un des champs DialledDigits et AsCalledPartyAd present")
		code_rejet_860026627 = 0xA041
		erreur_860026627 = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_message_860026627)
		SAUT DISTRI_ERR
	FINSI

	SI (!i_valid_field_n(g_iartout,$Tbivsip::ICID))
	ALORS
		i_strcpy (pt_message_860026627,"champ ICID absent")
		code_rejet_860026627 = 0xA042
		erreur_860026627 = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_message_860026627)
		SAUT DISTRI_ERR
	FINSI

	SI ( !i_valid_field_n(g_iartout,$Tbivsip::T4RedirecNb01) 
	  && !i_valid_field_n(g_iartout,$Tbivsip::T4CallingPart02) 
	  && !i_valid_field_n(g_iartout,$Tbivsip::T3ComputeInfo05) )
	ALORS
# 02/09/2013 - DRE - G4R3C5 QC736 : Modification libelle d'erreur
#		i_strcpy (pt_message,"au moins 1 des 3 champs RedirecNb CallingPart02 Computeinfo05 present")
		i_strcpy (pt_message_860026627,"SDA absent (Les 3 champs RedirecNb CallingPart02 Computeinfo05 sont absents)")
		#trace ("<<<__LINE__<<<=== DISTRI_ERREUR===")
		code_rejet_860026627 = 0xA042
		erreur_860026627 = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_message_860026627)
		SAUT DISTRI_ERR
	FINSI

	SI ( !i_valid_field_n(g_iartout,$Tbivsip::CallDuration) )
	ALORS
		i_strcpy (pt_message_860026627,"champ CallDuration absent")
		#trace ("<<<<__LINE__<<<<=== DISTRI_ERREUR===")
		code_rejet_860026627 = 0xA042
		erreur_860026627 = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_message_860026627)
		SAUT DISTRI_ERR
	FINSI
FINSI

########################################################################
# DialledDigits_DCD numero compose
# forme sip:0875621602@sip.mobistar.com ou sip:8475621602@sip.mobistar.com
# suppression de sip:847 ou  sip: ou tel:847 ou tel:
########################################################################

i_strcpy(pt_BUF1_860026627," ")
i_strcpy(pt_BUF2_860026627," ")

SI(i_valid_field_n(g_iartout, $Tbivsip::DialledDigits))
ALORS
	erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::DialledDigits,pt_BUF1_860026627)

	SI ( i_strplcmp(pt_BUF1_860026627,"sip:847",0,7) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:847",0,7) == 0 )
	ALORS
		i_get_sub_str(pt_BUF1_860026627,7,-1,pt_BUF1_860026627)
	SINON
		SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0) || (i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
		FINSI
	FINSI

# suppression des carac a partir de @
######################################

	LONGUEUR_860026627 = i_strlen(pt_BUF1_860026627)
	erreur_860026627 = i_recupererValeur(pt_BUF1_860026627,pt_BUF2_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_BUF1 = %s ======= pt_BUF2 = %s ====",pt_BUF1,pt_BUF2)

#G4R5 QC772 
	## suppression de la chaine C_phone (voir constante)
	#i_strcpy(pt_BUF1,REMPLACE_CHAINE(pt_BUF2, C_phone, ""))
	#i_strcpy(pt_BUF2,pt_BUF1)
	
	# Si (; ) present, suppression des caracteres a partir de (; )
	i_strcpy (pt_temp_860026627,pt_BUF2_860026627)
	erreur_860026627 = i_recupererValeur(pt_temp_860026627, pt_BUF2_860026627, i_strlen(pt_temp_860026627),';')
#\G4R5 QC772
	

# DRE QC744 Conversion avant suppression
	# remplacement de %23 par #
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "%23")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)
	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"%23","#"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI

	# suppression du "#" de fin
	i_get_sub_str(pt_BUF2_860026627, -1, -1, pt_temp_860026627)
	SI i_strcmp(pt_temp_860026627, "#") == 0
	ALORS
		i_get_sub_str(pt_BUF2_860026627, 0, -2, pt_BUF2_860026627)
	FINSI

#	# remplacement de %23 par #
#	erreur = i_adequation_chaine_expreg (pt_BUF2, "%23")
#	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)
#
#	SI erreur == 0
#	ALORS
#		i_strcpy(pt_BUF1,REMPLACE_CHAINE(pt_BUF2,"%23","#"))
#	FINSI

	# remplacement de * par B
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "*")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"*","B"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI

	# remplacement de # par C
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "#")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"#","C"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI
	i_strcpy(pt_DialleDigitsAscii_860026627,pt_BUF2_860026627)
FINSI

########################################################################
#ComputeInfo04 suppression de sip:847 ou de sip: ou tel:847 ou tel:
# numero appele
########################################################################

i_strcpy(pt_BUF1_860026627," ")
i_strcpy(pt_BUF2_860026627," ")

# forme tel:0875621602@sip.mobistar.com ou sip:8475621602@sip.mobistar.com

SI ( i_valid_field_n(g_iartout, $Tbivsip::AsCalledPartyAd) )
ALORS
	erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::AsCalledPartyAd,pt_BUF1_860026627)

	SI (i_strplcmp(pt_BUF1_860026627,"sip:847",0,7) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:847",0,7) == 0)
	ALORS
		i_get_sub_str(pt_BUF1_860026627,7,-1,pt_BUF1_860026627)
	SINON
		SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0) || (i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
		FINSI
	FINSI

# suppression des carac a partir de @
	LONGUEUR_860026627 = i_strlen(pt_BUF1_860026627)
	erreur_860026627 = i_recupererValeur(pt_BUF1_860026627,pt_BUF2_860026627,LONGUEUR_860026627,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_BUF1 = %s ======= pt_BUF2 = %s ====",pt_BUF1,pt_BUF2)

##### G4R6 QC804 #####
	# Si (; ) present, suppression des caracteres a partir de (; )
	i_strcpy (pt_temp_860026627,pt_BUF2_860026627)
	erreur_860026627 = i_recupererValeur(pt_temp_860026627, pt_BUF2_860026627, i_strlen(pt_temp_860026627),';')
##### G4R6 QC804 #####

	# remplacement de %23 par #
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "%23")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"%23","#"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI

	# remplacement de * par B
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "*")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"*","B"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI

	# remplacement de # par C
	erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "#")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)
	SI erreur_860026627 == 0
	ALORS
		i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"#","C"))
		i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
	FINSI

	i_strcpy(pt_CalledPartyAdressAscii_860026627,pt_BUF2_860026627)
FINSI

############################################################################################
#DEDE_NUM1
########################################################################

# G3R22C6 QC554
SI b_ORIGINATING_860026627
ALORS
	SI i_strlen(pt_DialleDigitsAscii_860026627)
	ALORS
		#trace ("<<<__LINE__ <<<< ======presence de pt_DialledDigitsAscii")
		i_strcpy (pt_DEDE_NUM1_860026627,pt_DialleDigitsAscii_860026627)
	SINON
		SI i_strlen(pt_CalledPartyAdressAscii_860026627)
		ALORS
			#trace ("<<<__LINE__ <<<< ======presence de pt_CalledPartyAdress")
			i_strcpy (pt_DEDE_NUM1_860026627,pt_CalledPartyAdressAscii_860026627)
		SINON
			b_DEDE_absent_860026627 = 1
		FINSI
	FINSI
SINON
	SI (i_valid_field_n(g_iartout, $Tbivsip::NDI))
	ALORS
		#trace ("<<<__LINE__ <<<< ======presence de NDI")
		########################################################################
		# NDI
		# forme sip:0875621602@sip.mobistar.com ou sip:8475621602@sip.mobistar.com
		# suppression de sip:847 ou  sip: ou tel:847 ou tel:
		########################################################################
		i_strcpy(pt_BUF1_860026627," ")
		i_strcpy(pt_BUF2_860026627," ")

		erreur_860026627 = i_get_art_str(g_iartin, $Tbivsip::NDI,pt_BUF1_860026627)
		#trace2(">>>__LINE__>>> ******** NDI = %s",pt_BUF1,"")

		SI (i_strplcmp(pt_BUF1_860026627,"sip:847",0,7) == 0 || i_strplcmp(pt_BUF1_860026627,"tel:847",0,7) == 0)
		ALORS
			i_get_sub_str(pt_BUF1_860026627,7,-1,pt_BUF1_860026627)
		SINON
			SI (i_strplcmp(pt_BUF1_860026627,"sip:",0,4) == 0) || (i_strplcmp(pt_BUF1_860026627,"tel:",0,4) == 0)
			ALORS
				i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
			FINSI
		FINSI

		# suppression des carac a partir de @
		LONGUEUR_860026627 = i_strlen(pt_BUF1_860026627)
		erreur_860026627 = i_recupererValeur(pt_BUF1_860026627,pt_BUF2_860026627,LONGUEUR_860026627,'@')
		#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
		#trace2(">>>__LINE__>>>====== pt_BUF1 = %s ======= pt_BUF2 = %s ====",pt_BUF1,pt_BUF2)

		# remplacement de %23 par #
		erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "%23")
		#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

		SI erreur_860026627 == 0
		ALORS
			i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"%23","#"))
			i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
		FINSI

		# remplacement de * par B
		erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "*")
		#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

		SI erreur_860026627 == 0
		ALORS
			i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"*","B"))
			i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
		FINSI

		# remplacement de # par C
		erreur_860026627 = i_adequation_chaine_expreg (pt_BUF2_860026627, "#")
		#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

		SI erreur_860026627 == 0
		ALORS
			i_strcpy(pt_BUF1_860026627,REMPLACE_CHAINE_860026233(pt_BUF2_860026627,"#","C"))
			i_strcpy(pt_BUF2_860026627,pt_BUF1_860026627)
		FINSI
		i_strcpy(pt_DEDE_NUM1_860026627,pt_BUF2_860026627)
	SINON
		b_DEDE_absent_860026627 = 1
	FINSI
FINSI
# \G3R22C6 QC554

########################################################################
#DEDE_INTERNAT
########################################################################

SI ( i_strplcmp(pt_DEDE_NUM1_860026627,"+",0,1) == 0 )
ALORS
#DRE G4R5 Lot2 sup 2692 et 2696
	i_get_sub_str(pt_DEDE_NUM1_860026627,1,-1,pt_DEDE_NUM1_860026627)
	SI ( i_strplcmp(pt_DEDE_NUM1_860026627,"33",0,2) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026627,"262",0,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026627,"594",0,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026627,"596",0,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026627,"590",0,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026627,"508",0,3) != 0 )
#	  && i_strplcmp(pt_DEDE_NUM1,"2696",0,4) != 0
#	  && i_strplcmp(pt_DEDE_NUM1,"2692",0,4) != 0 )
	ALORS
		DEDE_INTERNAT_860026627 = 1
	FINSI
FINSI

SI (i_strplcmp(pt_DEDE_NUM1_860026627,"00",0,2) == 0 )
ALORS
#DRE G4R5 Lot2 sup 2692 et 2696
	i_get_sub_str(pt_DEDE_NUM1_860026627,2,-1,pt_DEDE_NUM1_860026627)
	SI (i_strplcmp(pt_DEDE_NUM1_860026627,"33",0,2) != 0
	 && i_strplcmp(pt_DEDE_NUM1_860026627,"262",0,3) != 0
	 && i_strplcmp(pt_DEDE_NUM1_860026627,"594",0,3) != 0
	 && i_strplcmp(pt_DEDE_NUM1_860026627,"596",0,3) != 0
	 && i_strplcmp(pt_DEDE_NUM1_860026627,"590",0,3) != 0
	 && i_strplcmp(pt_DEDE_NUM1_860026627,"508",0,3) != 0 )
#	 && i_strplcmp(pt_DEDE_NUM1,"2696",0,4) != 0
#	 && i_strplcmp(pt_DEDE_NUM1,"2692",0,4) != 0)
	ALORS
		DEDE_INTERNAT_860026627 = 1
	FINSI
FINSI

########################################################################
#DEDE_NUM
########################################################################

#trace2("<<<<__LINE__ <<<< pt_DEDE_NUM1 = %s ======",pt_DEDE_NUM1,"")

SI (i_strplcmp(pt_DEDE_NUM1_860026627,"33",0,2)==0)
ALORS
	#trace("<<<__LINE__ <<<< suppression du 33 de DEDE_NUM1 ")
	i_get_sub_str(pt_DEDE_NUM1_860026627,2,-1,pt_DEDE_NUM1_860026627)
FINSI

SI ( i_strplcmp(pt_DEDE_NUM1_860026627,"262",0,3) == 0
  || i_strplcmp(pt_DEDE_NUM1_860026627,"594",0,3) == 0
  || i_strplcmp(pt_DEDE_NUM1_860026627,"596",0,3) == 0
  || i_strplcmp(pt_DEDE_NUM1_860026627,"590",0,3) == 0 )
ALORS
	#trace ("<<<__LINE__ suppression du prefixe DOM de DEDE_NUM1 ")
	i_get_sub_str(pt_DEDE_NUM1_860026627,3,-1,pt_DEDE_NUM1_860026627)
FINSI

SI ( i_strplcmp(pt_DEDE_NUM1_860026627,"0",0,1) == 0 
  && i_strplcmp(pt_DEDE_NUM1_860026627,"0",1,1) != 0)
ALORS
	#trace ("<<< __LINE__<<< numero national suppression du 0 pour la BNC")
	i_get_sub_str(pt_DEDE_NUM1_860026627,1,-1,pt_DEDE_NUM1_860026627)
	#trace ("<<<__LINE__<<< Suppression du 0 pour appel a la base")
FINSI

i_strcpy (pt_DEDE_NUM_860026627,pt_DEDE_NUM1_860026627)
#trace2(" <<<__LINE__<<< pt_DEDE_NUM = %s ====",pt_DEDE_NUM,"")

##############################################################################
# DEDE_INF (0x80: national, 0x40: special, 0xC0: international)
##############################################################################

# G3R22C6 QC554
SI b_DEDE_absent_860026627
ALORS
	DEDE_INF_860026627 = 0x00
SINON
	SI  DEDE_INTERNAT_860026627
	ALORS
		#International
		DEDE_INF_860026627 = 0xC0
	SINON
		SI (i_strlen(pt_DEDE_NUM_860026627)< 7)
		ALORS
			#numero special
			DEDE_INF_860026627 = 0x40
		SINON
			#National
			DEDE_INF_860026627 = 0x80
		FINSI
	FINSI
FINSI
# \G3R22C6 QC554

SI b_ORIGINATING_860026627 && EFFICACE_860026627
ALORS
	SI i_strcmp(pt_IDUS_NUM_860026627,"") == 0 && i_strcmp(pt_NDI_NUM_860026627,"") == 0
	ALORS
# 02/09/2013 - DRE - G4R3C5 QC736 : Modification libelle d'erreur 1
#		i_strcpy (pt_message,"Pas de demandeur ")
#		code_rejet = 0xA041
#		erreur = i_PlvMessEmettre(8612,2,g_iartin,"",3,code_rejet,C_Article,pt_message)
		i_strcpy (pt_message_860026627,"SDA et NDI absents (Les 4 champs RedirecNb CallingPart02 Computeinfo05 Computeinfo06 sont absents)")
		code_rejet_860026627 = 0xA042
		erreur_860026627 = i_PlvMessEmettre(7306,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_message_860026627)
		SAUT DISTRI_ERR
	FINSI
FINSI

############################################################################################
#  HLAHM1
############################################################################################

# ICAR_UTC_SDA
	LONGUEUR_860026627 = i_conv_ascii_dcb(pt_SDA_Norm_860026627, pt_BUF1_860026627)
	erreur_860026627 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_BUF1_860026627, LONGUEUR_860026627)
	NUMZONE_860026627 = i_DHgetZoneID(NUMTABSEL_860026627, g_iartout10)
	ICAR_UTC_SDA_860026627 = i_DHgetLocalTime(NUMTAB_860026627,NUMZONE_860026627,DATE_GMT_860026627)


# QC773 DRE
#DATE_LOCALE
LONGUEUR_860026627 = i_conv_ascii_dcb(pt_IDUS_NUM_860026627, pt_BUF1_860026627)
erreur_860026627 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_BUF1_860026627, LONGUEUR_860026627)
NUMZONE_860026627 = i_DHgetZoneID(NUMTABSEL_860026627, g_iartout10)
DATE_LOCALE_860026627 = i_DHgetLocalTime(NUMTAB_860026627,NUMZONE_860026627,DATE_GMT_860026627)

SI (IDUS_INF_860026627 == 0x80)
ALORS
#	LONGUEUR = i_conv_ascii_dcb(pt_IDUS_NUM, pt_BUF1)
#	erreur = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_BUF1, LONGUEUR)
#	NUMZONE = i_DHgetZoneID(NUMTABSEL, g_iartout10)
#	HLAHM1 = i_DHgetLocalTime(NUMTAB,NUMZONE,DATE_GMT) 

	HLAHM1_860026627 = DATE_LOCALE_860026627
FINSI
# \QC773 DRE

#G4R2 QC703
############################################################################################
#  Interrogation LAR COME et ELLIGIBLE
############################################################################################

#G4R2
taille_860026627 = i_conv_ascii_dcb(pt_SDA_Norm_860026627, pt_temp2_860026627)
SI (i_EnvoiReqConsTabDist(TD_Fixe, ICAR_UTC_SDA_860026627, pt_temp2_860026627, taille_860026627, 0, 1) != 0)
ALORS
	code_rejet_860026627 = 0xA0C0
	code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
	erreur_860026627 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_rejet_860026627,C_Tferpv_860026627,C_Article_860026627)
	SAUT DISTRI_ERR
FINSI
	
############################################################################
# RECHERCHE instance COME
############################################################################

instCOME_860026627 = i_LireInstanceECC(C_InstCOME_860026627)

SI (!instCOME_860026627)
ALORS
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"COME",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI
	
############################################################################
# RECHERCHE instance ELLIGIBLE
############################################################################
	
instELIG_860026627 = i_LireInstanceECC(C_InstELIG_860026627)
	
SI (!instELIG_860026627)
ALORS
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"ELIGIBLE",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

####################################
erreur_860026627 = i_LireReqConsTabDist()

SI erreur_860026627
ALORS
	erreur_860026627 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist TD_Fixe", C_Article_860026627, g_ieec)
	SAUT DISTRI_ERR
FINSI

val_860026627 = i_LireInfoECC(instCOME_860026627, 0)

SI val_860026627
ALORS
	b_Come_860026627 = 1
SINON
	val_860026627 = i_LireInfoECC(instELIG_860026627, 0)
	SI val_860026627
	ALORS
		b_Eligible_860026627 = 1
	#G4R2
	SINON
		i_strcpy(pt_BUF1_860026627," non trouve dans la table FIXE, NDI absent")
		erreur_860026627 = i_format_str2( pt_LIBELREDIST_860026627, "AR SDA %s%s", pt_SDA_Norm_860026627, pt_BUF1_860026627)
		#G4R6 Lot1 QC779 
		Flag_860026627 = 1
	FINSI
FINSI

#G4R2 QC695
#erreur = i_LireChaineInfo(val, 0, 6, pt_NDI_COME)
erreur_860026627 = i_LireImsiInfo(val_860026627, 0, 5, pt_NDI_COME_860026627)

SI ( b_Come_860026627 || b_Eligible_860026627 )
ALORS
	SI !i_valid_field_n(g_iartout, $Tbivsip::NDI)
	ALORS
		i_strcpy(pt_NDI_NUM_860026627,pt_NDI_COME_860026627)
		i_strcpy(pt_BUF1_860026627,pt_NDI_COME_860026627)
		erreur_860026627 = i_format_str2( pt_NDI_COME_860026627, "%s%s", "+33", pt_BUF1_860026627)
		erreur_860026627 = i_ajoutChampNum( g_iartout,$Tbivsip::T3ComputeInfo06,$Tbivsip::NDI,0 )
		erreur_860026627 = i_set_art_str( g_iartout, $Tbivsip::NDI,pt_NDI_COME_860026627 )
		erreur_860026627 = i_resize_tlv ( g_iartout, "T3ComputeInfo06","NDI", i_strlen(pt_NDI_COME_860026627) )
	FINSI
FINSI
#G4R2 QC703
############################################################################
#  Recherche instance FERPV et FE
############################################################################

# G2R4 QC720
instFE_860026627 = i_LireInstanceECC(C_InstFE_860026627)
SI (!instFE_860026627)
ALORS
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"FE",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

instFERPV_860026627 = i_LireInstanceECC(C_InstFERPV_860026627)
SI (!instFERPV_860026627)
ALORS
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"FERPV",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

## G4R3C6 ## QC733 #######################################################################################################################

#SI (b_ORIGINATING)
SI ( b_ORIGINATING_860026627 && EFFICACE_860026627 )
ALORS
	SI (i_valid_field_n(g_iartout,$Tbivsip::NDI))
	ALORS
		#G4R2
		i_strcpy(pt_NDI_Norm_860026627,pt_NDI_NUM_860026627)
		i_strcpy(pt_IDUS_NUM_860026627,pt_NDI_NUM_860026627)
	SINON
		b_Redist_860026627 = 1
		SAUT ARD
#G4R4 QC755
		#SAUT REDIST
	FINSI
FINSI

# ICAR_UTC_NDI
LONGUEUR_860026627 = i_conv_ascii_dcb(pt_NDI_Norm_860026627, pt_BUF1_860026627)
erreur_860026627 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_BUF1_860026627, LONGUEUR_860026627)
NUMZONE_860026627 = i_DHgetZoneID(NUMTABSEL_860026627, g_iartout10)
ICAR_UTC_NDI_860026627 = i_DHgetLocalTime(NUMTAB_860026627,NUMZONE_860026627,DATE_GMT_860026627)

########################################################################
# Normalisation du demandeur 	IDUS_N2
########################################################################

# Demandeur national
#trace2("<<<__LINE__<<< avant normalisation  pt_IDUS_NUM = %s=====",pt_IDUS_NUM,"")
i_get_sub_str(pt_IDUS_NUM_860026627,0,0,pt_Z_860026627)

SI ( ( i_strcmp("0",pt_Z_860026627) == 0 
    || i_strcmp("6",pt_Z_860026627) == 0 
    || i_strcmp("7",pt_Z_860026627) == 0 ) 
  && FACTURABLE_860026627 )
ALORS
	#trace(">>>__LINE__>>> erreur de normalisateur du demandeur")
	code_rejet_860026627 = 0xA011
	erreur_860026627 = i_PlvMessEmettre(7312,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_IDUS_NUM_860026627)
	SAUT DISTRI_ERR
FINSI

SI (IDUS_INF_860026627 == 0x80)
ALORS
	SI ( i_strcmp("6",pt_Z_860026627) == 0 
	  || i_strcmp("7",pt_Z_860026627) == 0 
	  || i_strcmp("8",pt_Z_860026627) == 0 
	  || i_strcmp("9",pt_Z_860026627) == 0 )
	ALORS
		erreur_860026627 = i_format_str2(pt_IDUS_N2_860026627,"%s%s","0*",pt_IDUS_NUM_860026627)
	FINSI

	SI ( i_strcmp("1",pt_Z_860026627) == 0 
	  || i_strcmp("2",pt_Z_860026627) == 0 
	  || i_strcmp("3",pt_Z_860026627) == 0 
	  || i_strcmp("4",pt_Z_860026627) == 0 
	  || i_strcmp("5",pt_Z_860026627) == 0 )
	ALORS
		erreur_860026627 = i_format_str2(pt_IDUS_N2_860026627,"%s%s","0",pt_IDUS_NUM_860026627)
	FINSI

#DRE G4R5 Lot2
	# Demandeur DOM
	i_get_sub_str(pt_IDUS_NUM_860026627,0,2,pt_ZAB_860026627)
	SI ( i_strcmp(pt_ZAB_860026627,"976") == 0 )
	ALORS
		erreur_860026627 = i_format_str2(pt_IDUS_N2_860026627,"%s%s","0*",pt_ZAB_860026627)
	FINSI
	SI ( i_strcmp(pt_ZAB_860026627,"262") == 0 
	  || i_strcmp(pt_ZAB_860026627,"269") == 0 
	  || i_strcmp(pt_ZAB_860026627,"590") == 0 
	  || i_strcmp(pt_ZAB_860026627,"594") == 0 
	  || i_strcmp(pt_ZAB_860026627,"596") == 0 )
	ALORS
		erreur_860026627 = i_format_str2(pt_IDUS_N2_860026627,"%s%s","0*",pt_IDUS_NUM_860026627)
	FINSI
#\DRE G4R5 Lot2
FINSI
#trace2("<<<__LINE__ apres normalisation pt_IDUS_N2 = %s========",pt_IDUS_N2,"")

# Demandeur international
SI (IDUS_INF_860026627 == 0xC0)
ALORS
	#trace(">>>__LINE__>>>IDUS international normalisation pas de changement")
	i_strcpy(pt_IDUS_N2_860026627,pt_IDUS_NUM_860026627)
FINSI

taille_860026627 = i_strlen(pt_IDUS_N2_860026627)

SI taille_860026627 > 10
ALORS
	i_strcpy (pt_BUF2_860026627,"")
	i_get_sub_str(pt_IDUS_N2_860026627,0,9,pt_BUF2_860026627)
	erreur_860026627 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_BUF2_860026627,11)
	#trace2(">>>__LINE__>>> Tcopo::NDR =%s",pt_BUF2,"")
SINON
	erreur_860026627 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_IDUS_N2_860026627,taille_860026627+1)
	#trace2(">>>__LINE__>>> Tcopo::NDR =%s",pt_IDUS_BNC,"")
FINSI
#trace2 ("<<<<__LINE__ <<<<< pt_IDUS_N2 = %s ===========",pt_IDUS_N2,"")

########################################################################
#Normalisation du demande  DEDE_N
########################################################################
i_strcpy(pt_BUF1_860026627," ")
i_strcpy(pt_BUF2_860026627," ")

# G3R22C6 QC554
SI b_DEDE_absent_860026627 == 0
ALORS
	SI i_strcmp(pt_DEDE_NUM_860026627," ") != 0
	ALORS
		taille_860026627=i_strlen(pt_DEDE_NUM_860026627)
		i_strcpy (pt_BUF1_860026627,  pt_DEDE_NUM_860026627)

		# Z
		i_get_sub_str(pt_BUF1_860026627,0,0,pt_debChamp1_860026627)

		# ZAB
		i_get_sub_str(pt_BUF1_860026627,0,2,pt_debChamp2_860026627)

		# ZABC
		i_get_sub_str(pt_BUF1_860026627,0,3,pt_debChamp3_860026627)
		#i_get_sub_str(pt_BUF1,0,7,pt_debChamp4)

		# National,DOM,mobile IP,Mayotte,St Pierre et miquelon
		SI (DEDE_INF_860026627 == 0x80)
		ALORS
			SI (taille_860026627 <=9)
			ALORS
				SI ( i_strcmp(pt_debChamp1_860026627,"1") >= 0 
				  && i_strcmp(pt_debChamp1_860026627,"9") <= 0)
				ALORS
					erreur_860026627 = i_format_str2(pt_DEDE_N_860026627,"%s%s","0",pt_BUF1_860026627)
					#trace(">>>__LINE__>>>DEDE national  normalisation ajout 0 *** pt_DEDE_N")
				SINON
					SI FACTURABLE_860026627
					ALORS
						#trace(">>>__LINE__>>> erreur de normalisateur du demandeur")
						code_rejet_860026627 = 0xA011
						erreur_860026627 = i_PlvMessEmettre(7313,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,pt_DEDE_NUM_860026627)
						SAUT DISTRI_ERR
					FINSI
				FINSI
			SINON
				# G4R9 Lot1 ####
				# N? M2M sur 13 digits
				SI (i_strcmp(pt_debChamp2_860026627,"700") == 0)
				ALORS
					SI taille_860026627 == 13
					ALORS
						erreur_860026627 = i_format_str2(pt_DEDE_N_860026627,"%s%s","0",pt_BUF1_860026627)
					FINSI
				SINON
					# prefixe d'acheminement vers le RI  150PQZAB...
					SI (i_strcmp(pt_debChamp2_860026627,"150") == 0)
					ALORS
						i_get_sub_str(pt_BUF1_860026627,5,-1,pt_BUF1_860026627)
						erreur_860026627 = i_format_str2(pt_DEDE_N_860026627,"%s%s","0",pt_BUF1_860026627)
					SINON
						# numero renvoi vers messagerie vocale (btpack)
						i_get_sub_str(pt_BUF1_860026627,4,-1,pt_BUF1_860026627)
						erreur_860026627 = i_format_str2(pt_DEDE_N_860026627,"%s%s","0",pt_BUF1_860026627)
					FINSI
				FINSI
			FINSI
		FINSI

		# services speciaux
		SI DEDE_INF_860026627 == 0x40
		ALORS
			#pas de changement pour les services speciaux
			i_strcpy(pt_DEDE_N_860026627,pt_BUF1_860026627)
			#trace(">>>__LINE__>>>DEDE normalisation SERVICE SPECIAUX *** pt_DEDE_N")
		FINSI

		# International
		SI DEDE_INF_860026627 == 0xC0
		ALORS
# DRE G4R5 Lot2
#			SI ( i_strcmp(pt_debChamp2,"590") == 0 
#			  || i_strcmp(pt_debChamp2,"262") == 0 
#			  || i_strcmp(pt_debChamp2,"594") == 0 
#			  || i_strcmp(pt_debChamp2,"596") == 0 )
#			ALORS
#				i_get_sub_str(pt_BUF1,3,-1,pt_BUF2)
#				erreur = i_format_str2(pt_DEDE_N,"%s%s","0",pt_BUF2)
#				#trace(">>>__LINE__>>>DEDE normalisation "0" INTERNATIONAL *** pt_DEDE_N")
#			SINON
#				erreur = i_format_str2(pt_DEDE_N,"%s%s","00",pt_BUF1)
#				#trace(">>>__LINE__>>>DEDE normalisation "00" INTERNATIONAL ")
#			FINSI

			erreur_860026627 = i_format_str2(pt_DEDE_N_860026627,"%s%s","00",pt_BUF1_860026627)
			#trace(">>>__LINE__>>>DEDE normalisation "00" INTERNATIONAL ")
#\DRE G4R5 Lot2

		FINSI

		taille_860026627 = i_strlen(pt_DEDE_N_860026627)
		SI taille_860026627 > 10
		ALORS
			i_strcpy (pt_BUF2_860026627,"")
			i_get_sub_str(pt_DEDE_N_860026627,0,9,pt_BUF2_860026627)
			erreur_860026627 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_BUF2_860026627,11)
			#trace2(">>>__LINE__>>> si >10 Tcopo::NDE(pt_DEDE_N de 0 a 9) =%s",pt_BUF2,"")
		SINON
			erreur_860026627 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_DEDE_N_860026627,taille_860026627+1)
			#trace2(">>>__LINE__>>> si <= 10 Tcopo::NDE(pt_DEDE_N en entier) =%s",pt_DEDE_N,"")
		FINSI
		#trace(">>>__LINE__>>> pas de normalisation de DEDE_NUM1 parceque vide ")
	FINSI
FINSI
# \G3R22C6 QC554

########################################################################
# Appel a la BNC
########################################################################

#G4R2 QC703
SI ( i_valid_field_n(g_iartin,$Tbivsip::NDI) )
ALORS
	taille_860026627 = i_conv_ascii_dcb(pt_NDI_Norm_860026627, pt_temp2_860026627)
	SI (i_EnvoiReqConsTabDist(TD_Fixe, ICAR_UTC_NDI_860026627, pt_temp2_860026627, taille_860026627, 0, 1) != 0)
	ALORS
		code_rejet_860026627 = 0xA0C0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_rejet_860026627,C_Tferpv_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026627 = i_LireReqConsTabDist()

	SI erreur_860026627
	ALORS
		erreur_860026627 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist TD_Fixe", C_Article_860026627, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	val_860026627 = i_LireInfoECC(instFERPV_860026627, 0)

	SI val_860026627
	ALORS
		b_Ferpv_860026627 = 1
	#G4R2
	SINON
	#G4R2 QC720
		val_860026627 = i_LireInfoECC(instFE_860026627, 0)
		SI val_860026627
		ALORS
			b_Ferpv_860026627 = 1
		SINON
			i_strcpy(pt_BUF1_860026627," AR NDI non trouve dans la table FIXE")
			erreur_860026627 = i_format_str2( pt_LIBELREDIST_860026627, "AR SDA %s et AR NDI %s non trouves dans la table FIXE", pt_SDA_Norm_860026627, pt_NDI_Norm_860026627)
			#G4R6 Lot1 QC779 
			Flag_860026627 = 0
		FINSI
	FINSI
#G4R2
SINON
	i_strcpy(pt_LIBELREDIST_860026627," Pas de NDI dans le DC pour FERPV")
	#G4R6 Lot1 QC779 
	Flag_860026627 = 1
FINSI

## G4R3C2 ## QC730 #######################################################################################################################

#SI EFFICACE && b_ORIGINATING && !(b_Ferpv || b_Come || b_Eligible) && CPT_RDT < 3
SI EFFICACE_860026627   && b_ORIGINATING_860026627   && !(b_Ferpv_860026627   || b_Come_860026627   || b_Eligible_860026627  )
ALORS
	SI CPT_RDT_860026627   == 2
	ALORS
		SI ( i_valid_field_n(g_iartin,$Tbivsip::NDI) )
		ALORS
			b_Ferpv_860026627   = 1
			#erreur   = i_AjouterCouranteECC(instFERPV  )
		FINSI
	SINON
		b_Redist_860026627   = 1
	#	i_strcpy(pt_BUF1," AR non trouve dans la table FIXE")
	#	erreur = i_format_str2( pt_LIBELREDIST, "%s%s", pt_SDA_Norm, pt_BUF1)
		SAUT ARD
#G4R4 QC755
		#SAUT REDIST
	FINSI
FINSI
#G4R2 QC703
# G4R3C2 QC730


########################################################################
# critere de valorisation
########################################################################

#G3R24 reprise QC478
#SRP_ITX = 0

CODCIRDR_860026627=-1
CODCIR_860026627=-1
TYPCTR_860026627=-1
CCD_860026627 = 0xFF
#DRE G3R21C03 QC478
TYPCOM_860026627 = 0xFF

#trace1("<<<__LINE__ <<< EFFICACE = <%d>   ======", EFFICACE)
#trace1("<<<__LINE__ <<< IDUS_INF = <%x> ======",IDUS_INF)
#trace2("<<<__LINE__ <<<pt_DEDE_N = <%s> ======",pt_DEDE_N,"")

SI (EFFICACE_860026627 == 1 && IDUS_INF_860026627 == 0x80 && i_strcmp(pt_DEDE_NUM1_860026627,"") != 0)
ALORS
	#trace (">>>__LINE___>> appel a la base de comptage ")
	g_icopo.TAXE   = 0
	g_icopo.CREDIT = 0
	erreur_860026627 = i_set_art_date(g_icopo,HLAHM1_860026627)
	g_icopo.DUREE  = Duree_860026627
	g_icopo.CODE   = CODE_ARTICLE_860026627
	g_icopo.CATEG  = CATEG_860026627
	g_icopo.SUP[0] = 0
	g_icopo.SUP[1] = 0
	g_icopo.SUP[2] = 0
	g_icopo.SUP[3] = 0
	g_icopo.SUP[4] = 0
	g_icopo.SUP[5] = 0
	g_icopo.SUP[6] = 0
	g_icopo.SUP[7] = 0

	retour_BNC_860026627 = i_comptage(g_icopo,BASE_860026627,HLAHM1_860026627)

	# Erreur retour base de comptage
	SI (retour_BNC_860026627 == -1 && FACTURABLE_860026627)
	ALORS
		#trace1(">>>__LINE__>>> Erreur retour BNC erreur=%d",retour_BNC)
		code_rejet_860026627 = 0xA020 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8507,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,g_ierrno)
		SAUT DISTRI_ERR
	FINSI

	#CCD
	SI FACTURABLE_860026627
	ALORS
		SI retour_BNC_860026627 == 0
		ALORS
			TYPCOM_860026627 = g_icopo.SUP[RES_TYPCOM_860026627]

			CCD_860026627 = g_icopo.SUP[RES_CCD_860026627]

			CODCIRDR_860026627 = g_icopo.SUP[RES_CODCIRDR_860026627]
			CODCIR_860026627 = g_icopo.SUP[RES_CODCIR_860026627]

			#trace1("<<< __LINE__ <<< CCD = <%d> =====",CCD)
			#trace1(">>>__LINE__>>>  *** CODCIRDR <%d>",CODCIRDR)
			#trace1(">>>__LINE__>>>  *** CODCIR <%d>",CODCIR)

			############################################
			# Controle sur l'unite renvoyee par la BNC
			# COEFF=94 MILEURO=10 MILEURODR=110
			# NbUT=vcUT UTC=0 UTCDR=100
			############################################
			#UNITE, VC
			vc_860026627 = g_icopo.TAXE
			UNITE_860026627 = g_icopo.SUP[RES_UNITE_860026627]

			SI UNITE_860026627 != UTC_860026627 && UNITE_860026627 != MILEURODR_860026627 && UNITE_860026627 != UTCDR_860026627
			ALORS
				#trace(">>>__LINE__>>> Erreur retour BNC")
				code_rejet_860026627 = 0xA020
				code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
				#erreur = i_PlvMessEmettre(7315,2,g_iartin,"",3,code_rejet,C_Article,UNITE)
				erreur_860026627 = i_PlvMessEmettre(8506,2,g_iartin,"",3,code_rejet_860026627,C_Article_860026627,UNITE_860026627)
				SAUT DISTRI_ERR
			FINSI
			TYPCTR_860026627 = g_icopo.SUP[RES_TYPCTR_860026627]
		FINSI
	FINSI
FINSI

POINT hors_BNC

##################### b_SRP_TIERS_PTD Calcul du Booleen ##################
b_SRP_TIERS_PTD_860026627 = 0

SI ( (CCD_860026627 == 0x18) && (TYPCTR_860026627 == 3) )
ALORS
	b_SRP_TIERS_PTD_860026627 = 1
FINSI

#################### b_118_TIERS_PTD Calcul du Booleen ####################
b_118_TIERS_PTD_860026627 = 0
SI (CCD_860026627 == 0x1B)
ALORS
	b_118_TIERS_PTD_860026627 = 1
FINSI

#G3R21Cy################### b_e-message_IP #########################
SI CCD_860026627 == 0x17
ALORS
	b_Emessage_IP_860026627 = 1
FINSI

#G4R6 Lot2 ################### b_e-message_IP #########################
#G4R6 Lot2 Verif DATE
SI ( TYPCTR_860026627 == CTR_CPSLOC_860026627 || TYPCTR_860026627 == CTR_CPSRI_860026627 ) && !b_Fact_CPS_Act_860026627
ALORS
	# message dalarme AR <DEDE_NUM> C+S avec date DC <ICAR_UTC> inferieure a la date d'activation de la facturation C+S < Date_CPS> 
	erreur_860026627 = i_format_str2(pt_LIBELREDIST_860026627," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_DEDE_NUM_860026627,pt_datCPLUSS_860026627)
	code_errone_860026627 = 0xA080
	code_errone_860026627 = code_errone_860026627 + EFFICACE_860026627
	erreur_860026627 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026627, C_Article_860026627, pt_LIBELREDIST_860026627 )
	SAUT ELIMINE_EXP
SINON
	SI TYPCTR_860026627 == CTR_CPSLOC_860026627 && b_Fact_CPS_Act_860026627
	ALORS
		b_Fact_CPS_Loc_860026627 =1
	SINON
		SI TYPCTR_860026627 == CTR_CPSRI_860026627 && b_Fact_CPS_Act_860026627
		ALORS
			b_Fact_CPS_RI_860026627 = 1
		FINSI
	FINSI
FINSI

########### Portabilite Entrante SRP (referentiel 45S "SKITEL")#####

# EPORTABILITE_SRP
# G4R2 QC677
SI !DEDE_INTERNAT_860026627
ALORS
	SI i_strcmp(pt_DEDE_NUM_860026627," ") != 0
	ALORS
		#----------  Appel de la table 45S  ---------  #
		inst45S_860026627 = i_LireInstanceECC(C_Inst45S_860026627)
	
		SI (!inst45S_860026627)
		ALORS
			code_rejet_860026627 = 0xA0B0
			code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
			erreur_860026627   = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_rejet_860026627,C_Inst45S_860026627,C_Article_860026627)
			SAUT DISTRI_ERR
		FINSI
	
		# Envoi Requetes Table de Distribution 45S
		i_strcpy(pt_BUF1_860026627,pt_DEDE_NUM_860026627)
		pt_CODESRP_860026627 = CodeOperateurTable6_860026233(DATE_GMT_860026627,pt_BUF1_860026627,"45S")
	
		SI i_strcmp(pt_CODESRP_860026627  , "84208") == 0
		ALORS
			EPORTABILITE_SRP_860026627   = 1
		SINON
			EPORTABILITE_SRP_860026627   = 0
	
			SI (i_strcmp(pt_CODESRP_860026627,"84208")!=0 && i_strcmp(pt_CODESRP_860026627,"")!=0)
			ALORS
				SPORTABILITE_SRP_860026627 = 1
			SINON
				SPORTABILITE_SRP_860026627 = 0
			FINSI
		FINSI
	FINSI

#################### Portabilite Entrante ou Sortante SCP (referentiel ACLA) #

#G4R7 Lot1
#	# EPORTABILITE_SCP, SPORTABILITE_SCP
#	i_get_sub_str(pt_DEDE_NUM,0,0,pt_debChamp1)
#	taille = i_strlen(pt_DEDE_NUM)
#	
#	SI (i_strcmp(pt_debChamp1,"8") == 0 || (i_strcmp(pt_debChamp1,"3") == 0 && taille == 4))
#	ALORS
	#----------  Appel de la table ACLA  ---------  #
	instACLA_860026627 = i_LireInstanceECC(C_InstACLA_860026627)
	
	SI (!instACLA_860026627)
	ALORS
		#trace (">>>__LINE__>>> --------Pas d'instance pour ACLA------------------------------")
		code_rejet_860026627 = 0xA0B0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627   = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_rejet_860026627,C_InstACLA_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI
	
	# Envoi Requetes Table de Distribution ACLA
	i_strcpy(pt_BUF1_860026627,pt_DEDE_NUM_860026627)
	pt_CODESCP_860026627 = CodeOperateurTable6_860026233(DATE_GMT_860026627,pt_BUF1_860026627,"ACLA")
	
	SI i_strcmp(pt_CODESCP_860026627  , "84008") == 0
	ALORS
		EPORTABILITE_SCP_860026627   = 1
	SINON
		EPORTABILITE_SCP_860026627   = 0
		SI i_strcmp(pt_CODESCP_860026627  ,"")!=0
		ALORS
			SPORTABILITE_SCP_860026627   = 1
		SINON
			SPORTABILITE_SCP_860026627   = 0
		FINSI
	FINSI
#	FINSI
FINSI
#\G4R2 QC677

#---------------FIN ACLA----------------------#
#trace1(">>>__LINE__>>> SPORTABILITE_SCP=%d",SPORTABILITE_SCP)

######### CCD_REEL

SI EPORTABILITE_SRP_860026627
ALORS
	CCD_REEL_860026627 = 212
SINON
	SI SPORTABILITE_SRP_860026627
	ALORS
		CCD_REEL_860026627 = 213
	SINON
		SI EPORTABILITE_SCP_860026627
		ALORS
			CCD_REEL_860026627 = 218
		SINON
			SI SPORTABILITE_SCP_860026627
			ALORS
				CCD_REEL_860026627 = 219
			SINON
				SI CCD_860026627 != -1
				ALORS
					CCD_REEL_860026627 = CCD_860026627
				SINON
					CCD_REEL_860026627 = 255
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

########################################################################
#ICID_CONVERTI
########################################################################

erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::ICID,pt_Num_860026627)

SomZonTrav_860026627 = 0
I_860026627 = 0
lg_860026627 = 4

POINT DEB_Boucle1

SI I_860026627 < i_strlen(pt_Num_860026627)
ALORS
	SI I_860026627 + lg_860026627 > i_strlen(pt_Num_860026627)
	ALORS
		lg_860026627 = i_strlen(pt_Num_860026627) - I_860026627
	FINSI
	i_get_sub_str(pt_Num_860026627,I_860026627,I_860026627+lg_860026627-1,pt_Num1_860026627)
	erreur_860026627 = i_set_art_str(g_iartout10,$Conversion::ValASCII,pt_Num1_860026627)
	Num1_860026627 = i_get_art_field(g_iartout10,$Conversion::ValHEX)
	ZonTrav_860026627 = Num1_860026627 % modulo_860026627
	SomZonTrav_860026627 = SomZonTrav_860026627 + ZonTrav_860026627
	I_860026627 = I_860026627 + lg_860026627
	SAUT DEB_Boucle1
FINSI

ICID_CONVERTI_860026627 = SomZonTrav_860026627 % modulo_860026627

#---------------------------------------------------
#G4R2 QC703

#G4R6 Lot2 Interro Ref ALICE ###########################################################################
SI b_Fact_CPS_Loc_860026627
ALORS
	i_strcpy(pt_DEDE_NUM_FAC_860026627,pt_DEDE_N_860026627)
	SI (i_strplcmp(pt_DEDE_NUM_FAC_860026627,"0",0,1)==0)
	ALORS
		i_get_sub_str(pt_DEDE_NUM_FAC_860026627,1,-1,pt_DEDE_NUM_FAC_860026627)
	FINSI
	taille_860026627 = i_conv_ascii_dcb(pt_DEDE_NUM_FAC_860026627, pt_temp_860026627)
	
	SI ( i_EnvoiReqConsTabDist( TD_ALICE_860026627, DATE_GMT_860026627, pt_temp_860026627, taille_860026627, 0, 1) != 0 )
	ALORS
		code_errone_860026627 = 0xA0C0
		code_errone_860026627 = code_errone_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026627,C_instALICE_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI

	instALICE_860026627 = i_LireInstanceECC(C_instALICE_860026627)

	SI (!instALICE_860026627)
	ALORS
		code_rejet_860026627 = 0xA0B0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "ALICE", C_Article_860026627, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026627 = i_LireReqConsTabDist()

	SI erreur_860026627 == 0
	ALORS
		#erreur = i_LireChaineECCv(instALICE, pt_ECCv)
		#instECCv = i_LireEntierECCv( instALICE )
		res_860026627 = i_LireInfoECC( instALICE_860026627, 0 )

#G4R7 Lot3 QC834
		SI ( res_860026627 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026627 = i_LireChaineInfo( res_860026627, 0, 4, pt_temp_860026627 )
			SI i_strcmp(pt_temp_860026627, "" ) != 0
			ALORS
				i_strcpy(pt_TARIF_860026627, pt_temp_860026627 )
				b_ALICE_860026627 = 1
			SINON
				# info complementaire CODE_TARIF vide
				b_Redist_860026627 = 1
				erreur_860026627 = i_format_str2(pt_LIBELREDIST_860026627," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026627,0)
			FINSI
			
			erreur_860026627 = i_LireChaineInfo( res_860026627, 4, 1, pt_temp_860026627 )
			SI i_strcmp(pt_temp_860026627, "" ) != 0
			ALORS
				i_strcpy(pt_EDIT_860026627, pt_temp_860026627 )
				b_ALICE_860026627 = 1
			SINON
				# info complementaire TYPE_EDIT vide
				b_Redist_860026627 = 1
				erreur_860026627 = i_format_str2(pt_LIBELREDIST_860026627," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026627,0)
			FINSI
		SINON
			erreur_860026627 = i_format_str2(pt_LIBELREDIST_860026627," AR <%s> non trouve dans ALICE",pt_DEDE_NUM_860026627,0)
			b_Redist_860026627 = 1
		FINSI
	FINSI
FINSI

############################################################################
# Distribution
############################################################################

############################################################################
# Recherche Instances des ECC
############################################################################################
#voir le pcode dist de Trpvi2.src
#G4R4 QC755
POINT ARD

########################################################################
#  Recherche instance SYMPHONIE
########################################################################

instSYMP_860026627 =i_LireInstanceECC(C_InstSYMP_860026627)
#trace1("instSYMP=<%d>",instSYMP)
SI (!instSYMP_860026627)
ALORS
	#trace("pas d instance SYMPHONIE")
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"SYMPH",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

#--------------------------------------
# SYMPHONIE
#--------------------------------------

SI b_Redist_860026627 == 0 || CPT_RDT_860026627 ==2
ALORS
	erreur_860026627=i_AjouterCouranteECC(instSYMP_860026627)
FINSI

########################################################################
# RECHERCHE instance SPOT
########################################################################

instSPOT_860026627=i_LireInstanceECC(C_InstSPOT_860026627)

SI (!instSPOT_860026627)
ALORS
	#trace("pas d instance SPOT")
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"SPOT",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

#--------------------------------------
# SPOT : {SPOTIMS et plus a SPOT_ETEL}
#--------------------------------------

SI b_Redist_860026627 == 0  || CPT_RDT_860026627 ==2
ALORS
	erreur_860026627=i_AjouterCouranteECC(instSPOT_860026627)
FINSI

############################################################################
# RECHERCHE instance AFDBBIV
############################################################################

instAFDBBIV_860026627=i_LireInstanceECC(C_InstAFDBBIV_860026627)
SI (!instAFDBBIV_860026627)
ALORS
	#trace("pas d instance AFDB")
	erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"AFDBBIV",C_Article_860026627,g_ieec)
	SAUT DISTRI_ERR
FINSI

#--------------------------------------
# AFDB : AFDBBIV
#--------------------------------------

SI b_Redist_860026627 == 0  || CPT_RDT_860026627 ==2
ALORS
	erreur_860026627=i_AjouterCouranteECC(instAFDBBIV_860026627)
FINSI

############################################################################
# Critere de distribution FERPV
############################################################################

SI !b_Come_860026627 && (b_Ferpv_860026627 || b_Eligible_860026627)
ALORS
	SI FACTURABLE_860026627
	ALORS
		#G4R6 Lot2 
		#SI ( ( TYPCTR != CTR_REJET && TYPCTR !=CTR_REJET2 && TYPCTR != CTR_REJET3 && TYPCTR != CTR_REJET5 ) 
		SI ( !( TYPCTR_860026627 == CTR_REJET_860026627 || TYPCTR_860026627 ==CTR_REJET2_860026627 || TYPCTR_860026627 == CTR_REJET3_860026627 || TYPCTR_860026627 == CTR_REJET5_860026627 || (b_Fact_CPS_Loc_860026627 && !b_ALICE_860026627) )
		    && !SPORTABILITE_SRP_860026627 )
		ALORS
			res_860026627=i_AjouterCouranteECC(instFERPV_860026627)
			i_strcpy(pt_EccFact_860026627,"FERPV")
		FINSI
	FINSI
FINSI

############################################################################
# Critere de distribution COME
############################################################################

SI b_Come_860026627
ALORS
	SI FACTURABLE_860026627
	ALORS
		#G4R6 Lot2 
		#SI ( ( TYPCTR != CTR_REJET && TYPCTR !=CTR_REJET2 && TYPCTR != CTR_REJET3 && TYPCTR != CTR_REJET5 ) 
		SI ( !( TYPCTR_860026627 == CTR_REJET_860026627 || TYPCTR_860026627 ==CTR_REJET2_860026627 || TYPCTR_860026627 == CTR_REJET3_860026627 || TYPCTR_860026627 == CTR_REJET5_860026627 || b_Fact_CPS_RI_860026627 || (b_Fact_CPS_Loc_860026627 && !b_ALICE_860026627) )
		    && !SPORTABILITE_SRP_860026627 )
		ALORS
			res_860026627=i_AjouterCouranteECC(instCOME_860026627)
			i_strcpy(pt_EccFact_860026627,"COME")
		FINSI
	FINSI
FINSI

############################################################################
# Critere de distribution ELIGIBLE
############################################################################

SI b_Eligible_860026627
ALORS
	instCOM_ELIG_860026627 = i_LireInstanceECC(C_InstCOM_ELIG_860026627)

	SI (!instCOM_ELIG_860026627)
	ALORS
		erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"COME_ELIGIBLE",C_Article_860026627,g_ieec)
		SAUT DISTRI_ERR
	FINSI

	SI FACTURABLE_860026627
	ALORS
		#G4R6 Lot2 
		#SI ( ( TYPCTR != CTR_REJET && TYPCTR !=CTR_REJET2 && TYPCTR != CTR_REJET3 && TYPCTR != CTR_REJET5 ) 
		SI ( !( TYPCTR_860026627 == CTR_REJET_860026627 || TYPCTR_860026627 ==CTR_REJET2_860026627 || TYPCTR_860026627 == CTR_REJET3_860026627 || TYPCTR_860026627 == CTR_REJET5_860026627 || b_Fact_CPS_RI_860026627 || (b_Fact_CPS_Loc_860026627 && !b_ALICE_860026627) )
		&& !SPORTABILITE_SRP_860026627 )
		ALORS
			instCOM_ELIG_860026627 = i_LireInstanceECC(C_InstCOM_ELIG_860026627)
			SI (!instCOM_ELIG_860026627)
			ALORS
				erreur_860026627 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"COME_ELIGIBLE",C_Article_860026627,g_ieec)
				SAUT DISTRI_ERR
			FINSI

			res_860026627 = i_AjouterCouranteECC(instCOM_ELIG_860026627)
			i_strcpy(pt_EccFact_860026627,"FERPV")
		FINSI
	FINSI
FINSI

##################################################################################
# Validation de la liste des ECCs destinataires
##################################################################################

erreur_860026627=i_ValiderListeECC( 0, 0, 0, 0)

# QC773 DRE calcul de DATE_M remonte
##############################################################################
#DATE_M enveloppe E_V20IP
##############################################################################

erreur_860026627 = i_add_opt( "E_V2OIP" )
erreur_860026627 = i_set_attr_val_n( $E_V2OIP::DATE_M, ICAR_ABS_860026627 + Duree_860026627 )


########################################################################
# FE_rpv
# *************************** FERPV ***************************
SI (!i_ChercherCouranteECC(instFERPV_860026627))
ALORS
	#trace1("<<<__LINE__:__FILE__<<< dup instFERPV <%d>",instFERPV)
	SI (i_dup_art_dest(g_iartin, g_iartout4, C_Tferpv_860026627))
	ALORS
		code_rejet_860026627 = 0xA0D0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_rejet_860026627, C_Tferpv_860026627, C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI

# QC773 DRE calcul de DATE_M remonte ici
###############################################################################
##DATE_M enveloppe E_V20IP
###############################################################################
#
#	erreur = i_add_opt( "E_V2OIP" )
#	erreur = i_set_attr_val_n( $E_V2OIP::DATE_M, HLAHM1 + Duree )

	#SOURCE
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::SOURCE, "18")

	# NUMDDR
	erreur_860026627 = i_format_str2(pt_NUMDDR_860026627, "%s%s", "0", pt_NDI_NUM_860026627)
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDR, pt_NUMDDR_860026627)

	# NUMDDE
	#pk G3R18Cy  Normalisation du demande pour FERPV NUMDDE valorise avec DEDE_NUM
	#erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_DEDE_N)

	#G3R22 DRE QC512
	#erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_DEDE_NUM)
	i_strcpy(pt_DEDE_NUM_FAC_860026627,pt_DEDE_N_860026627)
	SI DEDE_INF_860026627 == 0x80
	ALORS
		SI (i_strplcmp(pt_DEDE_NUM_FAC_860026627,"0",0,1)==0)
		ALORS
			i_get_sub_str(pt_DEDE_NUM_FAC_860026627,1,-1,pt_DEDE_NUM_FAC_860026627)
		FINSI
	SINON
		SI (i_strplcmp(pt_DEDE_NUM_FAC_860026627,"00",0,2)==0)
		ALORS
			i_get_sub_str(pt_DEDE_NUM_FAC_860026627,2,-1,pt_DEDE_NUM_FAC_860026627)
		FINSI
	FINSI
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_DEDE_NUM_FAC_860026627)
	#\G3R22 DRE QC512

# G4R4 DRE QC773
	# DEBUT
#	erreur = i_set_art_field(g_iartout4, $Tfe_rpv::DEBUT,HLAHM1)
	erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::DEBUT,DATE_LOCALE_860026627)

	# DUREE G3R3 lot2
	erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::DUREE,Duree_860026627)

	# NBUT
	# DRE G3R24
	#DRE G3R21C03 QC478
	#SI (SRP_TIERS == 1 || SRP_PTD == 1 || b_Emessage_IP == 1)
	SI ( b_SRP_TIERS_PTD_860026627 == 1 || b_118_TIERS_PTD_860026627 == 1 || b_Emessage_IP_860026627 == 1 ) && !b_Fact_CPS_Loc_860026627
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::NBUT,vc_860026627)
	SINON
		erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::NBUT,0)
	FINSI

	# MTHSTD
	erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::MTHSTD,0)

	#CANAL
	erreur_860026627 = i_set_art_field(g_iartout4,$Tfe_rpv::CANAL, ICID_CONVERTI_860026627)

	#  NBCOD
	erreur_860026627 = i_set_art_field(g_iartout4, $Tfe_rpv::NBCOD, NB_CSV_860026627)

	#C_CSV1
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::C_CSV1, pt_C_CSV_860026627)

	# OP_CSV1
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::OP_CSV1, pt_OP_CSV_860026627)

	# CCD
	erreur_860026627 = i_set_art_field(g_iartout10, $Conversion::CCD, CCD_REEL_860026627)
	erreur_860026627 = i_get_art_str( g_iartout10, $Conversion::CCD, pt_temp_860026627 )
	#trace2("__LINE__ CCD ASCII  <%s>",pt_temp, "")
	erreur_860026627 = i_format_str2( pt_temp2_860026627, "%s%s", "000", pt_temp_860026627)
	i_get_sub_str (pt_temp2_860026627, -3, -1,pt_temp2_860026627)
	#trace2("__LINE__ CCD ASCII 3 dig  <%s>",pt_temp2, "")
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::CCD, pt_temp2_860026627)

	#NOORIG
	SI i_strlen(pt_RedirecNbASCII_860026627)
	ALORS
		erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_RedirecNbASCII_860026627)
		#erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_RedirecNb_DCB)
	SINON
		SI i_strlen(pt_CallingParty02Ascii_860026627)
		ALORS
			erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_CallingParty02Ascii_860026627)
			#erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_CallingParty02_DCB)
		SINON
			SI i_strlen(pt_Computeinfo05Ascii_860026627)
			ALORS
				erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_Computeinfo05Ascii_860026627)
				#erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_CallingNb_DCB)
			FINSI
		FINSI
	FINSI

	# creation dy champ INFDDE pour connaitre la nature du numero demande
	#INFDEDE
	#DRE G3R21C03 QC478
	i_strcpy (pt_temp2_860026627,"000")

	# G3R22C6 QC554
	SI ( DEDE_INF_860026627 != 0x40 || DEDE_INF_860026627 == 0x00 )
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout10, $Conversion::INF, DEDE_INF_860026627)
		erreur_860026627 = i_get_art_str( g_iartout10, $Conversion::INF, pt_temp_860026627)
		erreur_860026627 = i_format_str2( pt_temp2_860026627, "%s%s", "000", pt_temp_860026627)
		i_get_sub_str (pt_temp2_860026627, -3, -1,pt_temp2_860026627)
	FINSI
	#\DRE G3R21C03 QC478
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::INFDDE, pt_temp2_860026627)
	
	#G4R6 Lot2 
	#CODE_TARIF
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::CODE_TARIF,pt_TARIF_860026627)

	#TYPE_EDIT
	erreur_860026627 = i_set_art_str(g_iartout4, $Tfe_rpv::TYPE_EDIT,pt_EDIT_860026627)
FINSI

#G2R4
############################################################################
# COME
# ******************** COME ********************
############################################################################
# ELIGIBLE
# ***************** ELIGIBLE ********************

SI( !i_ChercherCouranteECC(instCOME_860026627) || !i_ChercherCouranteECC(instCOM_ELIG_860026627) )
ALORS
	SI (i_dup_art_tab( g_iartout, g_iartout2, C_Tcome_860026627))
	ALORS
		#trace("ERREUR de duplication")
		code_rejet_860026627 = 0xA0D0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_rejet_860026627,C_Tcome_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI

	#T3t1				type				:-	:-	:MSET :FF:1
	SI (i_valid_field_n(g_iartout, $Tbivsip::RedirecNb))
	ALORS
		erreur_860026627= i_set_art_field(g_iartout2,$Tcome::type,0xAE)
	SINON
		erreur_860026627= i_set_art_field(g_iartout2,$Tcome::type,0xA0)
	FINSI
	
	#idemet		33009100001FFFFFFF
	taille_860026627 = i_conv_ascii_dcb("33009100001FFFFFFF", pt_BUF1_860026627)
	erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::idemet,pt_BUF1_860026627,taille_860026627)
	
	#IMSI		444444444444444F
	taille_860026627 = i_conv_ascii_dcb("444444444444444F", pt_BUF1_860026627)
	erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::IMSI,pt_BUF1_860026627,taille_860026627)
	
	# DRE G4R4 QC773
	# DATE
	erreur_860026627= i_set_art_field(g_iartout2,$Tcome::DATE,DATE_LOCALE_860026627)
	
	
	#nbUT				:-	:-	:MSET :FF:4
	#G4R6 Lot2 
	#SI b_SRP_TIERS_PTD || b_118_TIERS_PTD || b_Emessage_IP
	SI ( b_SRP_TIERS_PTD_860026627 || b_118_TIERS_PTD_860026627 || b_Emessage_IP_860026627 ) && !b_Fact_CPS_Loc_860026627 
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout2, $Tcome::nbUT,vc_860026627)
	FINSI

	#QC696
	#couleur
	#SI SPORTABILITE_SCP
	#ALORS
	#	erreur = i_set_art_field(g_iartout2, $Tcome::couleur,0x1F)
	#SINON
	#	SI EPORTABILITE_SRP || EPORTABILITE_SCP
	#	ALORS
	#		erreur = i_set_art_field(g_iartout2, $Tcome::couleur,0x2F)
	#	FINSI
	#FINSI

	#T3t2				idpart				:-	:-	:MSET :FF:19
	SI DEDE_INTERNAT_860026627
	ALORS
		taille_860026627 = i_conv_ascii_dcb(pt_DEDE_NUM_860026627, pt_BUF1_860026627)
		erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::idpart,pt_BUF1_860026627,taille_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t2","idpart",taille_860026627*8)
	SINON
		erreur_860026627 = i_format_str2(pt_BUF1_860026627,"%s%s","33",pt_DEDE_NUM_860026627)
		taille_860026627 = i_conv_ascii_dcb(pt_BUF1_860026627, pt_temp2_860026627)
		erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::idpart,pt_temp2_860026627,taille_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t2","idpart",taille_860026627*8)
	FINSI
	
	#T3t4				MSISDN				:-	:-	:MSET :FF:19
	i_get_sub_str(pt_NDI_COME_860026627,0,0,pt_temp2_860026627)
	SI ( i_strcmp("+",pt_temp2_860026627) == 0 )
	ALORS
		i_get_sub_str(pt_NDI_COME_860026627,1,-1,pt_BUF1_860026627)
	SINON
		erreur_860026627 = i_format_str2(pt_BUF1_860026627,"%s%s","33",pt_NDI_COME_860026627)
	FINSI

	taille_860026627 = i_conv_ascii_dcb(pt_BUF1_860026627, pt_temp2_860026627)
	erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::MSISDN,pt_temp2_860026627,taille_860026627)
	erreur_860026627 = i_resize_tlv(g_iartout2,"T3t4","MSISDN",taille_860026627*8)

# DRE QC 773
	# T3t7		estalloc  	
	SI i_valid_field_n(g_iartout,$Tbivsip::SerReTimestamp)
	ALORS
		valeur_860026627 = i_get_art_field(g_iartout, $Tbivsip::SerReTimestamp) + C_Jour_860026627
		erreur_860026627 = i_set_art_field(g_iartout2, $Tcome::estalloc,valeur_860026627)
	FINSI
	

	
	#T3t23				MailIdpart			:-	:-	:MSET :20:127
	SI i_valid_field_n(g_iartout,$Tbivsip::DialledDigits)
	ALORS
		erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::DialledDigits,pt_BUF1_860026627)
		erreur_860026627=i_set_art_str(g_iartout2,$Tcome::MailIdpart,pt_BUF1_860026627)
		taille_860026627 = i_strlen(pt_BUF1_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t23","MailIdpart",taille_860026627)
	SINON
		SI i_valid_field_n(g_iartout, $Tbivsip::AsCalledPartyAd)
		ALORS
			erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::AsCalledPartyAd,pt_BUF1_860026627)
			erreur_860026627=i_set_art_str(g_iartout2,$Tcome::MailIdpart,pt_BUF1_860026627)
			taille_860026627 = i_strlen(pt_BUF1_860026627)
			erreur_860026627 = i_resize_tlv(g_iartout2,"T3t23","MailIdpart",taille_860026627)
		SINON
			erreur_860026627 = i_supprChamp(g_iartout2, "T3t23")
		FINSI
	FINSI
	
	#T3t24				MailMsOrEntity		:-	:-	:MSET :20:127
	SI(i_valid_field_n(g_iartout, $Tbivsip::CallingPart02))
	ALORS
		erreur_860026627 = i_format_str2(pt_BUF1_860026627,"%s%s","33",pt_CallingParty02Ascii_860026627)
		erreur_860026627=i_set_art_str(g_iartout2,$Tcome::MailMsOrEntity,pt_BUF1_860026627)
		taille_860026627 = i_strlen(pt_BUF1_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t24","MailMsOrEntity",taille_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t24")
	FINSI
	
	#T3t30	T4t30.1		timeInCE			:-	:-	:MSET :00:7
	date_audit_860026627 = i_date_audit()
	DATE_AUDIT_METRO_860026627 = i_DHgetLocalTime(NUMTAB_860026627, ZONEMETRO_860026627, date_audit_860026627)
	erreur_860026627 = i_set_art_field(g_iartout2, $Tcome::timeInCE,DATE_AUDIT_METRO_860026627)
	
	#T3t35	T4t35.2		occurenceNb			:-	:-	:MSET :FF:1
	SI (i_valid_field_n(g_iartout, $Tbivsip::RedirecNb))
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout2, $Tcome::occurenceNb, NB_CSV_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T4t35.2")
		#trace(" suppression du champ T4t35.2 ")
	FINSI

	#T3t58				GASCII				:-	:-	:MSET :20:50
	#G4R4 QC756
	SI (i_valid_field_n(g_iartout, $Tbivsip::RedirecNb))
	ALORS
		erreur_860026627 = i_format_str2(pt_BUF1_860026627,"%s%s",pt_C_CSV_860026627,"   ")
		i_get_sub_str(pt_BUF1_860026627, 0, 2, pt_C_CSV_860026627)
		trace2("__FILE__:__LINE__ ## TEST ## ======> pt_C_CSV <%s> #### ",pt_C_CSV_860026627 ,"")
		i_strcpy(pt_BUF1_860026627,pt_C_CSV_860026627)

		erreur_860026627 = i_format_str2(pt_BUF2_860026627,"%s%s",pt_OP_CSV_860026627,"  ")
		i_get_sub_str(pt_BUF2_860026627, 0, 1, pt_OP_CSV_860026627)
		trace2("__FILE__:__LINE__ ## TEST ## ======> pt_OP_CSV <%s> #### ",pt_OP_CSV_860026627 ,"")
		i_strcpy(pt_BUF2_860026627,pt_OP_CSV_860026627)

		erreur_860026627 = i_format_str2(pt_temp2_860026627,"%s%s",pt_BUF1_860026627,pt_BUF2_860026627)
		erreur_860026627 = i_set_art_str(g_iartout2, $Tcome::GASCII,pt_temp2_860026627)
		erreur_860026627 = i_resize_tlv (g_iartout2, "T3t58","GASCII", i_strlen(pt_temp2_860026627) )
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t58")
		#trace(" suppression du champ  T3t58 ")
	FINSI

	#T3t64				RedirectingNb		:-	:-	:MSET :FF:19
	SI (i_valid_field_n(g_iartout, $Tbivsip::RedirecNb))
	ALORS
		erreur_860026627 = i_format_str2(pt_BUF1_860026627,"%s%s","33",pt_RedirecNbASCII_860026627)
		taille_860026627 = i_conv_ascii_dcb(pt_BUF1_860026627, pt_temp2_860026627)
		erreur_860026627=i_memcpy_art_field_n(g_iartout2,$Tcome::RedirectingNb,pt_temp2_860026627,taille_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t64","RedirectingNb",taille_860026627*8)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t64")
		#trace(" suppression du champ  T3t64 ")
	FINSI

	#G4R2C5 QC703
	#T3t65
	#erreur = i_get_field_str(g_iartout,"RedirecReas",pt_BUF1)
	#taille = i_conv_ascii_dcb(pt_BUF1, pt_temp2)
	#erreur=i_memcpy_art_field_n(g_iartout2,$Tcome::RedirectReason,pt_temp2,taille)
	#erreur = i_resize_tlv(g_iartout2,"T3t65","RedirectReason",taille)
	#G4R2 QC710
	SI i_valid_field_n(g_iartout, $Tbivsip::RedirecReas)
	ALORS
		erreur_860026627 = i_get_field_str(g_iartout,"RedirecReas",pt_BUF1_860026627)
		taille_860026627 = i_conv_ascii_dcb(pt_BUF1_860026627, pt_temp2_860026627)
		erreur_860026627 = i_memcpy_art_field_n(g_iartout2,$Tcome::RedirectReason,pt_temp2_860026627,taille_860026627)
		erreur_860026627 = i_resize_tlv(g_iartout2,"T3t65","RedirectReason",taille_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t65")
		#trace ("### Suppression du champ T3t65 ###")
	FINSI

# DRE QC 773
	# T3t66	 T4t66.1.5	CallEndTStamp  	
	SI i_valid_field_n(g_iartout,$Tbivsip::CallEndTime)
	ALORS
		valeur_860026627 = i_get_art_field(g_iartout, $Tbivsip::CallEndTime) + C_Jour_860026627
		erreur_860026627 = i_set_art_field(g_iartout2, $Tcome::CallEndTStamp,valeur_860026627)
	FINSI


	#T3t66	T4t66.1.8		CORLStatus		:D	:-	:1VAL :CORLStatus
	#G2R4 QC703
	#SI i_valid_field_n(g_iartout, $Tbivsip::CORLStatus)
	#ALORS
	#	erreur = i_get_art_str(g_iartout, $Tbivsip::CORLStatus,pt_BUF1)
	#	taille = i_conv_ascii_dcb(pt_BUF1, pt_temp2)
	#	erreur=i_memcpy_art_field_n(g_iartout2,$Tcome::CORLStatus,pt_temp2,taille)
	#FINSI

	SI i_valid_field_n(g_iartout, $Tbivsip::CORLStatus)
	ALORS
		erreur_860026627 = i_get_art_str(g_iartout, $Tbivsip::CORLStatus,pt_BUF1_860026627)
		valeur_860026627 = CONV_ASCIINUMDEC_INT_860026233(pt_BUF1_860026627)
		SI ( valeur_860026627 == -1 )
		ALORS
			trace ( "[Tprims DISTR]  -- ERREUR conversion champ CORLStatus---")
		SINON
			erreur_860026627 = i_set_art_field(g_iartout2,$Tcome::CORLStatus,valeur_860026627 )
		FINSI
FINSI

	#T3t67	T4t67.1.3	AnswerIndicator		:-	:-	:1VAL :FF:1

	#G4R6 Lot2 
	#T3t72				Type Editeur		:-	:-	:1VAL :FF:1
	SI b_ALICE_860026627
	ALORS
		erreur_860026627 = i_set_art_str(g_iartout2, $Tcome::TYPE_EDIT,pt_EDIT_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t72")
	FINSI

	#T3t73				Code Tarif			:-	:-	:1VAL :FF:1
	SI b_ALICE_860026627
	ALORS
		erreur_860026627 = i_set_art_str(g_iartout2, $Tcome::CODE_TARIF,pt_TARIF_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout2, "T3t73")
	FINSI

FINSI

############################################################################
# Duplication SPOT  g_iartout6
############################################################################

#G4R2
#SI ( instSPOT )
#ALORS
SI ( !i_ChercherCouranteECC(instSPOT_860026627) )
ALORS
	# Ajout de SPOT a la liste courante des ECC:
	#G4R2
	#erreur=i_AjouterCouranteECC(instSPOT)

	SI (i_dup_art_id(g_iartout, g_iartout6))
	ALORS
		erreur_860026627 = i_PlvMessEmettre(8502, 2, g_iartin, "", 3, "pour Spot", C_Article_860026627, pt_sgtqs_860026627)
		SAUT DISTRI_ERR
	FINSI

	SI (i_rename_art(g_iartout6, C_Tspot_860026627))
	ALORS
		erreur_860026627 = i_PlvMessEmettre(8502, 2, g_iartin, "", 3, "pour Spot", C_Article_860026627, pt_sgtqs_860026627)
		SAUT DISTRI_ERR
	FINSI

	#trace(" Ajout de champs supplementaires")

	# Champ SGTQS
	erreur_860026627 = i_ajoutChampNum(g_iartout6,$TspotTbivsip::T4SGTQS,$TspotTbivsip::SGTQS,0)
	erreur_860026627=i_set_art_str(g_iartout6,$TspotTbivsip::SGTQS,pt_sgtqs_860026627)
FINSI

########################################################################
# DUPLICATION AFDB    g_iartout7
########################################################################

SI( !i_ChercherCouranteECC(instAFDBBIV_860026627))
ALORS

	erreur_860026627 = i_dup_art_id(g_iartout,g_iartout7)

	SI (erreur_860026627)
	ALORS
		#trace1(">>>__LINE__>>>__FILE__>>> ERREUR de duplication vers SYMPHONIE : %d",erreur)
		code_rejet_860026627 = 0xA0D0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_rejet_860026627,C_Tafdbbiv_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI
	res_860026627 = i_rename_art(g_iartout7, C_Tafdbbiv_860026627)

	#-----------------------
	#Complement AFDBBIV
	#------------------------

	# Champ SGTQS
	erreur_860026627 = i_ajoutChampNum(g_iartout7,$Tafdbbiv::T4Sgtqs,$Tafdbbiv::SGTQS,0)
	erreur_860026627=i_set_art_str(g_iartout7,$Tafdbbiv::SGTQS, pt_sgtqs_860026627)
FINSI

############################################################################
# Symphonie (TsymTbivsip, g_iartout5)
########################################################################

SI( !i_ChercherCouranteECC(instSYMP_860026627))
ALORS
	#trace(">>>__LINE__>>> Duplication vers SYMPHONIE")
	#G4R2 QC695
	#erreur = i_dup_art_id(g_iartin,g_iartout5)
	erreur_860026627 = i_dup_art_id(g_iartout,g_iartout5)

	SI (erreur_860026627)
	ALORS
		#trace1(">>>__LINE__>>>__FILE__>>> ERREUR de duplication vers SYMPHONIE : %d",erreur)
		code_rejet_860026627 = 0xA0D0
		code_rejet_860026627 = code_rejet_860026627 + EFFICACE_860026627
		erreur_860026627 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_rejet_860026627,C_TSymTbivsip_860026627,C_Article_860026627)
		SAUT DISTRI_ERR
	FINSI

	res_860026627 = i_rename_art(g_iartout5, C_TSymTbivsip_860026627)

	# ajout de tous les champs de T3ce
	erreur_860026627 = i_ajoutChampNum(g_iartout5, $TsymTbivsip::T4ccd,$TsymTbivsip::CCD,6)

	#  HLAHM1 (DATE_LOCALE)**********
	SI HLAHM1_860026627 != -1
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::DATE_LOCALE,HLAHM1_860026627)
	SINON
		erreur_860026627 = i_supprChamp(g_iartout5, "T4date_locale")
	FINSI

	# ************** SGTQS *****************
	erreur_860026627=i_set_art_str(g_iartout5,$TsymTbivsip::SGTQS,pt_sgtqs_860026627)

	# ************** ECC_FACT *****************
	SI (i_strcmp("", pt_EccFact_860026627) != 0)
	ALORS
		erreur_860026627=i_set_art_str(g_iartout5, $TsymTbivsip::ECC_FACT,pt_EccFact_860026627)
	SINON
		erreur_860026627=i_set_art_str(g_iartout5, $TsymTbivsip::ECC_FACT," ")
	FINSI

	# ************** CCD *****************
	SI CCD_860026627 != -1
	ALORS
		erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::CCD,CCD_REEL_860026627)
	SINON
		erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::CCD,255)
	FINSI

	# ************** CODCIRDR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIRDR_860026627 != -1
	ALORS
		#trace(">>>__LINE__>>>CODCIRDR est valide")
		i_strcpy(pt_BUF1_860026627, " ")
		erreur_860026627 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIRDR_860026627)
		erreur_860026627 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF1_860026627)
		SI  g_iartout10.CODCIRDA[2] > 9
		ALORS
			i_get_sub_str(pt_BUF1_860026627,2,5,pt_BUF1_860026627)
		SINON
			i_get_sub_str(pt_BUF1_860026627,1,5,pt_BUF1_860026627)
		FINSI
		erreur_860026627=i_set_art_str(g_iartout5, $TsymTbivsip::CODCIRDR, pt_BUF1_860026627)
	SINON
		erreur_860026627=i_supprChamp(g_iartout5,"T4codcirdr")
	FINSI

	# ***************** CODCIR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIR_860026627 != -1
	ALORS
		#trace(">>>__LINE__>>>CODCIR est valide")
		i_strcpy(pt_BUF2_860026627, " ")
		erreur_860026627 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIR_860026627)
		erreur_860026627 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF2_860026627)
		SI (g_iartout10.CODCIRDA[2] > 9)
		ALORS
			i_get_sub_str(pt_BUF2_860026627,2,5,pt_BUF2_860026627)
		SINON
			i_get_sub_str(pt_BUF2_860026627,1,5,pt_BUF2_860026627)
		FINSI
		erreur_860026627=i_set_art_str(g_iartout5, $TsymTbivsip::CODCIR, pt_BUF2_860026627)
	SINON
		erreur_860026627=i_supprChamp(g_iartout5,"T4codcir")
	FINSI

	# ************** IDUS_INF *****************
	erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::IDUS_INF,IDUS_INF_860026627)

	# ************** DETR_INF *****************
	# G3R22C6 QC554
	SI ( DEDE_INF_860026627 == 0x40 )
	ALORS
		DEDE_INF_860026627 = 0x00
	FINSI
	erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::DEDE_INF,DEDE_INF_860026627)

	# ************** EFFICACITE *****************
	erreur_860026627 = i_set_art_field(g_iartout5,$TsymTbivsip::EFFICACE,EFFICACE_860026627)
	
	#G4R6 Lot2 
	# ****** TYPE EDITEUR ******* CODE TARIF **********
	SI b_ALICE_860026627
	ALORS
		erreur_860026627 = i_set_art_str(g_iartout5, $TsymTbivsip::CODE_TARIF,pt_TARIF_860026627 )
		erreur_860026627 = i_set_art_str(g_iartout5, $TsymTbivsip::TYPE_EDIT,pt_EDIT_860026627 )
	SINON
		erreur_860026627 = i_supprChamp(g_iartout5, "T4code_tarif")
		erreur_860026627 = i_supprChamp(g_iartout5, "T4type_edit")
	FINSI
FINSI

#Fin SYMPHONIE

#====================================
# Envoi vers IECC
#====================================

########################################################################
# SYMPHONIE ($TsymTbivsip, g_iartout5)
########################################################################

SI (! i_ChercherCouranteECC(instSYMP_860026627))
ALORS
	#trace(">>>__LINE__>>> emission vers Symphonie")
	erreur_860026627  = i_stocke_art_iecc(g_iartout5,instSYMP_860026627)
FINSI

########################################################################
# TFERPV ($Tfe_rpv, g_iartout4)
########################################################################

SI (! i_ChercherCouranteECC(instFERPV_860026627))
ALORS
	#trace("###__LINE__### emission vers FERPV")
	erreur_860026627  = i_stocke_art_iecc(g_iartout4,instFERPV_860026627)
FINSI

########################################################################
#AFDBBIV    ($Tafdbiv g_iartout7)
########################################################################

SI( !i_ChercherCouranteECC( instAFDBBIV_860026627 ) )
ALORS
	#trace("###__LINE__### emission vers AFDBBIV")
	res_860026627 = i_stocke_art_iecc(g_iartout7, instAFDBBIV_860026627)
FINSI

########################################################################
#SPOT  (TspotTbivsip g_iartout6
########################################################################

SI( !i_ChercherCouranteECC( instSPOT_860026627 ) )
ALORS
	#trace("###__LINE__### emission vers SPOT")
	res_860026627 = i_stocke_art_iecc(g_iartout6, instSPOT_860026627)
FINSI

# G4R2
############################################################################
# COME   g_iartout2
############################################################################

SI( !i_ChercherCouranteECC( instCOME_860026627 ) )
ALORS
	#trace("###__LINE__### emission vers COME")
	res_860026627 = i_stocke_art_iecc(g_iartout2, instCOME_860026627)
FINSI

############################################################################
# ELIGIBLE   g_iartout2
############################################################################

SI( !i_ChercherCouranteECC( instCOM_ELIG_860026627 ) )
ALORS
	#trace("###__LINE__### emission vers COME_ELIGIBLE")
	res_860026627 = i_stocke_art_iecc(g_iartout2, instCOM_ELIG_860026627)
FINSI

############################################################################
# ARD
############################################################################

#G4R4 QC755
SI b_Redist_860026627
ALORS
	SAUT REDIST
FINSI

RETOUR TRAIT_OK

############################################################################
# Stockage en Errone
########################################################################

POINT DISTRI_ERR

#trace( ">>>__LINE__>>> Stockage en errone de distribution")
res_860026627 = i_make_art_rej(g_iartin, g_iartout8, code_rejet_860026627)
res_860026627 = i_stocke_art( g_iartout8, 0, PT_ERRONE, 0)

RETOUR TRAIT_OK

##############################################################################
# Stockage en ELIMINE EXPLICITE  (REJET3 = 1 ex: cas DC 119)
##############################################################################

POINT ELIMINE_EXP

#trace( "###__LINE__### Stockage en elimine explicite")
res_860026627 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK


# G4R2
############################################################################
# Stockage en REDISTRIBUTION
############################################################################

POINT REDIST

SI ( CPT_RDT_860026627 == 0 )
ALORS
	#G4R6 Lot1 QC779 
	SI Flag_860026627
	ALORS
		erreur_860026627 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026627,C_Article_860026627,pt_sgtqs_860026627)
	SINON
		erreur_860026627 = i_PlvMessEmettre(8703,2,g_iartin,"",3,pt_LIBELREDIST_860026627,C_Article_860026627,pt_sgtqs_860026627)
	FINSI
FINSI
#trace("###__LINE__### emission vers REDISTRIBUTION")
res_860026627 = i_stocke_art( g_iartin, 0, PT_REDIST|RD_TABLE1, 0 )

RETOUR TRAIT_OK

#trace(" Fin Pcode Distribution : ### __FILE__ ### ")
