DEFINITION C_Article_860026549 "Tpppwl2"
DEFINITION C_TCttpppwl2_860026549 "TcttTpppwl2"
DEFINITION C_TSymTpppwl2_860026549 "TsymTpppwl2"
DEFINITION C_TfemsPPPwl2_860026549 "TfemsPPPwl2"
DEFINITION C_TnovahPPPwl2_860026549 "TnovahPPPwl2"
DEFINITION C_InstSYMPH_860026549 "SYMP"
DEFINITION C_InstCTT1_860026549 "CTT1ppp"
DEFINITION C_InstCTT2_860026549 "CTT2ppp"
DEFINITION C_instFEMS_860026549 "FEMS"
DEFINITION C_instNOVAH_860026549 "NOVAHppp"
DEFINITION FA_DHCP_V4_860026549 "4"
DEFINITION FA_DHCP_V6_860026549 "5"
REGISTRE ENTIER instSYMPH_860026549
REGISTRE ENTIER instCTT1_860026549
REGISTRE ENTIER instCTT2_860026549
REGISTRE ENTIER instFEMS_860026549
REGISTRE ENTIER instNOVAH_860026549
REGISTRE ENTIER b_CTT1_860026549
REGISTRE ENTIER b_CTT2_860026549
REGISTRE ENTIER b_FEMS_860026549
REGISTRE ENTIER b_EFFICACE_860026549
REGISTRE ENTIER erreur_860026549
REGISTRE ENTIER res_860026549
REGISTRE ENTIER code_errone_860026549
REGISTRE ENTIER boucle_860026549
REGISTRE ENTIER bouclelg_860026549
REGISTRE ENTIER b_critcommun_860026549
REGISTRE ENTIER date_pivot_860026549
REGISTRE ENTIER b_DebutAccount_860026549
REGISTRE ENTIER lg_IDUS_N_860026549
REGISTRE ENTIER lg_IDUS_N_DCB_860026549
REGISTRE ENTIER lg_IDUS_controle_860026549
REGISTRE ENTIER b_idus_860026549
REGISTRE ENTIER b_disconcause_860026549
REGISTRE ENTIER b_DHCP_860026549
REGISTRE ENTIER b_DHCP_V6_860026549
REGISTRE POINTEUR pt_BUF70_860026549
REGISTRE POINTEUR pt_BUF260_860026549
REGISTRE POINTEUR pt_BUF40_860026549
REGISTRE POINTEUR pt_BUF20_860026549
REGISTRE POINTEUR pt_RACINE_PPP_LOG_860026549
REGISTRE POINTEUR pt_SEUIL_860026549
REGISTRE POINTEUR pt_RT_TLOG_860026549
REGISTRE POINTEUR pt_RT_RT_TLOG_860026549
REGISTRE POINTEUR pt_RT_REZO_860026549
REGISTRE POINTEUR pt_RT_ACCESS_860026549
REGISTRE POINTEUR pt_sgtqs_860026549
REGISTRE POINTEUR pt_ECCFACT_860026549
REGISTRE POINTEUR pt_ACC_INST_860026549
REGISTRE POINTEUR pt_IDUS_N_860026549
REGISTRE POINTEUR pt_IDUS_N_DCB_860026549
REGISTRE POINTEUR pt_IDUS_controle_860026549
REGISTRE POINTEUR pt_disconcause_860026549
REGISTRE POINTEUR pt_BufMajuscul_860026549
############################################################################
# Fichier : Tpppwl2B_dis.src
#
# Distribution : Tpppwl2B
#
# En sortie :
#      utilitaire  Conversion - g_iartout10
#    SYMPHONIE - TsymTpppwl2  - g_iartout6
#         SIVM - TsivmTpppwl2 - g_iartout5
#         CTT1 - TcttTpppwl2  - g_iartout4
#         CTT2 - TcttTpppwl2  - g_iartout3
#         FEMS - TfemsPPPwl2  - g_iartout2
#         NOVAH -TnovahPPPwl2 - g_iartout7
#
# REFERENTIELS :
# TD_Fixe FEMS (-1-4D)

# HISTORIQUE :
#	04/02/08 -JLG- FTSA-G3R6 creation
#	28/02/08 -FAL- FTSA-G3R6 FO2326 une seule ECC FEMS
#	17/10/08 -RHE- FTSA-G3R10 QC105 ("commence par '/account'" devient "contient '/account'")
#	05/05/09 -JLG- FTSA-G3R13 QC242 : NOVAH T3 TYPE en ascii
#	28/06/10 -THE- FTSA_G3R17Cx Version unitaire
#	27/07/10 -THE- FTSA_G3R18 Modif criteres de distribution
#	04/10/11 -THE- VerifPcode
#	28/05/2013 - THE - G4R3 suppression envoi vers SIVM
#	21/07/2014 - THE - G4R7 Lot3 Adresses V4 ou V6
#	06/08/2014 - THE - G4R7 Lot4 QC835 b_DHCP = 0
#	12/08/2014 - THE - G4R7 b_disconcause_I devient b_disconcause (INTERIM + START)
#	14/11/2014 - DRE - G4R8 QC851
#
############################################################################

############################################################################
# Declarations
############################################################################

# Constantes
#G4R3


# variables entieres
#G4R3
#G4R7 b_disconcause_I devient b_disconcause
#DRE G4R8 QC851

# variables pointeurs


#---------------------------------------------------------------------------
# Allocation et INITIALISATION
#---------------------------------------------------------------------------
pt_BUF260_860026549 	  = "1234567890123456789212345612345123456789123456789123456123451234567891234567891234561234512345678912345678912345612345123456789123456789123456123451234567891234567891234561234512345678912345678912345612345123456789123456789123456123451234567891234567891234561"
pt_BUF70_860026549 	  = "pt_BUF6060606060606060606060606060606060606060606060606060606060606060"
pt_BUF40_860026549 	  = "4040404040404040404040404040404040404040"
pt_BUF20_860026549	  = "11223344556677889900"
pt_sgtqs_860026549	  = "1111111111111111111111"
pt_ACC_INST_860026549	  = "2222222222222222222222"
#pt_IP_ADDR	  = "3333333333333333333333"
pt_ECCFACT_860026549	  = "4444444444444444444"
#pt_VAL_OUT_MAC = "22334455667788990011"
#pt_VAL_OUT_RA = "33445566778899001122"
pt_RACINE_PPP_LOG_860026549 = "44556677889900112233"
pt_SEUIL_860026549	  = "55667788990011223344"
pt_RT_TLOG_860026549	  = "66778899001122334455"
pt_RT_RT_TLOG_860026549 = "77889900112233445566"
pt_RT_REZO_860026549	  = "88990011223344556677"
pt_RT_ACCESS_860026549  = "99001122334455667788"
pt_IDUS_N_860026549	  = "pt_IDUS_N111111111"
pt_IDUS_N_DCB_860026549  = "pt_IDUS_N_DCB2222222"
pt_IDUS_controle_860026549 = "pt_IDUS_controle33333333"
pt_disconcause_860026549 = "pt_disconcause111111111111"
pt_BufMajuscul_860026549 = "pt_BufMajuscul222222222222"
#

