DEFINITION NUMTAB_GMT_860026299 1
DEFINITION NUMTAB_860026299 2
DEFINITION NUMTABSEL_860026299 0
DEFINITION ZONE_860026299 7
DEFINITION BASE_12_860026299 1
DEFINITION CODE_12_860026299 1
DEFINITION CATEG_12_860026299 8
DEFINITION IDUS_12_860026299 "**00"
DEFINITION RES_TYPCOM_860026299 0
DEFINITION RES_CLDEST_860026299 1
DEFINITION C_Article_860026299 "Trtmcp"
DEFINITION C_InstSYMP_860026299 "SYMP"
DEFINITION C_InstTRAFIC_860026299 "TRAFIC"
DEFINITION C_InstFERPV_860026299 "FERPV"
DEFINITION C_InstFE_860026299 "FE"
DEFINITION C_Inst42L_860026299 "42L"
DEFINITION C_InstCENTDEA_860026299 "CENTAUREDEA"
DEFINITION C_Ttrafic_860026299 "TtraficN"
DEFINITION C_TcentaureDEA_860026299 "TcentaureDEA"
DEFINITION C_Tfe_860026299 "Tfe"
DEFINITION C_Tfe_rpv_860026299 "Tfe_rpv"
DEFINITION C_Tdelta_minute_860026299 "Tdelta_minute"
DEFINITION C_Message1_860026299 "Indicatif inconnu dans la table DISTRI 42L"
REGISTRE ENTIER DATE_GMT_860026299
REGISTRE ENTIER DATE_LOCALE_860026299
REGISTRE ENTIER L_NDR_860026299
REGISTRE ENTIER ddebut_860026299
REGISTRE ENTIER instECCv_860026299
REGISTRE ENTIER MER_860026299
REGISTRE ENTIER FACTURABLE_860026299
REGISTRE ENTIER CAX_860026299
REGISTRE ENTIER ICAR_S_860026299
REGISTRE ENTIER ICAR_REF_860026299
REGISTRE ENTIER ICAR_P_860026299
REGISTRE ENTIER NB_CSV_860026299
REGISTRE ENTIER EPORTABILITE_860026299
REGISTRE ENTIER SPORTABILITE_860026299
REGISTRE ENTIER code_errone_860026299
REGISTRE ENTIER EFFICACE_860026299
REGISTRE ENTIER EPORTABILITE_SCP_860026299
REGISTRE ENTIER SPORTABILITE_SCP_860026299
REGISTRE ENTIER IDUS_NDIP_860026299
REGISTRE ENTIER erreur_860026299
REGISTRE ENTIER info_860026299
REGISTRE ENTIER res_860026299
REGISTRE ENTIER lg_ND_RTC_860026299
REGISTRE ENTIER numzone_860026299
REGISTRE ENTIER instSYMP_860026299
REGISTRE ENTIER instDM_860026299
REGISTRE ENTIER instFE_860026299
REGISTRE ENTIER instFERPV_860026299
REGISTRE ENTIER instTRAFIC_860026299
REGISTRE ENTIER instCENTAUREDEA_860026299
REGISTRE ENTIER inst42L_860026299
REGISTRE ENTIER TYP_COM_860026299
REGISTRE ENTIER TYPCOM_fct_860026299
REGISTRE ENTIER b_arretfct_centaure_860026299
REGISTRE ENTIER CCD_860026299
REGISTRE ENTIER CCD_REEL_860026299
REGISTRE ENTIER CCD_REEL_FE_860026299
REGISTRE ENTIER bFE_860026299
REGISTRE ENTIER bFERPV_860026299
REGISTRE ENTIER bTRAFIC_860026299
REGISTRE ENTIER bCENTDEA_860026299
REGISTRE ENTIER trait_ok_860026299
REGISTRE ENTIER code_CFR_860026299
REGISTRE ENTIER trai_dduree_860026299
REGISTRE ENTIER dizaine_860026299
REGISTRE ENTIER unite_860026299
REGISTRE ENTIER cfr_860026299
REGISTRE ENTIER ENVELOPPE_NOK_860026299
REGISTRE ENTIER bREDIST_860026299
REGISTRE ENTIER lg_dede_860026299
REGISTRE ENTIER taxe_860026299
REGISTRE ENTIER DEDE_INF_860026299
REGISTRE POINTEUR pt_IDUS_N_860026299
REGISTRE POINTEUR pt_C_CSV1_860026299
REGISTRE POINTEUR pt_DEDE_DIST_N_860026299
REGISTRE POINTEUR pt_OP_CSV1_860026299
REGISTRE POINTEUR pt_DECO_NUM_860026299
REGISTRE POINTEUR pt_adr_NDRTC_860026299
REGISTRE POINTEUR pt_buffer_860026299
REGISTRE POINTEUR pt_buffer2_860026299
REGISTRE POINTEUR pt_temp_860026299
REGISTRE POINTEUR pt_temp2_860026299
REGISTRE POINTEUR pt_SGTQS_860026299
REGISTRE POINTEUR pt_NomEccFact_860026299
REGISTRE POINTEUR pt_InfoCompl_860026299
REGISTRE POINTEUR pt_inst_860026299
REGISTRE POINTEUR pt_CodeOp_860026299
REGISTRE POINTEUR pt_CodeOp_SCP_860026299
REGISTRE POINTEUR pt_Cle_csv_860026299
REGISTRE POINTEUR pt_service_860026299
REGISTRE POINTEUR pt_NDRTC_860026299
REGISTRE POINTEUR pt_LIBELREDIST_860026299
REGISTRE POINTEUR pt_NIDAV_860026299
# ---------------------------------------------------------------------------
#
# FICHIER     : Trtmcp.src
#
# DESCRIPTION : Pcode de distribution pour Trtmcp
#
# EN ENTREE :
#    Article : Trtmcp
#
# EN SORTIE:
#    TRAFIC
#    FE, FERPV
#    Delta Minute
#    Allofact
#    CENTDEA
#    Symphonie
#
# 03/06/2008 - RHE G3R8 Creation
# 01/02/2010 - DRE - G3R16 Menage e-bill (Allofact)
# 12/10/2010 - PKH - G3R18Cy ajout de INFDDE dans fe_rpv et normalisation du NDE
# 3/11/2010 - PKH - G3R18Cy - QC428 - Correction format de INFDDE pour fe_rpv
# 12/11/2010 - PKH - G3R19 - QC429 report correction sur la valorisation du CCD_REEL suppression du 0x19 si SPORTABILITE_SCP<>1
# 07/02/2011 - DRE - G3R20 G3R19Cy Suite suppression MESVISIO : Remplacement de l'alarme 7691 (MESVISIO)
#								par l'alarme 8613 (DISTRIBUTION)
# 10/10/2011 - THE - VerifPcode
#
############################################################################
# Declarations
############################################################################
# Constantes

# variables entieres


# Initialisations
TYP_COM_860026299 = 0
TYPCOM_fct_860026299 = 0
b_arretfct_centaure_860026299 = 0
bFE_860026299 = 0
bFERPV_860026299 = 0
bTRAFIC_860026299  = 0
bCENTDEA_860026299 = 0
CCD_860026299 = 0
CCD_REEL_860026299 = 0
CCD_REEL_FE_860026299 = 0
bREDIST_860026299 = 0
lg_dede_860026299 = 0
code_CFR_860026299 = 0
EFFICACE_860026299 = 0
ENVELOPPE_NOK_860026299 = -1
ICAR_REF_860026299 = 0
taxe_860026299 = 0
instSYMP_860026299 = 0
instDM_860026299 = 0
instFE_860026299 = 0
instFERPV_860026299 = 0
instTRAFIC_860026299 = 0
inst42L_860026299 = 0
EPORTABILITE_860026299 = 0
SPORTABILITE_860026299 = 0
EPORTABILITE_SCP_860026299 = 0
SPORTABILITE_SCP_860026299 = 0
IDUS_NDIP_860026299 = 0
DEDE_INF_860026299 = 0


# variables pointeurs


###########################################
# Allocation de memoire
pt_SGTQS_860026299	 = "07774567890112345"
pt_buffer_860026299	 = "1234567890123456012345"
pt_buffer2_860026299	 = "333333337890123456012345"
pt_temp_860026299		 = "0123456789012345"
pt_temp2_860026299	 = "4242420123456789012345"
pt_NomEccFact_860026299	 = "2222222222"
pt_InfoCompl_860026299	 = "12312345"
pt_inst_860026299		 = "555555555512345"
pt_C_CSV1_860026299		 = "988912345"
pt_OP_CSV1_860026299		 = "0012345"
pt_Cle_csv_860026299	 = "444444444412345"
pt_DECO_NUM_860026299	 = "3333333333333333333312345"
pt_LIBELREDIST_860026299	 = "78901234567890123456789012345612345"
pt_DEDE_DIST_N_860026299	 = "2222222222222222222212345"
pt_CodeOp_860026299	 = "444444444444"
pt_CodeOp_SCP_860026299	 = "37373737373737"
pt_NDRTC_860026299	 = "741741741741741741"
pt_adr_NDRTC_860026299	 = "151515151515151515151515151515151515151515151515151515"
pt_service_860026299	 = "6543"
pt_IDUS_N_860026299	 = "1111111111111111111112345"
pt_NIDAV_860026299	 = "pt_NIDAV0123456789012345678901234"