instSYMPH_860026549	= 0
#G4R3
#instSIVM	= 0
instCTT1_860026549	= 0
instCTT2_860026549	= 0
instFEMS_860026549	= 0
instNOVAH_860026549	= 0
b_critcommun_860026549	= 0
b_EFFICACE_860026549	= 0
erreur_860026549		= 0
res_860026549		= 0
code_errone_860026549	= 0
#USER_IP_ADDR	= 0
#NAS_IP_ADDR	= 0
b_DebutAccount_860026549	= 0
lg_IDUS_N_860026549	= 0
lg_IDUS_N_DCB_860026549	= 0
lg_IDUS_controle_860026549 = 0
b_CTT1_860026549		= 0
b_CTT2_860026549		= 0
b_FEMS_860026549		= 0
b_idus_860026549		= 0
b_disconcause_860026549 = 0
#G4R7 Lot3 b_fa		= 0
b_DHCP_860026549		= 0
#
#DRE G4R8 QC851
b_DHCP_V6_860026549 = 0

i_strcpy(pt_sgtqs_860026549,"")
i_strcpy(pt_ECCFACT_860026549,"")
i_strcpy(pt_ACC_INST_860026549,"")
#i_strcpy(pt_IP_ADDR,"")
i_strcpy(pt_BUF260_860026549,"")
i_strcpy(pt_BUF70_860026549,"")
i_strcpy(pt_BUF40_860026549,"")
i_strcpy(pt_BUF20_860026549,"")
#i_strcpy(pt_VAL_OUT_MAC,"")
#i_strcpy(pt_VAL_OUT_RA,"")
i_strcpy(pt_RACINE_PPP_LOG_860026549,"")
i_strcpy(pt_SEUIL_860026549,"")
i_strcpy(pt_RT_TLOG_860026549,"")
i_strcpy(pt_RT_RT_TLOG_860026549,"")
i_strcpy(pt_RT_REZO_860026549,"")
i_strcpy(pt_RT_ACCESS_860026549,"")
i_strcpy(pt_IDUS_N_860026549,"")
i_strcpy(pt_IDUS_N_DCB_860026549,"")
i_strcpy(pt_disconcause_860026549,"")
i_strcpy(pt_BufMajuscul_860026549,"")
# VerifPcode
i_strcpy(pt_IDUS_controle_860026549,"")

################################################################################
# Variables Fonctionnelles Globales
################################################################################
#
#----------------------------------------------------------------------------
# SGTQS
#----------------------------------------------------------------------------
i_strcpy(pt_sgtqs_860026549,i_LireEECSGTQS( g_ieec ))

##### dape pivot pour tables externes
date_pivot_860026549 = i_get_art_field(g_iartin, $Tpppwl2::ddebut)


##### variable SEUIL ##############################
i_strcpy(pt_SEUIL_860026549,i_get_tab_field( "WANA", date_pivot_860026549, "WL2TCSTC_Seuil"))
#trace2("TC_Seuil <%s> ",pt_SEUIL,"")


##### variable b_EFFICACE ##############################
#vrai si sessiontimevalue > SEUIL mais en ASCII

erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::sestimevalue,pt_BUF260_860026549)
#trace2("sestimevalue <%s> ", pt_BUF260, "")

SI (i_strlen(pt_BUF260_860026549) > i_strlen(pt_SEUIL_860026549))
ALORS
	b_EFFICACE_860026549 = 1
SINON
	SI (i_strlen(pt_BUF260_860026549) == i_strlen(pt_SEUIL_860026549))
	ALORS
		SI(i_strcmp(pt_BUF260_860026549,pt_SEUIL_860026549) > 0)
		ALORS
			b_EFFICACE_860026549 = 1
		FINSI
	FINSI
FINSI
trace1("b_EFFICACE <%d>", b_EFFICACE_860026549)


##### variable ACC_INST ##############################
erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::accinstance,pt_ACC_INST_860026549)
#trace2("accinstance <%s> ", pt_ACC_INST, "")


##### variable b_DebutAccount vrai si FD/account_poid commence par /account ##############
i_strcpy(pt_BUF260_860026549,"")
erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::accpoid, pt_BUF260_860026549)

SI (i_adequation_chaine_expreg(pt_BUF260_860026549, "/account") == 0)
ALORS
	b_DebutAccount_860026549=1
FINSI


##### variable pt_IDUS_N pseudo_aid ou numero BSS migre ##############################
#account_poids 9 octest de gauche de l entree

SI !b_DebutAccount_860026549
ALORS
	SI (i_strlen(pt_BUF260_860026549) < 9)
	ALORS
		i_strcpy(pt_IDUS_N_860026549,pt_BUF260_860026549)
	SINON
		i_get_sub_str(pt_BUF260_860026549,0,8,pt_IDUS_N_860026549)
	FINSI
	lg_IDUS_N_860026549 = i_strlen(pt_IDUS_N_860026549)
	lg_IDUS_N_DCB_860026549  = i_conv_ascii_dcb(pt_IDUS_N_860026549 , pt_IDUS_N_DCB_860026549)
	lg_IDUS_controle_860026549= i_ConvertirChaine(pt_IDUS_N_DCB_860026549, lg_IDUS_N_DCB_860026549, 1, pt_IDUS_controle_860026549, lg_IDUS_N_860026549, 3)

	SI (i_strplcmp ( pt_IDUS_N_860026549, pt_IDUS_controle_860026549, 0, lg_IDUS_N_860026549) == 0)
	ALORS
		b_idus_860026549 = 1
	FINSI
FINSI


##### variable RACINE_PPP_LOG ##############################
i_strcpy(pt_BUF260_860026549,"")
erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::ppplogin,pt_BUF260_860026549)
#trace2("ppplogin <%s> ", pt_BUF260, "")

bouclelg_860026549 = i_strlen(pt_BUF260_860026549)
#trace1("bouclelg <%d>" ,bouclelg)
boucle_860026549 = 0

POINT bouclestr
# trace1("boucle <%d>" ,boucle)

SI (i_strplcmp( pt_BUF260_860026549, "/", boucle_860026549, 1)==0)
ALORS
	i_get_sub_str(pt_BUF260_860026549, 0,boucle_860026549, pt_RACINE_PPP_LOG_860026549)
	#trace2("RACINE_PPP_LOG <%s> " , pt_RACINE_PPP_LOG, "")
	SAUT finbouclestr
SINON
	boucle_860026549 = boucle_860026549 + 1

	SI(bouclelg_860026549 > boucle_860026549)
	ALORS
		SAUT bouclestr
	SINON
		trace("ATTENTION pas de / dans ppplogin")
		SAUT finbouclestr
	FINSI
FINSI

POINT finbouclestr
#trace2("RACINE_PPP_LOG <%s> " , pt_RACINE_PPP_LOG, "")


##### variable RT_TLOG ##############################
#fonction logCodeOper   0 si present    1 si absent

erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::ppplogin,pt_BUF70_860026549)
erreur_860026549 = i_format_str2(pt_BUF260_860026549 ,"%s%s","WL2TLO",pt_BUF70_860026549)
#trace2("Appel RT_TLOG <%s> ",pt_BUF260 ,"")

i_strcpy(pt_RT_TLOG_860026549,i_get_tab_field( "WANA", date_pivot_860026549, pt_BUF260_860026549))
#trace2("pt_RT_TLOG <%s> ",pt_RT_TLOG,"")

SI(i_strcmp(pt_RT_TLOG_860026549,g_inull)==0)
ALORS
	i_strcpy(pt_RT_TLOG_860026549,"1")
SINON
	i_strcpy(pt_RT_TLOG_860026549,"0")
FINSI
#trace2("pt_RT_TLOG 0=present 1=abs <%s>" , pt_RT_TLOG, "")

##### variable RT_TR_LOG ##############################
#fonction RootCodeOper 0 si present    1 si absent

SI (i_strlen(pt_RACINE_PPP_LOG_860026549)> 1)
ALORS
	erreur_860026549 = i_format_str2(pt_BUF20_860026549 ,"%s%s","WL2RLO",pt_RACINE_PPP_LOG_860026549)
	#trace2("Appel RT_RT_TLOG <%s> ",pt_BUF20 ,"")
	i_strcpy(pt_RT_RT_TLOG_860026549,i_get_tab_field( "WANA", date_pivot_860026549, pt_BUF20_860026549))
	#trace2("pt_RT_RT_TLOG <%s> ",pt_RT_RT_TLOG,"")
	SI(i_strcmp(pt_RT_RT_TLOG_860026549,g_inull)==0)
	ALORS
		i_strcpy(pt_RT_RT_TLOG_860026549,"1")
	SINON
		i_strcpy(pt_RT_RT_TLOG_860026549,"0")
	FINSI
SINON
	i_strcpy(pt_RT_RT_TLOG_860026549,"0")
FINSI
#trace2("RT_RT_TLOG 0=present 1=abs <%s>" , pt_RT_RT_TLOG, "")


##### variable RT_REZO ##############################
erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::nor,pt_BUF20_860026549)
#trace2("nor <%s> ", pt_BUF20, "")
erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::ca,pt_BUF40_860026549)
#trace2("ca  <%s> ", pt_BUF40, "")
erreur_860026549 = i_format_str2(pt_BUF70_860026549 ,"%s%s","WL2TOR",pt_BUF20_860026549)
erreur_860026549 = i_format_str2(pt_BUF20_860026549 ,"%s%s","S",pt_BUF40_860026549)
erreur_860026549 = i_format_str2(pt_BUF260_860026549 ,"%s%s",pt_BUF70_860026549,pt_BUF20_860026549)
#trace2("Appel RT_REZO <%s> ",pt_BUF260 ,"")
i_strcpy(pt_RT_REZO_860026549,i_get_tab_field( "WANA", date_pivot_860026549, pt_BUF260_860026549))
#trace2("pt_RT_REZO <%s> ",pt_RT_REZO,"")

SI(i_strcmp(pt_RT_REZO_860026549,g_inull)==0)
ALORS
	i_strcpy(pt_RT_REZO_860026549,"1")
SINON
	i_strcpy(pt_RT_REZO_860026549,"0")
FINSI
#trace2("pt_RT_REZO 0=present 1=abs <%s>" , pt_RT_REZO, "")


#G4R7 Lot3
##### variable DHCP(V4 ou V6 ) ##############################
erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::fa, pt_BUF20_860026549)

SI (i_strcmp(pt_BUF20_860026549, FA_DHCP_V4_860026549) == 0 ) || (i_strcmp(pt_BUF20_860026549, FA_DHCP_V6_860026549) == 0 )
ALORS
	b_DHCP_860026549 = 1

#DRE G4R8 QC851
	SI (i_strcmp(pt_BUF20_860026549, FA_DHCP_V6_860026549) == 0 )
	ALORS
		b_DHCP_V6_860026549 = 1
	FINSI	
FINSI	




##### variable  RT_ACCESS ##############################
#DRE G4R8 QC851
SI b_DHCP_V6_860026549 == 0
ALORS
	erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::ra,pt_BUF20_860026549)
	#trace2("ra  <%s> ", pt_BUF20, "")
	erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::ca,pt_BUF40_860026549)
	#trace2("ca  <%s> ", pt_BUF40, "")
	erreur_860026549 = i_format_str2(pt_BUF70_860026549 ,"%s%s","WL2TOA",pt_BUF20_860026549)
	erreur_860026549 = i_format_str2(pt_BUF20_860026549 ,"%s%s","S",pt_BUF40_860026549)
	erreur_860026549 = i_format_str2(pt_BUF260_860026549 ,"%s%s",pt_BUF70_860026549,pt_BUF20_860026549)
	#trace2("Appel RT_ACCESS <%s> ",pt_BUF260 ,"")
	i_strcpy(pt_RT_ACCESS_860026549,i_get_tab_field( "WANA", date_pivot_860026549, pt_BUF260_860026549))
	#trace2("pt_RT_ACCESS <%s> ",pt_RT_ACCESS,"")
	
	SI(i_strcmp(pt_RT_ACCESS_860026549,g_inull)==0)
	ALORS
		i_strcpy(pt_RT_ACCESS_860026549,"1")
	SINON
		i_strcpy(pt_RT_ACCESS_860026549,"0")
	FINSI
	#trace2("pt_RT_ACCESS 0=present 1=abs <%s>" , pt_RT_ACCESS, "")