# Initialisations
i_strcpy(pt_NDRTC_860026299,"")
i_strcpy(pt_SGTQS_860026299,"")
i_strcpy(pt_OP_CSV1_860026299," ")
i_strcpy(pt_C_CSV1_860026299," ")
i_strcpy(pt_IDUS_N_860026299,"")
i_strcpy(pt_DEDE_DIST_N_860026299,"")
i_strcpy(pt_DECO_NUM_860026299,"")
i_strcpy(pt_adr_NDRTC_860026299,"")
i_strcpy(pt_buffer_860026299,"")
i_strcpy(pt_buffer2_860026299,"")
i_strcpy(pt_temp_860026299,"")
i_strcpy(pt_temp2_860026299,"")
i_strcpy(pt_InfoCompl_860026299,"")
i_strcpy(pt_inst_860026299,"")
i_strcpy(pt_CodeOp_860026299,"")
i_strcpy(pt_CodeOp_SCP_860026299,"")
i_strcpy(pt_Cle_csv_860026299,"")
i_strcpy(pt_service_860026299,"")
i_strcpy(pt_LIBELREDIST_860026299,"")
i_strcpy(pt_NIDAV_860026299,"")
i_strcpy(pt_LIBELREDIST_860026299,"")


trace( "__FILE__:__LINE__ : *** Debut du pcode de distribution ***" )

############################################################################
# Variables Fonctionnelles Globales
############################################################################
ddebut_860026299 = i_get_art_field(g_iartin,$ddebut)

SI (ddebut_860026299 == -1)
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "i_get_art_field/ddebut" )
	SAUT DISTRI_ERR
FINSI

# Calcul de la date locale
numzone_860026299 = i_DHgetZoneID(NUMTABSEL_860026299, g_iartin)
DATE_LOCALE_860026299 = i_DHgetLocalTime(NUMTAB_860026299, numzone_860026299, ddebut_860026299)

SI( DATE_LOCALE_860026299 == 0 )
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "i_DHgetLocalTime/DATE LOCALE" )
	SAUT DISTRI_ERR
FINSI

# Recuperation de dduree de fin de traitement
trai_dduree_860026299 = i_get_art_field( g_iartin, $Trtmcp::dduree )

# Calcul de la date GMT
DATE_GMT_860026299 = i_DHgetCe2gTime(NUMTAB_GMT_860026299,ZONE_860026299,ddebut_860026299)

SI( DATE_GMT_860026299 == 0 )
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "i_DHgetCe2gTime/DATE GMT" )
	SAUT DISTRI_ERR
FINSI

############################################################################
# identification de la provenance de l article
############################################################################
trait_ok_860026299=-1
# trait_ok: nb de passage en redistribution
trait_ok_860026299 = i_LireRedistCpt()
# ICI G2R0CA

SI ( trait_ok_860026299 > 0 )
ALORS
	ENVELOPPE_NOK_860026299 = 0
FINSI

SI ( trait_ok_860026299 == 0)
ALORS
	# Creation de l'enveloppe optionnelle
	#---------------------
	# AJOUT ENVELOPPE Optionelle:
	# Contient le code SGTQS necessaire au message d'erreur de la redistribution
	#---------------------
	# Creation de l'enveloppe
	SI (ENVELOPPE_NOK_860026299)
	ALORS
		ENVELOPPE_NOK_860026299 = i_add_opt("E_Trtmcp")
	FINSI
	#---------------------
	#  Mise a jour de l'ENVELOPPE Optionelle:
	# Contient le nom de l'EEC necessaire au message d'erreur de la redistribution
	# Champ TRAI_DDUREE
	erreur_860026299 = i_set_attr_val_n( $E_Trtmcp::TRAI_DDUREE, trai_dduree_860026299)
	# Nom_EEC
	i_strcpy(pt_SGTQS_860026299,i_LireEECSGTQS(g_ieec))
	res_860026299 = i_set_attr_str_n( $E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
FINSI

#---------------------------------------------------------------------------
# IDUS_N
#---------------------------------------------------------------------------
#Suppression du quartet de bourrage (celui de droite). Valeur: 0x0F

erreur_860026299 = i_get_art_str(g_iartin, $Trtmcp::IDUS_NUM, pt_IDUS_N_860026299)

############################################################################
# Variables Fonctionnelles du Module
############################################################################

#---------------------------------------------------------------------------
# Variable fonctionnelle MER
#---------------------------------------------------------------------------
info_860026299 = i_get_art_field( g_iartin, $Trtmcp::TAP12 )
info_860026299 = info_860026299 & 0x70

SI ((info_860026299 == 0x10))
ALORS
	MER_860026299=1
SINON
	MER_860026299=0
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle DECO_NUM
#---------------------------------------------------------------------------

SI ( MER_860026299 )
ALORS
	SI ( i_valid_field_n( g_iartin, $DECO ) )
	ALORS
		erreur_860026299 = i_get_art_str( g_iartin, $DECO_NUM, pt_DECO_NUM_860026299 )
	SINON
		erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_DECO_NUM_860026299)
	FINSI
SINON
	erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_DECO_NUM_860026299)
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle CCD (Code Classe de Destination)
#---------------------------------------------------------------------------
erreur_860026299 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, IDUS_12_860026299, 5)

SI (MER_860026299)
ALORS
	SI ( (i_get_art_field( g_iartin, $Trtmcp::DECO_INF)) & 0xC0) == 0xC0
	ALORS
		erreur_860026299 = i_format_str2( pt_buffer_860026299, "%s%s", "00", pt_DECO_NUM_860026299)
	SINON
		SI ( (i_get_art_field(g_iartin, $Trtmcp::DECO_INF)) & 0xC0) == 0x80
		ALORS
			erreur_860026299 = i_format_str2( pt_buffer_860026299, "%s%s", "0", pt_DECO_NUM_860026299)
		SINON
			erreur_860026299 = i_format_str2( pt_buffer_860026299, "%s%s", "", pt_DECO_NUM_860026299)
		FINSI
	FINSI
	lg_dede_860026299 = i_strlen(pt_buffer_860026299)
	erreur_860026299 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_buffer_860026299, lg_dede_860026299+1)
SINON
	erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_buffer_860026299)
	lg_dede_860026299 = i_strlen(pt_buffer_860026299)
	erreur_860026299 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_buffer_860026299, lg_dede_860026299+1)
FINSI

g_icopo.TAXE   = 0
g_icopo.CREDIT = 0
erreur_860026299 = i_set_art_date( g_icopo,i_get_art_field(g_iartin, $Trtmcp::ddebut ))
g_icopo.DUREE  = trai_dduree_860026299
g_icopo.CODE   = CODE_12_860026299
g_icopo.CATEG  = CATEG_12_860026299
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[RES_CLDEST_860026299] = 0xff

erreur_860026299 = i_comptage( g_icopo, BASE_12_860026299, i_get_art_field(g_iartin, $Trtmcp::ddebut  ))

SI ( erreur_860026299 == 0 )
ALORS
	CCD_860026299 = g_icopo.SUP[RES_CLDEST_860026299]
	TYP_COM_860026299 = g_icopo.SUP[RES_TYPCOM_860026299]
FINSI

#-------------------------------------------
# Variable fonctionnel DEDE_INF
#------------------------------------------

SI (MER_860026299)
ALORS
	SI (i_valid_field_n(g_iartin,$Trtmcp::DECO))
	ALORS
		DEDE_INF_860026299 = i_get_art_field( g_iartin, $DECO_INF )
	SINON
		DEDE_INF_860026299 = 0
	FINSI
SINON
	DEDE_INF_860026299 = 0
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle TYPCOM_FCT
#---------------------------------------------------------------------------

SI ( TYP_COM_860026299 == 83 || TYP_COM_860026299 == 98 )
ALORS
	TYPCOM_fct_860026299 = 1
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle ICAR_REF
#---------------------------------------------------------------------------

SI ( MER_860026299 )
ALORS
	SI (i_valid_field_n(g_iartin,$Trtmcp::T3traa))
	ALORS
		ICAR_REF_860026299= i_DHgetCe2gTime(NUMTAB_GMT_860026299,ZONE_860026299, i_get_art_field(g_iartin,$HDEB))
	SINON
		ICAR_REF_860026299 = i_DHgetCe2gTime(NUMTAB_GMT_860026299,ZONE_860026299, i_get_art_field(g_iartin,$DATE))
	FINSI
SINON
	ICAR_REF_860026299 = i_DHgetCe2gTime(NUMTAB_GMT_860026299,ZONE_860026299, i_get_art_field(g_iartin,$DATE))
FINSI

SI( ICAR_REF_860026299 == 0 )
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "ICAR_REF" )
	SAUT DISTRI_ERR
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle EPORTABILITE et SPORTABILITE
#---------------------------------------------------------------------------
pt_CodeOp_860026299 = CodeOperateurTable6_860026233(DATE_GMT_860026299,pt_DECO_NUM_860026299,"45S")

SI (MER_860026299)
ALORS
	SI (!i_strcmp(pt_CodeOp_860026299, "84208"))
	ALORS
		EPORTABILITE_860026299=1
	SINON
		SI ( pt_CodeOp_860026299 != g_inull )
		ALORS
			SPORTABILITE_860026299 = 1
		FINSI
	FINSI
FINSI
#trace1("PORTABILITE ENTRANTE=<%d>", EPORTABILITE)
#trace1("PORTABILITE SORTANTE=<%d>", SPORTABILITE)

#--------------------------------------------------------------------------------
#Variable fonctionnelle EPORTABILITE_SCP et SPORTABILITE_SCP
#--------------------------------------------------------------------------------
pt_CodeOp_SCP_860026299 = CodeOperateurTable6_860026233(DATE_GMT_860026299,pt_DECO_NUM_860026299,"ACLA")

SI (MER_860026299)
ALORS
	SI (!i_strcmp(pt_CodeOp_SCP_860026299, "84008"))
	ALORS
		EPORTABILITE_SCP_860026299=1
	SINON
		EPORTABILITE_SCP_860026299=0

		SI (pt_CodeOp_SCP_860026299 != g_inull)

		ALORS
			SPORTABILITE_SCP_860026299 = 1
		SINON
			SPORTABILITE_SCP_860026299 = 0
		FINSI
	FINSI
FINSI
#trace1("PORTABILITE ENTRANTE_SCP=<%d>", EPORTABILITE_SCP)
#trace1("PORTABILITE SORTANTE_SCP=<%d>", SPORTABILITE_SCP)

#---------------------------------------------------------------------------
# Variable fonctionnelle CCD_REEL
#---------------------------------------------------------------------------
# report correction sur la valorisation du CCD_REEL suppression du 0x19 si SPORTABILITE_SCP<>1

SI (EPORTABILITE_860026299)
ALORS
	CCD_REEL_860026299 = 212
SINON
	SI (EPORTABILITE_SCP_860026299)
	ALORS
		CCD_REEL_860026299 = 218
	SINON
		SI (SPORTABILITE_860026299)
		ALORS
			CCD_REEL_860026299 = 213
		SINON
			SI (SPORTABILITE_SCP_860026299)
			ALORS
				CCD_REEL_860026299 = 219
			SINON
				SI (CCD_860026299 == 0x18)
				ALORS
					CCD_REEL_860026299=CCD_860026299
				SINON
					CCD_REEL_860026299 = 20
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle arretfct_centaure
#---------------------------------------------------------------------------

SI ((TYPCOM_fct_860026299 && CCD_860026299 == 24 ) || (CCD_REEL_860026299 == 213))
ALORS
	b_arretfct_centaure_860026299 = 1
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle ICAR_P
#---------------------------------------------------------------------------

SI ( MER_860026299 && ( SPORTABILITE_860026299 ||( CCD_860026299 == 0x18 && !EPORTABILITE_860026299)) )
ALORS
	SI (i_valid_field_n(g_iartin,$Trtmcp::T3traa))
	ALORS
		ICAR_P_860026299 = i_DHgetLocalTime(NUMTAB_860026299, numzone_860026299, i_get_art_field(g_iartin,$HDEB))
	SINON
		ICAR_P_860026299 = i_DHgetLocalTime(NUMTAB_860026299, numzone_860026299, i_get_art_field(g_iartin,$DATE))
	FINSI
SINON
	ICAR_P_860026299 = i_DHgetLocalTime(NUMTAB_860026299, numzone_860026299, i_get_art_field(g_iartin,$DATE))
FINSI

SI( ICAR_P_860026299 == 0 )
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "i_DHgetLocalTime/ICAR_P" )
	SAUT DISTRI_ERR
FINSI

#---------------------------------------------------------------------------
# Variable fonctionnelle FACTURABLE
#---------------------------------------------------------------------------
FACTURABLE_860026299 = 1
EFFICACE_860026299 = 1

#---------------------------------------------------------------------------
# Variable fonctionnelle CAX
#---------------------------------------------------------------------------

SI (i_get_art_field( g_iartin, $Trtmcp::CDEUR) == 0x0f)
ALORS
	CAX_860026299 = 2
SINON
	SI ((i_get_art_field(g_iartin, $Trtmcp::IDUS_INF) & 0x0c) == 0x00)
	ALORS
		CAX_860026299 = 3
	SINON
		CAX_860026299 = 1
	FINSI
FINSI
# trace1( "__FILE__:__LINE__ : Variable fonctionnelle, CAX=%d", CAX )

# ----------------------------------------------------
#  Variable fonctionnelle ICAR_S
# ----------------------------------------------------

SI ( MER_860026299 && !SPORTABILITE_860026299 && ( CCD_860026299 != 0x18 || EPORTABILITE_860026299) )
ALORS
	SI ( i_valid_field_n( g_iartin, $T3traa ) )
	ALORS
		ICAR_S_860026299 = i_DHgetLocalTime(NUMTAB_860026299, numzone_860026299, i_get_art_field(g_iartin,$HDEB))

		SI ( ICAR_S_860026299 == 0 )
		ALORS
			code_errone_860026299 = 0xA080
			code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
			erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "i_DHgetLocalTime/HDEB" )
			SAUT DISTRI_ERR
		FINSI
	SINON
		ICAR_S_860026299 = DATE_LOCALE_860026299
	FINSI
SINON
	ICAR_S_860026299 = DATE_LOCALE_860026299
FINSI

SI( ICAR_S_860026299 == 0 )
ALORS
	code_errone_860026299 = 0xA080
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026299, C_Article_860026299, "ICAR_S" )
	SAUT DISTRI_ERR
FINSI

# ----------------------------------------------------
# Variable fonctionnelle NB_CSV
# ----------------------------------------------------
# bits  ( A B C D E F G H ) = ( 0 1 1 1 0 0 0 0 ) = 0x70
info_860026299 = i_get_art_field( g_iartin, $Trtmcp::TAP12) & 0x70
#trace1("TAP12_BCD: %d",info)

SI ( (info_860026299 == 0x10) || (info_860026299 == 0x00)|| (info_860026299 == 0x50) )
ALORS
	NB_CSV_860026299 = 1
SINON
	NB_CSV_860026299 = 0
FINSI

# ----------------------------------------------------
# Variable fonctionnelle C_CSV1 et OP_CSV1
# ----------------------------------------------------
erreur_860026299 = i_get_art_str( g_iartin, $Trtmcp::CODESERV, pt_temp_860026299 )

SI ( (info_860026299 == 0x10) )
ALORS
	i_strcpy(pt_C_CSV1_860026299, C_CSV_860026233 ( "12m", pt_temp_860026299, i_get_art_field( g_iartin, $Trtmcp::dpivot ) ) )
	i_strcpy(pt_OP_CSV1_860026299, OP_CSV_860026233( "12m", pt_temp_860026299, i_get_art_field( g_iartin, $Trtmcp::dpivot ) ) )
	erreur_860026299 = i_format_str2(pt_Cle_csv_860026299,"%s%s","12m",pt_temp_860026299)
SINON
	SI ( (info_860026299 == 0x50) || (info_860026299 == 0x00) )
	ALORS
		i_strcpy(pt_C_CSV1_860026299, C_CSV_860026233 ( "12", pt_temp_860026299, i_get_art_field( g_iartin, $Trtmcp::dpivot ) ) )
		i_strcpy(pt_OP_CSV1_860026299, OP_CSV_860026233( "12", pt_temp_860026299, i_get_art_field( g_iartin, $Trtmcp::dpivot ) ) )
		erreur_860026299 = i_format_str2(pt_Cle_csv_860026299,"%s%s","12",pt_temp_860026299)
	FINSI
FINSI
#trace2( "C_CSV1 : <%s>", pt_C_CSV1,  "" )
#trace2( "OP_CSV1: <%s>", pt_OP_CSV1, "" )
#trace1( "TAP12_BCD apres comparaison: <%d>", info )

############################################################################
# Envoi requetes Table de Distribution
############################################################################
L_NDR_860026299 = i_get_art_fieldlength(g_iartin,$IDUS_NUM)

SI ( L_NDR_860026299 % 2 == 0 )
ALORS
	L_NDR_860026299 = L_NDR_860026299 / 2
SINON
	L_NDR_860026299 = L_NDR_860026299 / 2 + 1
FINSI

# IDUS_NDIP
SI ( ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,0) == 8 ) && ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,1) == 7 )
  && ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,2) == 3 ) && ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,3) == 2 ) )
|| ( ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,0) == 8 ) && ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,1) == 7 )
  && ( i_get_art_fieldtab(g_iartin,$IDUS_NUM,2) == 6 ) )
ALORS
	IDUS_NDIP_860026299=1
SINON
	erreur_860026299=i_get_art_str(g_iartin,$Trtmcp::IDUS_NUM,pt_NDRTC_860026299)
	trace2("------------IDUS n est pas un numero IP : <%s>--------------",pt_NDRTC_860026299,"")
FINSI

#trace1("------IDUS_NDIP=<%d>----", IDUS_NDIP)