FINSI

#DRE G4R8 QC851
##### variable VAL_OUT_MAC ##############################
#erreur = i_get_art_str(g_iartin, $Tpppwl2::mac, pt_BUF20)
##trace2("mac en ascii <%s> ", pt_BUF20,"")
#
#SI (i_strcmp(pt_BUF20, "0")==0)
#ALORS
#	i_strcpy(pt_VAL_OUT_MAC ,"99")
#SINON
#	SI (i_strcmp(pt_BUF20, "1")==0)
#	ALORS
#		i_strcpy(pt_VAL_OUT_MAC ,"0")
#	SINON
#		SI (i_strcmp(pt_BUF20, "2")==0)
#		ALORS
#			i_strcpy(pt_VAL_OUT_MAC ,"1")
#		SINON
#			SI (i_strcmp(pt_BUF20, "3")==0)
#			ALORS
#				i_strcpy(pt_VAL_OUT_MAC ,"2")
#			SINON
#				i_strcpy(pt_VAL_OUT_MAC ,pt_BUF20)
#			FINSI
#		FINSI
#	FINSI
#FINSI
#trace2("pt_VAL_OUT_MAC pour application facturation <%s>" ,pt_VAL_OUT_MAC, "")

##### variable VAL_OUT_RA ##############################
#erreur = i_get_art_str(g_iartin, $Tpppwl2::ra, pt_BUF20)
#trace2("ra en ascii <%s>", pt_BUF20, "")

#SI (i_strcmp(pt_BUF20, "0")==0)
#ALORS
#	i_strcpy(pt_VAL_OUT_RA ,"10")
#SINON
#	SI (i_strcmp(pt_BUF20, "1")==0)
#	ALORS
#		i_strcpy(pt_VAL_OUT_RA ,"0")
#	SINON
#		SI (i_strcmp(pt_BUF20, "2")==0)
#		ALORS
#			i_strcpy(pt_VAL_OUT_RA ,"1")
#		SINON
#			SI (i_strcmp(pt_BUF20, "4")==0)
#			ALORS
#				i_strcpy(pt_VAL_OUT_RA ,"2")
#			SINON
#				SI (i_strcmp(pt_BUF20, "5")==0)
#				ALORS
#					i_strcpy(pt_VAL_OUT_RA ,"4")
#				SINON
#					SI (i_strcmp(pt_BUF20, "6")==0)
#					ALORS
#						i_strcpy(pt_VAL_OUT_RA ,"9")
#					SINON
#						SI (i_strcmp(pt_BUF20, "9")==0)
#						ALORS
#							i_strcpy(pt_VAL_OUT_RA ,"5")
#						SINON
#							SI (i_strcmp(pt_BUF20, "10")==0)
#							ALORS
#								i_strcpy(pt_VAL_OUT_RA ,"6")
#							SINON
#								i_strcpy(pt_VAL_OUT_RA ,pt_BUF20)
#							FINSI
#						FINSI
#					FINSI
#				FINSI
#			FINSI
#		FINSI
#	FINSI
#FINSI
##trace2("pt_VAL_OUT_RA pour application facturation <%s>", pt_VAL_OUT_RA, "")
#\DRE G4R8 QC851

##### variable USER_IP_ADDR ##############################
# G4R7 Lot3
#erreur = i_get_art_str(g_iartin, $Tpppwl2::useripaddr, pt_IP_ADDR)
#trace2("useripaddr  ascii <%s>" , pt_IP_ADDR,"")
#
#res = i_strlen(pt_IP_ADDR)
#USER_IP_ADDR = i_IpAddrToInt(pt_IP_ADDR ,res )
#trace1("USER_IP_ADDR <%d> ", USER_IP_ADDR)


##### variable NAS_IP_ADDR ##############################
# G4R7 Lot3
#erreur = i_get_art_str(g_iartin, $Tpppwl2::nasipaddr, pt_IP_ADDR)
#trace2("nasipaddr   ascii <%s>", pt_IP_ADDR,"")
#res = i_strlen(pt_IP_ADDR)
#NAS_IP_ADDR = i_IpAddrToInt(pt_IP_ADDR ,res )
#trace1("NAS_IP_ADDR  <%d> ", NAS_IP_ADDR)


##### variable b_disconcause ##############################
erreur_860026549 = i_get_art_str(g_iartin,$Tpppwl2::disconcause,pt_disconcause_860026549)
i_strcpy(pt_BufMajuscul_860026549,UCASE_860026233(pt_disconcause_860026549) )

#G4R7 QC835
SI ( ( i_strcmp(pt_BufMajuscul_860026549,"INTERIM") == 0 ) || ( i_strcmp(pt_BufMajuscul_860026549,"START") == 0 ) )
ALORS
	b_disconcause_860026549 = 1
FINSI




#G4R7 Lot3
##### variable b_fa ##############################
#erreur = i_get_art_str(g_iartin, $Tpppwl2::fa, pt_BUF20)
#
#SI (i_strcmp(pt_BUF20, "4") != 0)
#ALORS
#	b_fa = 1
#FINSI

################################################################################
# Controles
################################################################################

################################################################################
# Critere commun de distribution
################################################################################

#SI ( ( ( i_strcmp ( pt_RT_ACCESS, "1" ) == 0 ) && ( i_strcmp ( pt_RT_TLOG, "1" ) == 0 ) && ( i_strcmp ( pt_RT_RT_TLOG, "1" ) == 0 ) && ( i_strcmp ( pt_RT_REZO, "1" ) == 0 ) ) && ( b_EFFICACE == 1 ) && ( b_disconcause_I == 0 ) && ( b_fa == 1 ) )
SI ( ( ( i_strcmp ( pt_RT_ACCESS_860026549, "1" ) == 0 ) && ( i_strcmp ( pt_RT_TLOG_860026549, "1" ) == 0 ) 
    && ( i_strcmp ( pt_RT_RT_TLOG_860026549, "1" ) == 0 ) && ( i_strcmp ( pt_RT_REZO_860026549, "1" ) == 0 ) ) 
    && ( b_EFFICACE_860026549 == 1 ) && ( b_disconcause_860026549 == 0 ) && ( b_DHCP_860026549 == 0 ) )