SI (IDUS_NDIP_860026299==1)
ALORS
	#------------------------------------------------------------
	#RECHERCHE instance 42L
	#-------------------------------------------------------------
	inst42L_860026299 = i_LireInstanceECC(C_Inst42L_860026299)

	SI (!inst42L_860026299)
	ALORS
		#trace("Pas d'instance pour 42L !")
		erreur_860026299 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"42L",C_Article_860026299,g_ieec)
		SAUT DISTRI_ERR
	FINSI

	#trace1("----------------inst42L=<%d>---------------",inst42L)

	#---------------------------------------------------
	#Envoi requetes vers la table 42L
	#---------------------------------------------------
	SI (i_EnvoiReqConsTabDist( TD_42L,DATE_GMT_860026299,i_get_art_fieldptr(g_iartin,$IDUS_NUM),L_NDR_860026299,0,1) != 0)
	ALORS
		#    	trace("Erreur i_EnvoiReqConsTabDist")
		SAUT DISTRI_ERR
	FINSI

	erreur_860026299 = i_LireReqConsTabDist()
	#trace1("RETOUR i_LireReqConsTabDist, erreur=<%d>",erreur)

	SI ( erreur_860026299 != 0 )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist: <%d>", erreur)
		SAUT DISTRI_ERR
	FINSI

	#-------------------------------------------------------------------------------------
	# LECTURE du CHAMP EECV SOUS FORME D'ENTIER POUR RECUPERER L'INFO COMPLEMENTAIRE NDRTC
	#-------------------------------------------------------------------------------------
	instECCv_860026299 = i_LireEntierECCv( inst42L_860026299 )
	res_860026299 = i_LireInfoECC( inst42L_860026299, instECCv_860026299 )

	SI (res_860026299 != 0)
	ALORS
		erreur_860026299=i_LireImsiInfo (res_860026299,0,5,pt_NDRTC_860026299)
		#trace2("------------resultat de pt_NDRTC retoune par i_LireImsiInfo : <%s>",pt_NDRTC,"")
	SINON
		i_strcpy(pt_NDRTC_860026299," ")
		#trace("Envoi en redistribution absent dans 42L")
		erreur_860026299 = i_PlvMessEmettre(8613,2,g_iartin,"",3,C_Article_860026299,pt_IDUS_N_860026299,"42L")
		i_strcpy(pt_LIBELREDIST_860026299, C_Message1_860026299)
		bREDIST_860026299 = 1

		SI (trait_ok_860026299 != 2)
		ALORS
			SAUT AVANT_REDIST
		FINSI
	FINSI
FINSI

# ----------------------------------------------------
# Variable fonctionnelle DEDE_DIST_N
# ----------------------------------------------------
# La normalisation est effectuee par i_get_art_str

SI ( MER_860026299 )
ALORS
	SI (SPORTABILITE_860026299 || ((CCD_860026299==0x18) && (!EPORTABILITE_860026299)))
	ALORS
		erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_DEDE_DIST_N_860026299 )
	SINON
		SI ( i_valid_field_n( g_iartin, $DECO ) )
		ALORS
			erreur_860026299 = i_get_art_str( g_iartin, $DECO_NUM, pt_DEDE_DIST_N_860026299 )
		SINON
			erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_DEDE_DIST_N_860026299 )
		FINSI
	FINSI
SINON
	erreur_860026299 = i_get_art_str( g_iartin, $RECO, pt_DEDE_DIST_N_860026299 )
FINSI

##################################################################################################

lg_ND_RTC_860026299 = i_conv_ascii_dcb( pt_NDRTC_860026299, pt_adr_NDRTC_860026299 )
erreur_860026299 = i_EnvoiReqConsTabDistDouble( TD_Fixe, TD_Inter, DATE_GMT_860026299,pt_adr_NDRTC_860026299,lg_ND_RTC_860026299,lg_ND_RTC_860026299, 1, 0, 1)

SI ( erreur_860026299 !=0 )
ALORS
	#	trace1("Erreur i_EnvoiReqConsTabDistDouble %d",erreur)
	res_860026299 = i_get_attr_str_n($E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
	erreur_860026299 = i_PlvMessEmettre(8503,2,g_iartin,"Erreur i_EnvoiReqConsTabDistDouble",3,"","Trtmcp",pt_SGTQS_860026299)
	bREDIST_860026299 = 1
FINSI

############################################################################
# Recherche Instances des ECC
############################################################################

#---------------------------------------------------------------------------
# Symphonie
#---------------------------------------------------------------------------
instSYMP_860026299=i_LireInstanceECC(C_InstSYMP_860026299)

SI (!instSYMP_860026299)
ALORS
	code_errone_860026299 = 0xA0B0
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,C_InstSYMP_860026299,C_Article_860026299)
	SAUT DISTRI_ERR
FINSI

SI (!bREDIST_860026299)
ALORS

	#---------------------------------------------------------------------------
	# Trafic
	#---------------------------------------------------------------------------
	instTRAFIC_860026299 = i_LireInstanceECC( C_InstTRAFIC_860026299 )

	SI ( !instTRAFIC_860026299 )
	ALORS
		code_errone_860026299 = 0xA0B0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,C_InstTRAFIC_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	#---------------------------------------------------------------------------
	# DELTA MINUTE
	#---------------------------------------------------------------------------
	instDM_860026299 = instTRAFIC_860026299

	#---------------------------------------------------------------------------
	# FERPV
	#---------------------------------------------------------------------------
	instFERPV_860026299 = i_LireInstanceECC(C_InstFERPV_860026299)

	SI (!instFERPV_860026299)
	ALORS
		code_errone_860026299 = 0xA0B0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,C_InstFERPV_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	#---------------------------------------------------------------------------
	# FE
	#---------------------------------------------------------------------------
	instFE_860026299 = i_LireInstanceECC(C_InstFE_860026299)

	SI (!instFE_860026299)
	ALORS
		code_errone_860026299 = 0xA0B0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,C_InstFE_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	# suppression ECC ALLOFACT

	#---------------------------------------------------------------------------
	# CENTAUREDEA
	#---------------------------------------------------------------------------
	instCENTAUREDEA_860026299 = i_LireInstanceECC(C_InstCENTDEA_860026299)

	SI (!instCENTAUREDEA_860026299)
	ALORS
		code_errone_860026299 = 0xA0B0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026299, C_InstCENTDEA_860026299, C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI
FINSI

############################################################################
# Duplication Symphonie
############################################################################
erreur_860026299=i_AjouterCouranteECC(instSYMP_860026299)
trace("Stockage vers SYMPHONIE")

SI (i_dup_art_id(g_iartin,g_iartout))
ALORS
	code_errone_860026299 = 0xA0D0
	code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
	erreur_860026299 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026299,"pour SYMP",C_Article_860026299)
	SAUT DISTRI_ERR
FINSI

# Renommage en TsymTrtmcp
erreur_860026299=i_rename_art(g_iartout,"TsymTrtmcp")

# Ajout des champs CCD , SGTQS, ECC_FACT
erreur_860026299=i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4ccd,$TsymTrtmcp::CCD,0)
erreur_860026299=i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4sgtqs,$TsymTrtmcp::SGTQS,0)
erreur_860026299=i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4eccfact,$TsymTrtmcp::ECC_FACT,0)

# champ ND_RTC_42L facultatif
SI (IDUS_NDIP_860026299 == 1)
ALORS
	erreur_860026299=i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4ND_RTC_42L,$TsymTrtmcp::ND_RTC_42L ,0)
FINSI

############################################################################
# Attente requetes Table de Distribution
############################################################################
# Recuperation bloquante des resultats de la derniere requete asynchrone
# Remarque: placer le plus de code possible avant ce point, pour optimiser le temps CPU