ALORS
	b_critcommun_860026549 = 1
SINON
	b_critcommun_860026549 = 0
FINSI
#trace1("__FILE__:__LINE__ #### ======> Valeur de b_critcommun : <%d> #### ", b_critcommun)

################################################################################
# Recherche Instances des ECC sauf celles de facturation
################################################################################

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

instSYMPH_860026549=i_LireInstanceECC(C_InstSYMPH_860026549)
#trace1("instSYMPH=<%d>",instSYMPH)
SI (!instSYMPH_860026549 )
ALORS
	trace("pas d instance SYMPHONIE")
	code_errone_860026549 = 0xA0B0
	code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
	erreur_860026549 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026549,C_InstSYMPH_860026549,C_Article_860026549)
	SAUT DISTRI_ERR
FINSI

#---------------------------------------------------------------------------
##G4R3  SIVM
#---------------------------------------------------------------------------


#---------------------------------------------------------------------------

SI b_critcommun_860026549
ALORS
	#---------------------------------------------------------------------------
	#  NOVAH PPP
	#---------------------------------------------------------------------------

	instNOVAH_860026549 =i_LireInstanceECC(C_instNOVAH_860026549)
	#trace1("instNOVAH=<%d>",instNOVAH)
	SI (!instNOVAH_860026549 )
	ALORS
		trace("pas d instance NOVAH")
		code_errone_860026549 = 0xA0B0
		code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
		erreur_860026549 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026549,C_instNOVAH_860026549,C_Article_860026549)
		SAUT DISTRI_ERR
	FINSI

	SI b_DebutAccount_860026549
	ALORS
		################################################################################
		# Recherche Instances des ECC de facturation CTT1 et CTT2
		################################################################################

		#---------------------------------------------------------------------------
		#  CTT1
		#---------------------------------------------------------------------------

		instCTT1_860026549 =i_LireInstanceECC(C_InstCTT1_860026549)
		#trace1("instCTT1=<%d>",instCTT1)
		SI (!instCTT1_860026549 )
		ALORS
			trace("pas d instance CTT1")
			code_errone_860026549 = 0xA0B0
			code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
			erreur_860026549 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026549,C_InstCTT1_860026549,C_Article_860026549)
			SAUT DISTRI_ERR
		FINSI

		#---------------------------------------------------------------------------
		#  CTT2
		#---------------------------------------------------------------------------

		instCTT2_860026549 =i_LireInstanceECC(C_InstCTT2_860026549)
		#trace1("instCTT1=<%d>",instCTT1)
		SI (!instCTT2_860026549 )
		ALORS
			trace("pas d instance CTT2")
			code_errone_860026549 = 0xA0B0
			code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
			erreur_860026549 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026549,C_InstCTT2_860026549,C_Article_860026549)
			SAUT DISTRI_ERR
		FINSI
	SINON
		SI (lg_IDUS_N_DCB_860026549 > 3 && b_idus_860026549)
		ALORS
			################################################################################
			# Referentiel fixe FEMS; envoi requete TD_Fixe
			################################################################################

			SI (i_EnvoiReqConsTabDist(TD_Fixe, date_pivot_860026549, pt_IDUS_N_DCB_860026549, lg_IDUS_N_DCB_860026549, 0, 1) != 0)
			ALORS
				#trace("Erreur i_EnvoiReqConsTabDist FEMS")
				code_errone_860026549 = 0xA0C0
				code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
				erreur_860026549 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026549,"FEMS",C_Article_860026549)
				SAUT DISTRI_ERR
			FINSI

			################################################################################
			# Recherche Instances des ECC de facturation FEMS
			################################################################################

			#---------------------------------------------------------------------------
			#  FEMS (referentiel)
			#---------------------------------------------------------------------------

			instFEMS_860026549 =i_LireInstanceECC(C_instFEMS_860026549)
			#trace1("instFEMS=<%d>",instFEMS)
			SI (!instFEMS_860026549 )
			ALORS
				trace("pas d instance FEMS")
				code_errone_860026549 = 0xA0B0
				code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
				erreur_860026549 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026549,C_instFEMS_860026549,C_Article_860026549)
				SAUT DISTRI_ERR
			FINSI

			# FEMS PPP n existe plus maintenant c est FEMS

			################################################################################
			# Lecture requete sur Referentiel TD_Fixe
			################################################################################

			erreur_860026549 = i_LireReqConsTabDist()
			SI ( erreur_860026549 != 0 )
			ALORS
				trace1( ">>>__LINE__>>> Erreur i_LireReqConsTabDist FEMS: <%d>", erreur_860026549)
				code_errone_860026549 = 0xA0C0
				code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
				erreur_860026549 = i_PlvMessEmettre(8508,2,g_iartin,"",3,C_Article_860026549,"LireReqConsTabDist",C_instFEMS_860026549)
				SAUT DISTRI_ERR
			FINSI

			res_860026549 = i_LireInfoECC(instFEMS_860026549, i_LireEntierECCv(instFEMS_860026549))
			SI (res_860026549 != 0)
			ALORS
				b_FEMS_860026549 = 1
			SINON
				b_FEMS_860026549 = 0
			FINSI
		FINSI
	FINSI

	################################################################################
	# Critere de distribution CTT1, CTT2, FEMS
	################################################################################

	SI b_DebutAccount_860026549
	ALORS
		SI (i_strcmp(pt_ACC_INST_860026549, "0")==0)
		ALORS
			#trace("accinstance = 0 donc CCT1 sera alimentee")
			erreur_860026549 = i_AjouterCouranteECC(instCTT1_860026549)
			b_CTT1_860026549 = 1
			i_strcpy(pt_ECCFACT_860026549, "CTT1ppp")
		SINON
			SI (i_strcmp(pt_ACC_INST_860026549, "1")==0)
			ALORS
				#trace("accinstance = 1 donc CCT2 sera alimentee")
				erreur_860026549 = i_AjouterCouranteECC(instCTT2_860026549)
				b_CTT2_860026549 = 1
				i_strcpy(pt_ECCFACT_860026549, "CTT2ppp")
			FINSI
		FINSI
	SINON
		SI b_FEMS_860026549
		ALORS
			#trace("b_FEMS vrai donc FEMS sera alimentee")
			erreur_860026549 = i_AjouterCouranteECC(instFEMS_860026549)
			i_strcpy(pt_ECCFACT_860026549, "FEMS")
		FINSI
	FINSI

	################################################################################
	# Critere de distribution NOVAH (poubelle de CT1, CT2, FEMS)
	################################################################################

	SI (!b_CTT1_860026549 && !b_CTT2_860026549 && !b_FEMS_860026549)
	ALORS
		#trace("b_FEMS faux donc NOVAH sera alimentee")
		erreur_860026549 = i_AjouterCouranteECC(instNOVAH_860026549)
		i_strcpy(pt_ECCFACT_860026549, "NOVAH")
	FINSI