SI (!bREDIST_860026299)
ALORS
	erreur_860026299= i_LireReqConsTabDist()
	#trace1("RETOUR i_LireReqConsTabDist, erreur=<%d>",erreur)
	SI ( erreur_860026299 != 0 )
	ALORS
		res_860026299 = i_get_attr_str_n($E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
		erreur_860026299 = i_PlvMessEmettre(8503,2,g_iartin,"Erreur i_LireReqConsTabDist",3,"","Trtmcp",pt_SGTQS_860026299)
		bREDIST_860026299 = 1
	FINSI
FINSI

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

#---------------------------------------------------------------------------
# FERPV
#---------------------------------------------------------------------------

SI ( FACTURABLE_860026299 && i_strcmp (pt_NDRTC_860026299,"") && i_LireInfoECC(instFERPV_860026299,0) && !bREDIST_860026299)
ALORS
	#trace( "FERPV repond aux criteres de distribution")
	erreur_860026299 = i_AjouterCouranteECC(instFERPV_860026299)
	erreur_860026299 = i_LireChaineInfo(i_LireInfoECC(instFERPV_860026299,0),0,1,pt_InfoCompl_860026299)
	i_strcpy(pt_service_860026299,"4")

	SI (!i_strcmp(pt_InfoCompl_860026299,"1"))
	ALORS
		i_strcpy(pt_service_860026299,"1")
	SINON
		SI (!i_strcmp(pt_InfoCompl_860026299,"2"))
		ALORS
			i_strcpy(pt_service_860026299,"2")
		FINSI
	FINSI
	# -- ECC de facturation --
	i_strcpy(pt_NomEccFact_860026299, "FE")
	bFERPV_860026299 = 1
FINSI

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------

SI ( FACTURABLE_860026299 && i_strcmp (pt_NDRTC_860026299,"") && !bFERPV_860026299 && i_LireInfoECC(instFE_860026299,0) && !bREDIST_860026299)
ALORS
	#trace( "FE repond aux criteres de distribution")
	erreur_860026299 = i_AjouterCouranteECC(instFE_860026299)
	# -- ECC de facturation --
	i_strcpy(pt_NomEccFact_860026299, "FE")
	bFE_860026299 = 1
FINSI

#---------------------------------------------------------------------------
# Trafic
#---------------------------------------------------------------------------

SI( !bFE_860026299 && !bFERPV_860026299 && FACTURABLE_860026299 && i_strcmp (pt_NDRTC_860026299,"") && !bREDIST_860026299)
ALORS
	#Traitement du code CFR:
	res_860026299=i_LireInfoECC(instTRAFIC_860026299, 0)
	#trace1("Retour i_LireInfoECC(instTRAFIC, 0)= <%d>",res)

	SI (res_860026299 != 0)
	ALORS
		erreur_860026299 = i_LireChaineInfo( res_860026299, 0, 3, pt_InfoCompl_860026299)
		#trace2(" Resultat de i_LireChaineInfo : <%s>", pt_InfoCompl, "")
		erreur_860026299 = i_format_str2(pt_inst_860026299, "TRAF%s", pt_InfoCompl_860026299,0)
		#trace2("Concatenation de TRAF avec info.compl: <%s>", pt_inst, "")
		instTRAFIC_860026299 = i_LireInstanceECC(pt_inst_860026299)
		trace1("Instance de TRAFIC: instTRAFIC=<%d>",instTRAFIC_860026299)

		SI (!instTRAFIC_860026299)
		ALORS
			code_errone_860026299 = 0xA0B0
			code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
			erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,pt_inst_860026299,C_Article_860026299)
			SAUT DISTRI_ERR
		FINSI
		erreur_860026299=i_AjouterCouranteECC(instTRAFIC_860026299)
		bTRAFIC_860026299 = 1

		# -- ECC de facturation --
		i_strcpy(pt_NomEccFact_860026299, pt_inst_860026299)
	SINON
		SI ( trait_ok_860026299 == 0)
		ALORS
			trace("Envoi en redistribution (retour de i_LireInfoECC(instTRAFIC, 0) incorrect)")
			res_860026299 = i_get_attr_str_n($E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
			erreur_860026299 = i_PlvMessEmettre(8503,2,g_iartin,"",3,"Indicatif non trouve dans MAJ2G","Trtmcp",pt_SGTQS_860026299)
		FINSI

		SAUT AVANT_REDIST
	FINSI
FINSI

#---------------------------------------------------------------------------
# Delta Minute
#---------------------------------------------------------------------------
# SI FE est destinataire / Utilisation de instTRAFIC pour appel a la table de distribution

SI ( (bFE_860026299) && !bREDIST_860026299 )
ALORS
	res_860026299=i_LireInfoECC(instDM_860026299, 0)
	# trace1("Retour i_LireInfoECC(instDM, 0)= <%d>",res)

	SI (res_860026299 != 0)
	ALORS
		erreur_860026299 = i_LireChaineInfo( res_860026299, 0, 3, pt_InfoCompl_860026299)
		# trace2(" Resultat de i_LireChaineInfo : <%s>", pt_InfoCompl, "")
	SINON
		SI ( trait_ok_860026299 == 0)
		ALORS
			trace("Envoi en redistribution (retour de i_LireInfoECC(instDM, 0) incorrect)")
			res_860026299 = i_get_attr_str_n($E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
			erreur_860026299 = i_PlvMessEmettre(8503,2,g_iartin,"",3,"Indicatif non trouve dans MAJ2G","Trtmcp",pt_SGTQS_860026299)
		FINSI
		bREDIST_860026299 = 1
		SAUT AVANT_REDIST
	FINSI

	#Traitement du code CFR:
	erreur_860026299 = i_LireChaineInfo( res_860026299, 0, 3, pt_InfoCompl_860026299)
	erreur_860026299 = i_format_str2(pt_inst_860026299, "DM%s", pt_InfoCompl_860026299,0)
	instDM_860026299 = i_LireInstanceECC(pt_inst_860026299)
	trace1("Instance de DM: instDM=<%d>",instDM_860026299)

	SI (!instDM_860026299)
	ALORS
		code_errone_860026299 = 0xA0B0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026299,pt_inst_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	SI (bFE_860026299)
	ALORS
		dizaine_860026299 = i_LireEntierInfo(res_860026299,0,1)
		unite_860026299 = i_LireEntierInfo(res_860026299,1,1)
		cfr_860026299 = (dizaine_860026299 & 0x0F) * 10 + (unite_860026299 & 0x0F)
		erreur_860026299 = i_set_attr_val_n($E_Trtmcp::CFR,cfr_860026299)
		#trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr)
		#trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK)
	FINSI
	#trace( "DM repond aux criteres de distribution")
	erreur_860026299 = i_AjouterCouranteECC(instDM_860026299)
FINSI

# suppression ECC : Allofact

#---------------------------------------------------------------------------
# CENTAUREDEA
#---------------------------------------------------------------------------

SI (FACTURABLE_860026299 && b_arretfct_centaure_860026299 && ( CAX_860026299 != 3 ))
ALORS
	bCENTDEA_860026299 = 1
	erreur_860026299 = i_AjouterCouranteECC(instCENTAUREDEA_860026299)
FINSI

############################################################################
# Validation de la liste des ECCs destinatrices
############################################################################

erreur_860026299 = i_ValiderListeECC( 0, 0, 0, 0)

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

#---------------------------------------------------------------------------
# Trafic
#---------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC( instTRAFIC_860026299 )  && !bREDIST_860026299)
ALORS

	# Duplication article en entree
	SI ( i_dup_art_dest( g_iartin, g_iartout6, C_Ttrafic_860026299 ) )
	ALORS
		code_errone_860026299 = 0xA0D0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026299,C_Ttrafic_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	# DOMAINE (type:alphanumerique, format:Chaine EBCDIC)
	SI (IDUS_NDIP_860026299==1)
	ALORS
		erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::DOMAINE, "10" )
	SINON
		erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::DOMAINE, "33" )
	FINSI

	# SERVICE ( alphanumerique/EBCDIC )
	SI (IDUS_NDIP_860026299==1)
	ALORS
		erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::SERVICE, "69" )
	SINON
		erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::SERVICE, "54" )
	FINSI

	# IDUS_INF ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::IDUS_INF, i_get_art_field( g_iartin, $IDUS_INF ) )

	# IDUS_NUM (alphanumerique/Chaine EBCDIC)
	erreur_860026299 = i_set_art_str( g_iartout6, $TtraficN::IDUS_NUM, pt_NDRTC_860026299)

	#DATE
	erreur_860026299=i_set_art_field(g_iartout6, $TtraficN::DATE,ICAR_S_860026299)

	#C_CSV1
	erreur_860026299 = i_set_art_str( g_iartout6, $TtraficN::C_CSV1,pt_C_CSV1_860026299 )

	# CAX ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::CAX,CAX_860026299 )

	# MES1 ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::MES1, 255 )

	# MES2 ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::MES2, 255 )

	# SGTQS
	i_strcpy(pt_SGTQS_860026299,i_LireEECSGTQS( g_ieec ))
	#trace2( "SGTQS=<%s>", SGTQS, "" )
	erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::SGTQS, pt_SGTQS_860026299)

	#  NB_CSV
	erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::NB_CSV, NB_CSV_860026299)

	# OP_CSV1 (alphanumerique)
	erreur_860026299=i_set_art_str( g_iartout6, $TtraficN::OP_CSV1,pt_OP_CSV1_860026299)

	SI MER_860026299 &&  (!SPORTABILITE_860026299 && (CCD_860026299 != 0x18 || EPORTABILITE_860026299))
	ALORS
		# DEDE_INF (numerique/chaine EBCDIC)
		SI ( i_valid_field_n( g_iartin, $Trtmcp::DECO) )
		ALORS
			erreur_860026299 = i_set_art_field( g_iartout6, $TtraficN::DEDE_INF, i_get_art_field( g_iartin, $DECO_INF ))
		SINON
			erreur_860026299 = i_set_art_field( g_iartout6, $TtraficN::DEDE_INF, 000 )
		FINSI

		# DUREE (numerique/numerique)
		SI  (i_valid_field_n(g_iartin, $Trtmcp::DCONV))
		ALORS
			info_860026299 = 	i_get_art_field(g_iartin, $DCONV)
		SINON
			info_860026299 = i_get_art_field(g_iartin, $DUREE)
		FINSI
		#trace1( "DUREE:%d",info )
		erreur_860026299 = i_set_art_field(g_iartout6, $TtraficN::DUREE,info_860026299)

		# TAX ( numerique/EBCDIC )
		#trace1( "NUTC:%d", i_get_art_field( g_iartin, $NUTC ) )
		#trace1( "NUTR:%d", i_get_art_field( g_iartin, $NUTR ) )
		#trace( "initialisation de TAX")
		SI (i_valid_field_n(g_iartin, $Trtmcp::NUTC) &&  i_valid_field_n(g_iartin, $Trtmcp::NUTR))
		ALORS
			erreur_860026299 = i_set_art_field( g_iartout6,$TtraficN::TAX,i_get_art_field( g_iartin, $NUTC )+i_get_art_field( g_iartin, $NUTR ) )
		SINON
			erreur_860026299 = i_set_art_field( g_iartout6, $TtraficN::TAX,0)
		FINSI
	SINON
		# SI MER faux

		# DEDE_INF
		erreur_860026299 = i_set_art_field( g_iartout6, $TtraficN::DEDE_INF, 0 )

		#DUREE (numerique/numerique)
		info_860026299 = 	i_get_art_field(g_iartin, $DUREE)
		erreur_860026299=i_set_art_field(g_iartout6, $TtraficN::DUREE,info_860026299)

		# TAX ( numerique/EBCDIC )
		#trace( "initialisation de TAX")
		erreur_860026299=i_set_art_field( g_iartout6, $TtraficN::TAX,i_get_art_field( g_iartin, $TAXE ) )
	FINSI

	#SUPP
	SI (IDUS_NDIP_860026299)
	ALORS
		SI (MER_860026299)
		ALORS
			i_get_sub_str (pt_DEDE_DIST_N_860026299,1,1,pt_buffer2_860026299)

			SI ((i_strlen(pt_DEDE_DIST_N_860026299)==10) && (i_strcmp(pt_buffer2_860026299,"6")==0))
			ALORS
				erreur_860026299= i_set_art_field ( g_iartout6, $TtraficN::SUP,5)
			SINON
				erreur_860026299= i_set_art_field ( g_iartout6, $TtraficN::SUP,4)
			FINSI
		SINON
			erreur_860026299= i_set_art_field ( g_iartout6, $TtraficN::SUP,4)
		FINSI
	SINON
		erreur_860026299= i_set_art_field ( g_iartout6, $TtraficN::SUP,0)
	FINSI

	# DEDE_NUM (alphanumerique/Chaine EBCDIC)
	i_replace_str( pt_DEDE_DIST_N_860026299, "BCF", "*# ", pt_DEDE_DIST_N_860026299 )
	erreur_860026299 = i_set_art_str( g_iartout6, $TtraficN::DEDE_NUM, pt_DEDE_DIST_N_860026299 )

	# Champ CLASSDEST CCD
	erreur_860026299=i_set_art_field(g_iartout6,$TtraficN::CLASSDEST,CCD_REEL_860026299)
FINSI

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------

SI (!i_ChercherCouranteECC(instFE_860026299) && !bREDIST_860026299)
ALORS
	# Duplication article en entree

	SI (i_dup_art_dest( g_iartin, g_iartout3, C_Tfe_860026299 ))
	ALORS
		code_errone_860026299 = 0xA0D0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026299,C_Tfe_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	#SERVICE
	erreur_860026299=i_set_art_str(g_iartout3,$Tfe::SERVICE,"54")

	#IDUS_INF
	erreur_860026299 = i_set_art_field(g_iartout3,$Tfe::IDUS_INF, 0)

	#IDUS_NUM
	i_replace_str(pt_NDRTC_860026299,"BCDE","AJSC",pt_NDRTC_860026299)
	erreur_860026299 = i_set_art_str( g_iartout3, $Tfe::IDUS_NUM,  pt_NDRTC_860026299 )

	# DEDE_NUM (alphanumerique/Chaine EBCDIC)
	i_replace_str(pt_DEDE_DIST_N_860026299,"BCF","*# ",pt_DEDE_DIST_N_860026299)
	erreur_860026299 = i_set_art_str( g_iartout3, $Tfe::DEDE_NUM, pt_DEDE_DIST_N_860026299 )

	# DATE (date/date)
	erreur_860026299=i_set_art_field(g_iartout3, $Tfe::DATE,ICAR_S_860026299)

	#C_CSV1
	erreur_860026299 = i_set_art_str( g_iartout3, $Tfe::C_CSV1,pt_C_CSV1_860026299 )

	# CAX ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::CAX,CAX_860026299 )

	#########################################################
	# Champ SUP
	# bits  ( A B C D E F G H ) = ( 1 1 1 0 0 0 0 0 ) = 0xe0
	#########################################################
	info_860026299 = i_get_art_field( g_iartin, $Trtmcp::STY) & 0xe0
	#trace1("STY_ABC: %d",info)

	#SI bits ABC = 100
	SI (info_860026299 == 0x80)
	ALORS
		erreur_860026299=i_set_art_field( g_iartout3, $Tfe::SUP, 1)
	SINON
		#Bits A et C
		SI (info_860026299 == 0xC0)
		ALORS
			erreur_860026299=i_set_art_field( g_iartout3, $Tfe::SUP, 2)
		SINON
			erreur_860026299=i_set_art_field( g_iartout3, $Tfe::SUP, 0)
		FINSI
	FINSI

	# REF ( numerique/EBCDIC )
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::REF, i_get_art_field( g_iartin, $REF ) )

	# CLASSDEST ( numerique )
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::CLASSDEST, CCD_REEL_860026299 )

	# MES1 ( numerique )
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::MES1, 255 )

	# MES2 ( numerique)
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::MES2, 255 )

	# Champ NB_CSV
	erreur_860026299=i_set_art_field( g_iartout3, $Tfe::NB_CSV, NB_CSV_860026299)

	# OP_CSV1 (alphanumerique)
	erreur_860026299=i_set_art_str( g_iartout3, $Tfe::OP_CSV1,pt_OP_CSV1_860026299)

	#Champ E (non defini)
	erreur_860026299=i_set_art_str( g_iartout3, $Tfe::E, "0")

	#trace1("MER <%d>",MER)
	SI (MER_860026299 && !SPORTABILITE_860026299 && (CCD_860026299!= 0x18 || EPORTABILITE_860026299) )
	ALORS
		#DUREE (numerique/numerique)
		SI  (i_valid_field_n(g_iartin, $Trtmcp::DCONV))
		ALORS
			info_860026299 = 	i_get_art_field(g_iartin, $DCONV)
		SINON
			info_860026299 = i_get_art_field(g_iartin, $DUREE)
		FINSI
		erreur_860026299=i_set_art_field(g_iartout3, $Tfe::DUREE,info_860026299)

		# TAX ( numerique/EBCDIC )
		SI (i_valid_field_n(g_iartin, $Trtmcp::NUTC) && i_valid_field_n(g_iartin, $Trtmcp::NUTR))
		ALORS
			erreur_860026299=i_set_art_field( g_iartout3, $Tfe::TAX,i_get_art_field( g_iartin, $NUTC )+i_get_art_field( g_iartin, $NUTR ) )
		SINON
			erreur_860026299 = i_set_art_field( g_iartout3, $Tfe::TAX,0)
		FINSI
	SINON
		# SI MER faux

		# DEDE_INF
		#erreur=i_set_art_field( g_iartout3, $Tfe::DEDE_INF, 0 )

		#DUREE (numerique/numerique)
		info_860026299 = 	i_get_art_field(g_iartin, $DUREE)
		#trace1( "DUREE:%d",info )
		erreur_860026299=i_set_art_field(g_iartout3, $Tfe::DUREE,info_860026299)

		# TAX ( numerique/EBCDIC )
		erreur_860026299=i_set_art_field( g_iartout3, $Tfe::TAX,i_get_art_field( g_iartin, $TAXE ) )
	FINSI

	# DEDE_INF
	erreur_860026299 = i_set_art_field( g_iartout3, $Tfe::DEDE_INF, DEDE_INF_860026299  )
FINSI

#---------------------------------------------------------------------------
# FERPV
#---------------------------------------------------------------------------