FINSI

#---------------------------------------------------------------------------
##G4R3 Ajout de SIVM a la liste
#---------------------------------------------------------------------------


#---------------------------------------------------------------------------
# Ajout de SYMPHONIE a la liste (tous les DC)
#---------------------------------------------------------------------------
# Tous les appels sont pour SYMPHONIE

erreur_860026549 = i_AjouterCouranteECC(instSYMPH_860026549)

################################################################################
# Mises au format
################################################################################

#---------------------------------------------------------------------------
# Mises au format ECC SIVM
#---------------------------------------------------------------------------


#---------------------------------------------------------------------------
# Mises au format ECC SYMPHONIE
#---------------------------------------------------------------------------
SI ( !i_ChercherCouranteECC(instSYMPH_860026549) )
ALORS
	#trace("[Tpppwl2_dis] ppp lot2 duplication vers symphonie")
	# si i_dup_art_id echoue, cad  retour != 0
	SI (i_dup_art_id(g_iartin,g_iartout6))
	ALORS
		#trace("[Tpppwl2_dis]ERREUR envoi distri errone i_dup_art_id g_iartout6")
		erreur_860026549 = i_PlvMessEmettre(8502,2,g_iartin,"",3,"pour Symphonie",C_Article_860026549,g_ieec)
		SAUT DISTRI_ERR
	FINSI
	# si i_rename_art echoue, cad  retour != 0
	SI (i_rename_art(g_iartout6,C_TSymTpppwl2_860026549))
	ALORS
		#trace("[Tpppwl2_dis]ERREUR envoi distri errone i_rename_art g_iartout6 ")
		erreur_860026549 = i_PlvMessEmettre(8502,2,g_iartin,"",3,"pour Symphonie",C_Article_860026549,g_ieec)
		SAUT DISTRI_ERR
	FINSI

	#champ en ajout
	erreur_860026549=  i_ajoutChamp(g_iartout6,"T4sgtqs","SGTQS" ,6)

	# SGTQS
	erreur_860026549 = i_set_art_str(g_iartout6, $TsymTpppwl2::SGTQS, pt_sgtqs_860026549)

	# ECC FACT
	erreur_860026549 = i_set_art_str(g_iartout6, $TsymTpppwl2::ECC_FACT, pt_ECCFACT_860026549)

	# b_EFFICACE
	erreur_860026549 = i_set_art_field(g_iartout6, $TsymTpppwl2::EFFICACITE, b_EFFICACE_860026549)

	# sup des champs non demandes par symphonie
	erreur_860026549 = i_supprChamp(g_iartout6, "T3starttimeS")
	erreur_860026549 = i_supprChamp(g_iartout6, "T3sestimevalH")
	erreur_860026549 = i_supprChamp(g_iartout6, "T3koctestsin")
	erreur_860026549 = i_supprChamp(g_iartout6, "T3koctestsout")
FINSI

#---------------------------------------------------------------------------
# Mises au format ECC CTT1 g_iartout4
#---------------------------------------------------------------------------
SI ( !i_ChercherCouranteECC(instCTT1_860026549) )
ALORS
	#trace("Duplication vers CTT1")
	SI ( i_dup_art_dest(g_iartin,g_iartout4,C_TCttpppwl2_860026549) )
	ALORS
		trace("Erreur de i_dup_art")
		code_errone_860026549 = 0xA0D0
		code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
		erreur_860026549 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026549,C_TCttpppwl2_860026549,C_Article_860026549)
		SAUT  DISTRI_ERR
	FINSI

	#account_poids 80 octest de gauche de l entre
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::accpoid, pt_BUF260_860026549)
	#trace2(" accpoid en entree <%s> ", pt_BUF260, "")
	SI (i_strlen(pt_BUF260_860026549) < 80)
	ALORS
		#trace("  longueur inf 80 donc copie directe")
		erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::accpoid, pt_BUF260_860026549)
	SINON
		#trace("  longueur sup 80 donc couper")
		i_get_sub_str(pt_BUF260_860026549,0,79,pt_BUF260_860026549)
		erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::accpoid, pt_BUF260_860026549)
	FINSI

	#service_poids 100 octest de gauche de l entre
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::servpoid, pt_BUF260_860026549)
	#trace2(" servpoid en entree <%s> ", pt_BUF260, "")
	SI (i_strlen(pt_BUF260_860026549) < 100)
	ALORS
		#trace("  longueur inf 100 donc copie directe")
		erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::servpoid, pt_BUF260_860026549)
	SINON
		#trace("  longueur sup 80 donc couper")
		i_get_sub_str(pt_BUF260_860026549,0,99,pt_BUF260_860026549)
		erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::servpoid, pt_BUF260_860026549)
	FINSI

	#serail  ASCI numerique HEXA non signe par DUP
	#starttime DATE par DUP
	#starttimetz par DUP
	#starttimedst
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::starttimedst, pt_BUF20_860026549)
	erreur_860026549= i_set_art_str(g_iartout4, $TcttTpppwl2::starttimedst, pt_BUF20_860026549)
	#ppplogin par DUP

	#sestimevalue ASCI numerique non signe
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::sestimevalue, pt_BUF260_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::sestimevalue, pt_BUF260_860026549)

	#nastimezeone par DUP

	#nor
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::nor, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::nor, pt_BUF20_860026549)

	#fr
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::fr, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::fr, pt_BUF20_860026549)

	#fa
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::fa, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::fa, pt_BUF20_860026549)

	#mad
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::mad, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::mad, pt_BUF20_860026549)

	#ir
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ir, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::ir, pt_BUF20_860026549)

	#ra
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ra, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::ra, pt_BUF20_860026549)

	#mac
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::mac, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::mac, pt_BUF20_860026549)

	#ca
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ca, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout4, $TcttTpppwl2::ca, pt_BUF20_860026549)

	#koctetsin en ascii
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::koctestsin, pt_BUF40_860026549)
	#trace2("koctetsin en ascii <%s>", pt_BUF40, "")
	erreur_860026549= i_set_art_str(g_iartout4, $TcttTpppwl2::koctetsin, pt_BUF40_860026549)

	#koctetsout en ascii
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::koctestsout, pt_BUF40_860026549)
	#trace2("koctetsout en ascii <%s>", pt_BUF40, "")
	erreur_860026549= i_set_art_str(g_iartout4, $TcttTpppwl2::koctetsout, pt_BUF40_860026549)