SI (!i_ChercherCouranteECC(instFERPV_860026299) && !bREDIST_860026299)
ALORS
	# Duplication article en entree
	SI (i_dup_art_dest( g_iartin, g_iartout11, C_Tfe_rpv_860026299 ))
	ALORS
		code_errone_860026299 = 0xA0D0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026299,C_Tfe_rpv_860026299,C_Article_860026299)
		SAUT DISTRI_ERR
	FINSI

	#trace("Debut du Stockage dans FERPV")

	#SERVICE
	erreur_860026299=i_set_art_str(g_iartout11,$Tfe_rpv::SERVICE, pt_service_860026299)

	# SOURCE
	erreur_860026299=i_set_art_str( g_iartout11, $Tfe_rpv::SOURCE, "03" )

	# NUMDDR (alphanumerique/alphanumerique)
	erreur_860026299 = i_format_str2(pt_buffer2_860026299,"%s%s","0",pt_NDRTC_860026299)
	i_replace_str(pt_buffer2_860026299,"BCDE","AJSC",pt_buffer2_860026299)
	erreur_860026299 = i_set_art_str( g_iartout11, $Tfe_rpv::NUMDDR,  pt_buffer2_860026299 )

	# NUMDDE (alphanumerique/Chaine EBCDIC)
	i_replace_str(pt_DEDE_DIST_N_860026299,"BCF","*# ",pt_DEDE_DIST_N_860026299)
	erreur_860026299 = i_set_art_str( g_iartout11, $Tfe_rpv::NUMDDE, pt_DEDE_DIST_N_860026299 )

	# DEBUT (date/date)
	erreur_860026299=i_set_art_field(g_iartout11, $Tfe_rpv::DEBUT,ICAR_S_860026299)

	#trace1("MER <%d>",MER)
	SI (MER_860026299 && !SPORTABILITE_860026299 && (CCD_860026299!= 0x18 || EPORTABILITE_860026299) )
	ALORS
		#DUREE (numerique/numerique)
		SI  (i_valid_field_n(g_iartin, $Trtmcp::DCONV))
		ALORS
			info_860026299 = 	i_get_art_field(g_iartin, $DCONV)
		SINON
			info_860026299 = i_get_art_field(g_iartin, $DUREE)
		FINSI
		#trace1( "DUREE:%d",info )
		erreur_860026299=i_set_art_field(g_iartout11, $Tfe_rpv::DUREE,info_860026299)

		# NBUT ( numerique/EBCDIC )
		SI (i_valid_field_n(g_iartin, $Trtmcp::NUTC) && i_valid_field_n(g_iartin, $Trtmcp::NUTR))
		ALORS
			erreur_860026299=i_set_art_field( g_iartout11, $Tfe_rpv::NBUT,i_get_art_field( g_iartin, $NUTC )+i_get_art_field( g_iartin, $NUTR ) )
		SINON
			erreur_860026299 = i_set_art_field( g_iartout11, $Tfe_rpv::NBUT,0)
		FINSI
	SINON

		#DUREE (numerique/numerique)
		info_860026299 = 	i_get_art_field(g_iartin, $DUREE)
		erreur_860026299=i_set_art_field(g_iartout11, $Tfe_rpv::DUREE,info_860026299)

		# TAX ( numerique/EBCDIC )
		erreur_860026299=i_set_art_field( g_iartout11, $Tfe_rpv::NBUT,i_get_art_field( g_iartin, $TAXE ) )
	FINSI

	erreur_860026299=i_set_art_field( g_iartout11, $Tfe_rpv::NBCOD, NB_CSV_860026299)
	CCD_REEL_FE_860026299 = CCD_REEL_860026299
	CCD_REEL_FE_860026299 = CCD_REEL_FE_860026299 + 1000

	erreur_860026299 = i_cree_art("Conversion",g_iartout13)
	erreur_860026299 = i_set_art_field(g_iartout13,$Conversion::CCD,CCD_REEL_FE_860026299 )
	erreur_860026299 = i_conv_field("CCD",g_iartout13, 2, g_iartout11, 4,0)

	erreur_860026299 = i_get_art_str(g_iartout11,$Tfe_rpv::CCD,pt_buffer_860026299)
	i_get_sub_str(pt_buffer_860026299,1,3,pt_buffer2_860026299)
	erreur_860026299 = i_set_art_str(g_iartout11,$Tfe_rpv::CCD,pt_buffer2_860026299)
	#trace2(" CCD_REEL_xx <%s> ", pt_buffer, "")
	#trace2(" CCD_REEL_FE <%s> ", pt_buffer2, "")

	#C_CSV1
	erreur_860026299 = i_set_art_str( g_iartout11, $Tfe_rpv::C_CSV1,pt_C_CSV1_860026299 )

	# CANAL ( numerique/EBCDIC )
	#trace( "initialisation de REF" )
	erreur_860026299=i_set_art_field( g_iartout11, $Tfe_rpv::CANAL, i_get_art_field( g_iartin, $REF ) )

	# OP_CSV1 (alphanumerique)
	erreur_860026299=i_set_art_str( g_iartout11, $Tfe_rpv::OP_CSV1,pt_OP_CSV1_860026299)

	#CCD
	erreur_860026299=i_set_art_field( g_iartout11, $Tfe_rpv::CCD, CCD_REEL_860026299 )

	# Recuperation du code instance TRAFIC pour le calcul ulterieur du meta champ c_libre
	res_860026299=i_LireInfoECC(instTRAFIC_860026299, 0)
	#trace1("Retour i_LireInfoECC(instTRAFIC, 0)= <%d>",res)
	SI (res_860026299 != 0)
	ALORS
		code_CFR_860026299 = ((i_LireEntierInfo(res_860026299,0,1) & 0x0F) * 10) + (i_LireEntierInfo(res_860026299,1,1) & 0x0F)
		#trace2(" Resultat de i_LireChaineInfo : <%s>", pt_InfoCompl, "")
	SINON
		SI ( trait_ok_860026299 == 0)
		ALORS
			trace("Envoi en redistribution (retour de i_LireInfoECC(instTRAFIC, 0) incorrect)")
			res_860026299 = i_get_attr_str_n($E_Trtmcp::Nom_EEC, pt_SGTQS_860026299)
			erreur_860026299 = i_PlvMessEmettre(8503,2,g_iartin,"",3,"Indicatif non trouve dans MAJ2G","Trtmcp",pt_SGTQS_860026299)
		FINSI
		SAUT AVANT_REDIST
	FINSI

	# ajout du champ INFDDE
	erreur_860026299 = i_set_art_field(g_iartout13, $Conversion::INF, DEDE_INF_860026299)
	erreur_860026299 = i_get_art_str( g_iartout13, $Conversion::INF, pt_temp_860026299 )
	#trace2("__LINE__ INF ASCII  <%s>",pt_temp, "")
	erreur_860026299 = i_format_str2( pt_temp2_860026299, "%s%s", "000", pt_temp_860026299)
	#trace2("__LINE__ 000INF ASCII  <%s>",pt_temp2, "")
	i_get_sub_str (pt_temp2_860026299, -3, -1,pt_temp2_860026299)
	#trace2("__LINE__ INF ASCII 3 dig  <%s>",pt_temp2, "")
	erreur_860026299 = i_set_art_str( g_iartout11, $Tfe_rpv::INFDDE, pt_temp2_860026299 )
FINSI

#---------------------------------------------------------------------------
#  Delta Minute
#---------------------------------------------------------------------------
SI (!i_ChercherCouranteECC(instDM_860026299) && !bREDIST_860026299)
ALORS
	SI (!i_ChercherCouranteECC(instFE_860026299))
	ALORS
		# Duplication article en entree
		SI (i_dup_art_dest( g_iartin, g_iartout4, C_Tdelta_minute_860026299 ))
		ALORS
			code_errone_860026299 = 0xA0D0
			code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
			erreur_860026299 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026299,C_Tdelta_minute_860026299,C_Article_860026299)
			SAUT DISTRI_ERR
		FINSI

		# DOMAINE (type:alphanumerique, format:Chaine EBCDIC)
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::DOMAINE, "33" )

		# SERVICE ( alphanumerique/EBCDIC )
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::SERVICE, "54" )

		# IDUS_INF ( numerique/EBCDIC )
		# table de duplication

		# IDUS_NUM (alphanumerique/Chaine EBCDIC)

		i_strcpy(pt_buffer_860026299,pt_NDRTC_860026299)
		i_replace_str(pt_buffer_860026299,"BCDE","AJSC",pt_buffer_860026299)
		erreur_860026299 = i_set_art_str( g_iartout4, $Tdelta_minute::IDUS_NUM, pt_buffer_860026299 )

		# DEDE_NUM (alphanum)
		i_replace_str(pt_DEDE_DIST_N_860026299,"BCF","*# ",pt_DEDE_DIST_N_860026299)
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::DEDE_NUM,pt_DEDE_DIST_N_860026299 )

		# DATE (date/date)
		erreur_860026299=i_set_art_field(g_iartout4, $Tdelta_minute::DATE,ICAR_S_860026299)

		# C_CSV1 (alphanum)
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::C_CSV1,pt_C_CSV1_860026299 )

		# CAX ( numerique/EBCDIC )
		erreur_860026299=i_set_art_field( g_iartout4, $Tdelta_minute::CAX,CAX_860026299 )

		# SGTQS
		i_strcpy(pt_SGTQS_860026299,i_LireEECSGTQS( g_ieec ))
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::SGTQS, pt_SGTQS_860026299)

		# Champ NB_CSV
		erreur_860026299=i_set_art_field( g_iartout4, $Tdelta_minute::NB_CSV, NB_CSV_860026299)

		# OP_CSV1 (alphanumerique)
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::OP_CSV1,pt_OP_CSV1_860026299)

		#MNEMO
		erreur_860026299=i_set_art_str( g_iartout4, $Tdelta_minute::MNEMO, "         " )

		#trace1("MER <%d>",MER)
		SI ( MER_860026299  && !SPORTABILITE_860026299 && (CCD_860026299!= 0x18 || EPORTABILITE_860026299) )
		ALORS
			# DEDE_INF (numerique/chaine EBCDIC)
			SI (i_valid_field_n(g_iartin,$Trtmcp::DECO))
			ALORS
				erreur_860026299 = i_set_art_field( g_iartout4, $Tdelta_minute::DEDE_INF, i_get_art_field( g_iartin, $DECO_INF ))
			SINON
				erreur_860026299 = i_set_art_field( g_iartout4, $Tdelta_minute::DEDE_INF, 0 )
			FINSI

			#DUREE (numerique/numerique)
			SI  (i_valid_field_n(g_iartin, $Trtmcp::DCONV))
			ALORS
				info_860026299 = 	i_get_art_field(g_iartin, $DCONV)
			SINON
				info_860026299 = i_get_art_field(g_iartin, $DUREE)
			FINSI
			erreur_860026299=i_set_art_field(g_iartout4, $Tdelta_minute::DUREE,info_860026299)
			SI (i_valid_field_n(g_iartin, $Trtmcp::NUTC) && i_valid_field_n(g_iartin, $Trtmcp::NUTR))
			ALORS
				erreur_860026299=i_set_art_field( g_iartout4, $Tdelta_minute::TAX,i_get_art_field( g_iartin, $NUTC )+i_get_art_field( g_iartin, $NUTR ) )
			SINON
				erreur_860026299 = i_set_art_field( g_iartout4, $Tdelta_minute::TAX,0)
			FINSI
		SINON
			# DEDE_INF
			erreur_860026299=i_set_art_field( g_iartout4, $Tdelta_minute::DEDE_INF, 0 )

			#DUREE (numerique/numerique)
			info_860026299 = 	i_get_art_field(g_iartin, $DUREE)
			erreur_860026299=i_set_art_field(g_iartout4, $Tdelta_minute::DUREE,info_860026299)

			# TAX ( numerique/EBCDIC )
			erreur_860026299=i_set_art_field( g_iartout4, $Tdelta_minute::TAX,i_get_art_field( g_iartin, $TAXE ) )
		FINSI

		# Champ CLASSDEST
		erreur_860026299=i_set_art_field(g_iartout4,$Tdelta_minute::CLASSDEST,CCD_REEL_860026299)
	FINSI
FINSI

# suppression ECC : ALLOFACT

POINT AVANT_REDIST

SI (trait_ok_860026299 == 2 || bREDIST_860026299 == 0)
ALORS
	#---------------------------------------------------------------------------
	# Complements Symphonie
	#---------------------------------------------------------------------------
	SI (!i_ChercherCouranteECC(instSYMP_860026299))
	ALORS
		# Champ CCD
		erreur_860026299=i_set_art_field(g_iartout, $TsymTrtmcp::CCD, CCD_REEL_860026299)

		# Champ SGTQS
		i_strcpy(pt_SGTQS_860026299,i_LireEECSGTQS( g_ieec ))
		erreur_860026299 = i_set_art_str(g_iartout, $TsymTrtmcp::SGTQS, pt_SGTQS_860026299)

		# Champs optionnels NBCOD et CSV1
		SI (NB_CSV_860026299 > 0)
		ALORS
			# Champ NBCOD
			erreur_860026299 = i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4nbcod,$TsymTrtmcp::NBCOD,0)
			erreur_860026299 = i_set_art_field(g_iartout,$TsymTrtmcp::NBCOD,1)

			# Champ CSV1
			erreur_860026299 = i_format_str2(pt_temp2_860026299,"%s%s",pt_C_CSV1_860026299, "  ")
			i_get_sub_str(pt_temp2_860026299, 0, 1, pt_temp2_860026299)
			erreur_860026299 = i_format_str2(pt_buffer_860026299,"%s%s",pt_temp2_860026299 ,pt_OP_CSV1_860026299)
			erreur_860026299 = i_ajoutChampNum(g_iartout,$TsymTrtmcp::T4csv1,$TsymTrtmcp::CSV1,0)
			erreur_860026299 = i_set_art_str(g_iartout,$TsymTrtmcp::CSV1,pt_buffer_860026299)
		FINSI

		# Champ ECC_FACT
		SI (bREDIST_860026299 || (!bFE_860026299 && !bFERPV_860026299 && !bTRAFIC_860026299) )
		ALORS
			i_strcpy(pt_NomEccFact_860026299, "")
		FINSI
		erreur_860026299 = i_set_art_str(g_iartout, $TsymTrtmcp::ECC_FACT,pt_NomEccFact_860026299 )

		SI (IDUS_NDIP_860026299 == 1)
		ALORS
			erreur_860026299 = i_set_art_str(g_iartout, $TsymTrtmcp::ND_RTC_42L,pt_NDRTC_860026299)
		FINSI

		#---------------------------------------------------------------------
		# Symphonie
		#---------------------------------------------------------------------

		SI !(i_ChercherCouranteECC(instSYMP_860026299))
		ALORS
			res_860026299=i_stocke_art_iecc(g_iartout,instSYMP_860026299)
		FINSI
	FINSI
FINSI

#---------------------------------------------------------------------------
# CENTAUREDEA
#---------------------------------------------------------------------------
SI (bCENTDEA_860026299)
ALORS
	#trace("Duplication vers CENTAUREDEA")
	SI (i_dup_art_dest(g_iartin,g_iartout9,C_TcentaureDEA_860026299))
	ALORS
		code_errone_860026299 = 0xA0D0
		code_errone_860026299 = code_errone_860026299 + EFFICACE_860026299
		erreur_860026299 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026299, C_TcentaureDEA_860026299, C_Article_860026299)
		SAUT  DISTRI_ERR
	FINSI

	#Champ DATE
	erreur_860026299 = i_set_art_field(g_iartout9, $TcentaureDEA::DATE, ICAR_S_860026299)

	# Champ IIDUS
	erreur_860026299 = i_set_art_field(g_iartout9, $TcentaureDEA::IIDUS, i_get_art_field( g_iartin, $IDUS_INF ))

	#Champ NIDUS
	erreur_860026299 = i_set_art_str(g_iartout9, $TcentaureDEA::NIDUS, pt_IDUS_N_860026299)

	#Champ NDEDE
	erreur_860026299 = i_set_art_str(g_iartout9, $TcentaureDEA::NDEDE, pt_DECO_NUM_860026299)

	#Champ IDEDE
	erreur_860026299 = i_set_art_field(g_iartout9, $TcentaureDEA::IDEDE, i_get_art_field( g_iartin, $DECO_INF ))

	#Champ IIDAV
	erreur_860026299 = i_set_art_str(g_iartout9, $TcentaureDEA::NIDAV, "130")

	#Champ NIDAV
	SI (SPORTABILITE_860026299 == 1)
	ALORS
		# si DECO_NUM ne commence pas par 842
		SI !((i_get_art_fieldtab(g_iartin,$DECO_NUM,0) == 8 ) && (i_get_art_fieldtab(g_iartin,$DECO_NUM,1) == 4)
		&& (i_get_art_fieldtab(g_iartin,$DECO_NUM,2) == 2) )
		ALORS
			# CodeOperateur(pt_CodeOp) + DECO_NUM (pt_DECO_NUM)
			erreur_860026299 = i_format_str2(pt_NIDAV_860026299, "%s%s", pt_CodeOp_860026299, pt_DECO_NUM_860026299)
		FINSI
	SINON
		# sinon DECO_NUM
		i_strcpy(pt_NIDAV_860026299, pt_DECO_NUM_860026299)
	FINSI
	erreur_860026299 = i_set_art_str(g_iartout9, $TcentaureDEA::NIDAV, pt_NIDAV_860026299)

	#Champ NICOM
	erreur_860026299 = i_set_art_str(g_iartout9, $TcentaureDEA::NICOM, "SVAITX")

	#Champ DUR
	SI (MER_860026299 == 1)
	ALORS
		res_860026299 = i_get_art_field( g_iartin, $Trtmcp::DCONV)
		erreur_860026299 = i_set_art_field(g_iartout9,$TcentaureDEA::DUREE, res_860026299)
	SINON
		res_860026299 = i_get_art_field(g_iartin,$Trtmcp::DUREE)
		erreur_860026299 = i_set_art_field(g_iartout9, $TcentaureDEA::DUREE, res_860026299)
	FINSI

	#Champ TAX
	SI (MER_860026299 == 1)
	ALORS
		SI (i_valid_field_n(g_iartin, $Trtmcp::T3traa))
		ALORS
			taxe_860026299 = i_get_art_field(g_iartin, $Trtmcp::NUTC) + i_get_art_field(g_iartin, $Trtmcp::NUTR)
		SINON
			taxe_860026299 = i_get_art_field( g_iartin, $Trtmcp::TAXE )
		FINSI
	FINSI
	erreur_860026299 = i_set_art_field(g_iartout9, $TcentaureDEA::TAX, taxe_860026299)

	#Champ CDSGTQS
	i_strcpy(pt_SGTQS_860026299, i_LireEECSGTQS( g_ieec ))
	erreur_860026299=i_set_art_str(g_iartout9, $TcentaureDEA::CDSGTQS, pt_SGTQS_860026299)
FINSI

SI (bREDIST_860026299 == 1)
ALORS
	SAUT DISTRI_RDT
FINSI

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

SI (!i_ChercherCouranteECC(instTRAFIC_860026299))
ALORS
	res_860026299 = i_stocke_art_iecc( g_iartout6, instTRAFIC_860026299 )
	#trace( "Emission vers TRAFIC" )
FINSI

SI (!i_ChercherCouranteECC(instFE_860026299))
ALORS
	res_860026299 = i_stocke_art_iecc(g_iartout3, instFE_860026299)
	#trace("Emission vers FE")
FINSI

SI (!i_ChercherCouranteECC(instFERPV_860026299))
ALORS
	# Creation de l'enveloppe
	SI (ENVELOPPE_NOK_860026299)
	ALORS
		ENVELOPPE_NOK_860026299 = i_add_opt("E_Trtmcp")
	FINSI
	#---------------------
	#  Mise a jour de l'ENVELOPPE Optionelle:
	# Contient la date de fin metropole et le code CFR necessaires pour les metachamps de distri
	# Champ DATE
	info_860026299 = i_get_art_field(g_iartout11, $Tfe_rpv::DEBUT) + i_get_art_field(g_iartout11, $Tfe_rpv::DUREE)
	erreur_860026299 = i_set_attr_val_n($E_Trtmcp::DATE_M, info_860026299)
	# Champ CFR : traitement de l'info complementaire de TRAFIC
	erreur_860026299 = i_set_attr_val_n($E_Trtmcp::CFR, code_CFR_860026299)
	res_860026299 = i_stocke_art_iecc(g_iartout11, instFERPV_860026299)
	#trace("Emission vers FERPV")
FINSI

SI (!i_ChercherCouranteECC(instDM_860026299))
ALORS
	SI (!i_ChercherCouranteECC(instFE_860026299))
	ALORS
		res_860026299 = i_stocke_art_iecc(g_iartout4, instDM_860026299)
		#trace("Emission vers Delta Minute pour FE")
	FINSI
FINSI

SI bCENTDEA_860026299
ALORS
	#trace("emission vers CENTAUREDEA")
	res_860026299 = i_stocke_art_iecc(g_iartout9, instCENTAUREDEA_860026299)
FINSI

RETOUR TRAIT_OK

############################################################################
# Stockage en Redistribution
############################################################################
POINT DISTRI_RDT

#IFDEF trace_niv1 = 1
trace( "__FILE__:__LINE__ : Stockage en Redistribution" )
#ENDIF
res_860026299 = i_stocke_art( g_iartin, 0, PT_REDIST|RD_TABLE5, 0)

RETOUR TRAIT_OK

############################################################################
# Stockage en Errone
############################################################################
POINT DISTRI_ERR

#IFDEF trace_niv1 = 1
trace( "__FILE__:__LINE__ : Anomalie de distribution ==> ERRONE" )
#ENDIF

res_860026299=i_make_art_rej(g_iartin, g_iartout, code_errone_860026299)
res_860026299 = i_stocke_art( g_iartout, 0, PT_ERRONE, 0 )

RETOUR TRAIT_OK