FINSI

#---------------------------------------------------------------------------
# Mises au format ECC CTT2 g_iartout3
#---------------------------------------------------------------------------
SI ( !i_ChercherCouranteECC(instCTT2_860026549) )
ALORS
#	#trace("Duplication vers CTT2")
	SI ( i_dup_art_dest(g_iartin,g_iartout3,C_TCttpppwl2_860026549) )
	ALORS
		trace("Erreur de i_dup_art")
		code_errone_860026549 = 0xA0D0
		code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
		erreur_860026549 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026549,C_TCttpppwl2_860026549,C_Article_860026549)
		SAUT  DISTRI_ERR
	FINSI

	#account_poids 80 octest de gauche de l entre
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::accpoid, pt_BUF260_860026549)
	#trace2(" accpoid en entree <%s> ", pt_BUF260, "")
	SI (i_strlen(pt_BUF260_860026549) < 80)
	ALORS
		#trace("  longueur inf 80 donc copie directe")
		erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::accpoid, pt_BUF260_860026549)
	SINON
		#trace("  longueur sup 80 donc couper")
		i_get_sub_str(pt_BUF260_860026549,0,79,pt_BUF260_860026549)
		erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::accpoid, pt_BUF260_860026549)
	FINSI

	#service_poids 100 octest de gauche de l entre
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::servpoid, pt_BUF260_860026549)
	#trace2(" servpoid en entree <%s> ", pt_BUF260, "")
	SI (i_strlen(pt_BUF260_860026549) < 100)
	ALORS
		#trace("  longueur inf 100 donc copie directe")
		erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::servpoid, pt_BUF260_860026549)
	SINON
		#trace("  longueur sup 80 donc couper")
		i_get_sub_str(pt_BUF260_860026549,0,99,pt_BUF260_860026549)
		erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::servpoid, pt_BUF260_860026549)
	FINSI

	#serail  ASCI numerique HEXA non signe par DUP

	#starttime DATE par DUP

	#starttimetz par DUP

	#starttimedst
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::starttimedst, pt_BUF20_860026549)
	erreur_860026549= i_set_art_str(g_iartout3, $TcttTpppwl2::starttimedst, pt_BUF20_860026549)

	#ppplogin par DUP

	#sestimevalue ASCI numerique non signe
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::sestimevalue, pt_BUF260_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::sestimevalue, pt_BUF260_860026549)

	#nastimezeone par DUP

	#nor
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::nor, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::nor, pt_BUF20_860026549)

	#fr
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::fr, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::fr, pt_BUF20_860026549)

	#fa
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::fa, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::fa, pt_BUF20_860026549)

	#mad
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::mad, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::mad, pt_BUF20_860026549)

	#ir
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ir, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::ir, pt_BUF20_860026549)

	#ra
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ra, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::ra, pt_BUF20_860026549)

	#mac
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::mac, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::mac, pt_BUF20_860026549)

	#ca
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::ca, pt_BUF20_860026549)
	erreur_860026549 =  i_set_art_str(g_iartout3, $TcttTpppwl2::ca, pt_BUF20_860026549)

	#koctetsin en ascii
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::koctestsin, pt_BUF40_860026549)
	#trace2("koctetsin en ascii <%s>", pt_BUF40, "")
	erreur_860026549= i_set_art_str(g_iartout3, $TcttTpppwl2::koctetsin, pt_BUF40_860026549)

	#koctetsout en ascii
	erreur_860026549= i_get_art_str(g_iartin,$Tpppwl2::koctestsout, pt_BUF40_860026549)
	#trace2("koctetsout en ascii <%s>", pt_BUF40, "")
	erreur_860026549= i_set_art_str(g_iartout3, $TcttTpppwl2::koctetsout, pt_BUF40_860026549)
FINSI

#---------------------------------------------------------------------------
# Mises au format ECC FEMS (TfemsPPP, g_iartout2)
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instFEMS_860026549) )
ALORS
	#trace("Duplication vers FEMS")
	SI ( i_dup_art_dest(g_iartin,g_iartout2,C_TfemsPPPwl2_860026549) )
	ALORS
		trace("Erreur de i_dup_art")
		code_errone_860026549 = 0xA0D0
		code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
		erreur_860026549 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026549,C_TfemsPPPwl2_860026549,C_Article_860026549)
		SAUT  DISTRI_ERR
	FINSI

	# Type (T)
	#5:32810:$T 			# 0x802A-->T

	#account_poid (AccountPoid)
	erreur_860026549 =  i_set_art_str(g_iartout2, $TfemsPPPwl2::AccountPoid, pt_IDUS_N_860026549)

	#service_poid (ServicePoid)= 100 octets de gauche de l entree sevpoid
	i_strcpy(pt_BUF260_860026549,"")
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::servpoid, pt_BUF260_860026549)
	SI (i_strlen(pt_BUF260_860026549) > 100)
	ALORS
		i_get_sub_str(pt_BUF260_860026549,0,99,pt_BUF260_860026549)
	FINSI
	erreur_860026549 = i_set_art_str(g_iartout2, $TfemsPPPwl2::ServicePoid, pt_BUF260_860026549)

	#serial (serial)
	#1:$serial:$serial		# serial-->serial

	#start_time (DATE)
	#1:$starttimeS:$DATE		# starttimeS-->DATE

	#start_time_tz (StartTimeTz)
	#1:$starttimetz:$StartTimeTz	# starttimetz-->StartTimeTz

	#starttimedst (StartTimeDst)
	#1:$starttimedst:$StartTimeDst	# starttimedst-->StartTimeDst

	#ppplogin (pppLogin)
	#1:$ppplogin:$pppLogin		# ppplogin-->pppLogin

	#sestimevalue (SessTimeValue)
	#1:$sestimevalue:$SessTimeValue	# sestimevalue-->SessTimeValue

	#nastimezone (NasTimezone)
	#1:$nastimezone:$NasTimezone	# nastimezone-->NasTimezone

	#nor
	#1:$nor:$nor			# nor-->nor

	#fr
	#1:$fr:$fr			# fr-->fr

	#fa
	#1:$fa:$fa			# fa-->fa

	#mad
	#1:$mad:$mad			# mad-->mad

	#ir
	#1:$ir:$ir			# ir-->ir

	#ra
	#1:$ra:$ra			# ra-->ra

	#mac
	#1:$mac:$mac			# mac-->mac

	#ca
	#1:$ca:$ca			# ca-->ca

	#koctetsin en ascii
	#1:$koctetsin:$KoctetsIn	# koctetsin-->KoctetsIn

	#koctetsout en ascii
	#1:$koctetsout:$KoctetsOut	# koctetsout-->KoctetsOut
FINSI

#---------------------------------------------------------------------------
# Mises au format ECC NOVAH (TnovahPPPwl2, g_iartout7)
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instNOVAH_860026549) )
ALORS
#	#trace("Duplication vers SIVM")
	SI ( i_dup_art_tab(g_iartin,g_iartout7,C_TnovahPPPwl2_860026549) )
	ALORS
		trace("Erreur de i_dup_art")
		code_errone_860026549 = 0xA0D0
		code_errone_860026549 = code_errone_860026549 + b_EFFICACE_860026549
		erreur_860026549 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026549,C_TnovahPPPwl2_860026549,C_Article_860026549)
		SAUT  DISTRI_ERR
	FINSI

	# Type (type); fait par l'enveloppe c_type ???
	# : NOVAH T3 TYPE en ascii
	erreur_860026549 = i_set_art_str(g_iartout7,$TnovahPPPwl2::type,"2A")

	# num_compte (numCompte)
	i_strcpy(pt_BUF260_860026549,"")
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::accpoid, pt_BUF260_860026549)
	SI (i_strlen(pt_BUF260_860026549) > 9)
	ALORS
		i_get_sub_str(pt_BUF260_860026549,0,8,pt_BUF260_860026549)
	FINSI
	erreur_860026549 = i_set_art_str(g_iartout7,$TnovahPPPwl2::numCompte, pt_BUF260_860026549)

	#service_epid (serviceEpid)= 100 octets de gauche de l entree sevpoid
	i_strcpy(pt_BUF260_860026549,"")
	erreur_860026549 = i_get_art_str(g_iartin, $Tpppwl2::servpoid, pt_BUF260_860026549)
	SI (i_strlen(pt_BUF260_860026549) > 100)
	ALORS
		i_get_sub_str(pt_BUF260_860026549,0,99,pt_BUF260_860026549)
	FINSI
	res_860026549 = i_strlen(pt_BUF260_860026549)
	erreur_860026549 = i_resize_tlv(g_iartout7,"T3serviceEpid", "serviceEpid", res_860026549)
	erreur_860026549 = i_set_art_str(g_iartout7, $TnovahPPPwl2::serviceEpid, pt_BUF260_860026549)

	#serial
	#serial		:-	:-	:1VAL	:	serial

	#starttimeS
	#starttimeS	:-	:-	:1VAL	:	starttimeS

	#starttimetz
	#starttimetz	:-	:-	:1VAL	:	starttimetz

	#starttimedst
	#starttimedst	:-	:-	:1VAL	:	starttimedst

	#ppplogin
	#ppplogin	:-	:-	:1VAL	:	ppplogin

	#sestimevalue
	#sestimevalue	:-	:-	:1VAL	:	sestimevalue

	#nastimezone
	#nastimezone	:-	:-	:1VAL	:	nastimezone


	# ra (ra)
	#ra	:-	:-	:1VAL	:	ra

	#mac (mac)
	#mac	:-	:-	:1VAL	:	mac

	#Les 3 champs ace pour metachamps sans passer par enveloppe
	res_860026549 = i_get_attr_val_n($E_WL2::fin)
	erreur_860026549= i_set_art_field(g_iartout7, $TnovahPPPwl2::dloabs,res_860026549)
	res_860026549 = i_get_attr_val_n($E_WL2::duree)
	erreur_860026549= i_set_art_field(g_iartout7, $TnovahPPPwl2::DUREE,res_860026549)
	res_860026549 = i_get_attr_val_n($E_WL2::pivot)
	erreur_860026549= i_set_art_field(g_iartout7, $TnovahPPPwl2::DATE,res_860026549)
FINSI

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

#---------------------------------------------------------------------------
# SYMPHONIE ENVOIE (g_iartout6)
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instSYMPH_860026549) )
ALORS
	erreur_860026549 = i_stocke_art_iecc(g_iartout6,instSYMPH_860026549)
	trace("Emission PPP vers SYMPHONIE")
FINSI

#---------------------------------------------------------------------------
# SIVM ENVOIE (g_iartout5)
#---------------------------------------------------------------------------


#---------------------------------------------------------------------------
# CTT1 ENVOIE (g_iartout4)
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instCTT1_860026549) )
ALORS
	erreur_860026549 = i_stocke_art_iecc(g_iartout4,instCTT1_860026549)
	trace("Emission PPP vers CTT1")
FINSI

#---------------------------------------------------------------------------
# CTT2 ENVOIE (g_iartout3)
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instCTT2_860026549) )
ALORS
	erreur_860026549 = i_stocke_art_iecc(g_iartout3,instCTT2_860026549)
	trace("Emission PPP vers CTT2")
FINSI

#---------------------------------------------------------------------------
# FEMSppp (TfemsPPPwl2, g_iartout2)
#---------------------------------------------------------------------------

SI (!i_ChercherCouranteECC(instFEMS_860026549) )
ALORS
	#trace(">>>__LINE__>>> emission vers FEMS")
	res_860026549 = i_stocke_art_iecc( g_iartout2, instFEMS_860026549 )
FINSI

#---------------------------------------------------------------------------
# NOVAH (Tnovah, g_iartout7)
#---------------------------------------------------------------------------

SI (!i_ChercherCouranteECC(instNOVAH_860026549) )
ALORS
	#trace(">>>__LINE__>>> emission vers NOVAH")
	res_860026549 = i_stocke_art_iecc( g_iartout7, instNOVAH_860026549 )
FINSI

SAUT DISTRI_FIN

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

POINT DISTRI_ERR

trace("Stockage de l'article en ERRONE")
erreur_860026549 = i_make_art_rej(g_iartin, g_iartout, code_errone_860026549)
erreur_860026549 = i_stocke_art(g_iartout,0,PT_ERRONE,0)

SAUT DISTRI_FIN

POINT DISTRI_FIN

RETOUR TRAIT_OK

#------------------------------ Tpppwl2B_dis.src -------------------------------
