DEFINITION Multidistribution_Non_660004642 0
DEFINITION DISTRIBUTION_INCONNU_660004642 1
DEFINITION TRAI_KO_660004642 -1
DEFINITION MODULE_DISTR_660004642 0xA000
DEFINITION ERR_DUPL_660004642 0x0D0
DEFINITION ERR_CONV_660004642 0x0E0
DEFINITION ERR_DISTR_660004642 0x110
REGISTRE ENTIER erreur_660004642
REGISTRE ENTIER flag_rdt_660004642
REGISTRE ENTIER taille_callRefNb_660004642
REGISTRE ENTIER taille_mscAddress_660004642
REGISTRE ENTIER taille_mscAddr_660004642
REGISTRE ENTIER taille_serverAddr_660004642
REGISTRE ENTIER taille_PdpAddress_660004642
REGISTRE ENTIER taille_srvAddr_660004642
REGISTRE ENTIER taille_DestNumber_660004642
REGISTRE ENTIER taille_DestNum_660004642
REGISTRE ENTIER taille_CseInfo_660004642
REGISTRE ENTIER indice_octet_660004642
REGISTRE ENTIER caract_660004642
REGISTRE ENTIER caract1_660004642
REGISTRE ENTIER caract2_660004642
REGISTRE ENTIER L_dcb_msisdn_660004642
REGISTRE ENTIER res_660004642
REGISTRE ENTIER taille_AccessPtName_660004642
REGISTRE ENTIER date_fin_660004642
REGISTRE ENTIER code_rejet_660004642
REGISTRE ENTIER EFFICACE_660004642
REGISTRE ENTIER MODULE_660004642
REGISTRE ENTIER ERREUR_660004642
REGISTRE ENTIER ChargingId_660004642
REGISTRE ENTIER nb_resultat_660004642
REGISTRE ENTIER nb_pass_660004642
REGISTRE ENTIER v4t207_maj_660004642
REGISTRE ENTIER v4t208_maj_660004642
REGISTRE ENTIER recEntitycode1_660004642
REGISTRE ENTIER recEntitycode2_660004642
REGISTRE ENTIER chToEntier1_660004642
REGISTRE ENTIER chToEntier2_660004642
REGISTRE ENTIER chToEntier3_660004642
REGISTRE ENTIER chToEntier4_660004642
REGISTRE ENTIER nb_sep_660004642
REGISTRE ENTIER indice_res_660004642
REGISTRE ENTIER resT_660004642
REGISTRE ENTIER nb_0000_660004642
REGISTRE POINTEUR pt_sender_660004642
REGISTRE POINTEUR pt_dcb_msisdn_660004642
REGISTRE POINTEUR pt_RecodeGSN_660004642
REGISTRE POINTEUR pt_RecodeGSN1_660004642
REGISTRE POINTEUR pt_RecodeGSN2_660004642
REGISTRE POINTEUR pt_RecodeTYPE_660004642
REGISTRE POINTEUR pt_GSNres_660004642
REGISTRE POINTEUR pt_GSNres1_660004642
REGISTRE POINTEUR pt_GSNres2_660004642
REGISTRE POINTEUR pt_TYPEres_660004642
REGISTRE POINTEUR pt_TYPEres1_660004642
REGISTRE POINTEUR pt_TYPEres2_660004642
REGISTRE POINTEUR pt_PartialTypeInd_660004642
REGISTRE POINTEUR pt_GSNres_hex_660004642
REGISTRE POINTEUR pt_res_660004642
REGISTRE POINTEUR pt_res2_660004642
REGISTRE POINTEUR pt_res3_660004642
REGISTRE POINTEUR pt_res4_660004642
####################################################################
#	Distribution : Ttap310ZB_GPRS_dis.src, Article EDS Zones Blanches Entrant (TAP 3.10)
#
#	Creation : 25/06/08 Par : AM
#	09/07/2008 : R.ASOUI Correction globale
#	28/08/2008 : R.ASOUI Defect 175 Formatage des @IPV6
#	17/09/2008 : JLG QC203
#	11/02/2009 : DRE G2R2 lot1 item correctif champs V4t20(7,8) spec version A4.0
#	18/03/2009 : DRE/PSA G2R2 QC 340 : gestion de 2 T3 differents pour IPV4 et IPV6
#	05/01/2010 : JLG G2R6 QC521 : taille_CseInfo trop grande car x 2 (a tort)
#	11/06/2010 - JLG - G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2,
#					ajout champ T3t55 (GFlag2) et T3t56 (GValue)
#	27/07/2010 - JLG - G3R1lot1 complet : prise en compte IPV6 dans PDPaddr du Tdpvgsm
# 07/12/2010 - BEA - G3R1 lot4 Verification/Correction des variables (constantes, entiers, pointeurs) : pt_RecodeGSN pt_RecodeGSN1 pt_RecodeGSN2 pt_RecodeTYPE NOK, pt_GSNres1 pt_GSNres2 pt_TYPEres1 pt_TYPEres2 pas verifies.
# 31/01/2011 - modifification des pointeurs pt_RecodeGSN1, pt_RecodeGSN2, pt_RecodeTYPE de 2000 a 1000 (evolution spec)
# 14/03/2011 - JLG - G3R2C4 fusion G3R2C3 avec G3R1C600 (ajout champ T3t99), QC821 modifification pointeur pt_RecodeGSN1, pt_RecodeGSN2, pt_RecodeTYPE de 2000 (evolution spec)
# 29/02/2012 - JLG -G3R6 QC1005 modif alarme retour aiguillage
# 11/02/2014 - JLG -G5R1 QC1331, Built 3 : Changement Marque Audit
# 02/07/2014 - JLG -G5R1 QC1405, champ eec du DPV si g_ieec > 500
####################################################################


trace("Ttap310ZB_GPRS : Debut Distribution")

pt_RecodeGSN_660004642 =  "pt_RecodeGSN_9012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901121222222111116789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890112122222211111"
pt_RecodeGSN1_660004642 = "pt_RecodeGSN1_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345671890123456789022211111pt_RecodeGSN1_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345671890123456789022211111"
pt_RecodeGSN2_660004642 = "pt_RecodeGSN2_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789011234567890123456789022211111pt_RecodeGSN2_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789011234567890123456789022211111"

pt_RecodeTYPE_660004642=  "pt_RecodeTYPE_67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901pt_RecodeTYPE_67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
i_strcpy(pt_RecodeTYPE_660004642,"")

pt_GSNres1_660004642 = "11117891234567891234567891234567893456778:11117891234567891234567891234567893456778"
i_strcpy(pt_GSNres1_660004642,"")
pt_GSNres2_660004642 = "22227891234567891234567891234567893456778:11117891234567891234567891234567893456778"
i_strcpy(pt_GSNres2_660004642,"")
pt_GSNres_660004642 =  "00078912345678912345678912345678934567783:11117891234567891234567891234567893456778"

pt_TYPEres1_660004642 = "11TYPE"
i_strcpy(pt_TYPEres1_660004642,"")
pt_TYPEres2_660004642 = "22TYPE"
i_strcpy(pt_TYPEres2_660004642,"")
pt_TYPEres_660004642  = "00TYPE"

pt_dcb_msisdn_660004642 = "1234567812345678912345678912345678912355"
i_strcpy(pt_dcb_msisdn_660004642,"")
pt_sender_660004642="SENDER0000123213213215465484546876541654656464654654650123456789"
i_strcpy(pt_sender_660004642,"")

EFFICACE_660004642 = 1
MODULE_660004642 = MODULE_DISTR_660004642
ERREUR_660004642 = 0
code_rejet_660004642 = 0

pt_PartialTypeInd_660004642	="ras"
i_strcpy(pt_PartialTypeInd_660004642,"")
pt_GSNres_hex_660004642           ="pt_GSNres_hex1234567891234567891234567891234567899312541234123456789456123456789012"
i_strcpy(pt_GSNres_hex_660004642,"")
pt_res_660004642  ="pt_res_7800331374567"
pt_res2_660004642 ="pt_res2_780033137344"
pt_res3_660004642 ="pt_res3_780033137344"
pt_res4_660004642 ="pt_res4_780033137344"
i_strcpy(pt_res_660004642,"")
i_strcpy(pt_res2_660004642,"")
i_strcpy(pt_res3_660004642,"")
i_strcpy(pt_res4_660004642,"")

# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004642=i_get_art_field(g_iartin,$Ttap310ZB_GPRS::dfin)
erreur_660004642= i_incr_redist_dist_660004265(date_fin_660004642)

erreur_660004642 = i_get_field_str(g_iartin,"sender",pt_sender_660004642)
i_strcpy(pt_RecodeGSN1_660004642,"")
i_strcpy(pt_RecodeGSN2_660004642,"")

##################################################################################
# Identification de la provenance de l'article
# flag_rdt : nb de passage en redistribution (lecture de l'enveloppe obligatoire)
##################################################################################
flag_rdt_660004642 = -1
flag_rdt_660004642 = i_LireRedistCpt()

SI (flag_rdt_660004642 == 0)
ALORS
	erreur_660004642 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004642 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

#####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################
erreur_660004642 = i_dup_art_tab(g_iartin,g_iartout,"Tdpvgsm")

SI (erreur_660004642 != 0)
ALORS
	trace("Ttap310ZB_GPRS : Creation DPV impossible => ERRONE")
	ERREUR_660004642 = ERR_DUPL_660004642
	code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
	erreur_660004642=i_PlvMessEmettre(8908, 2, g_iartin ,"" , 2, code_rejet_660004642, "Tdpvgsm", 0)
	SAUT STOCKE_ERRONE
FINSI

#####################################################################
#		Complement de duplication hors table
#####################################################################

#####################################################################
#		Mise a jour du champ idemet (V3t1.3) AM OK
#####################################################################

#-- assigner la valeur 339999999999999999 sans condition
L_dcb_msisdn_660004642 = i_conv_ascii_dcb("339999999999999999", pt_dcb_msisdn_660004642)
SI(L_dcb_msisdn_660004642 == 0)
ALORS
	trace("tap310ZB_GPRS : Probleme de retour de la fonction i_conv_ascii_dcb")
	ERREUR_660004642 = ERR_CONV_660004642
	code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
	erreur_660004642=i_PlvMessEmettre(8909, 2, g_iartin ,"" , 3, code_rejet_660004642, "MSISDN:3399..9", "DCB")
	SAUT STOCKE_ERRONE
FINSI
erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::idemet,pt_dcb_msisdn_660004642, L_dcb_msisdn_660004642)


#####################################################################
# Mise a jour du champ local (V3t3) AM OK
#####################################################################
# pt_sender is sender

erreur_660004642 = i_ajout_tlv(g_iartout, "T3t3", "")
erreur_660004642 = i_resize_tlv(g_iartout,"T3t3","local",7*8)

SI ( (!i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::locationArea)) || (!i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::cellId)) )
ALORS
# Cas locationArea et cellId absents
	SI (! i_strcmp(pt_sender_660004642,"FRAF2"))
	ALORS
# --- Cas sender FRAF2 (cas SFR)
#		erreur = i_fill_field_hexastr(g_iartout,$Tdpvgsm::local,"2081300000000F")
		erreur_660004642 = affectation_tab_660004265(g_iartout,$Tdpvgsm::local,"2081300000000F")
	SINON
# --- Cas sender FRAF3 (cas BOUYGUES)
#		erreur = i_fill_field_hexastr(g_iartout,$Tdpvgsm::local,"2088800000000F")
		erreur_660004642 = affectation_tab_660004265(g_iartout,$Tdpvgsm::local,"2088800000000F")
	FINSI
SINON
# Cas locationArea et cellId presents
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 0, 2)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 1, 0)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 2, 8)

	SI (! i_strcmp(pt_sender_660004642,"FRAF2"))
	ALORS
# --- Cas sender FRAF2 (cas SFR)
		erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 3, 1)
		erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 4, 3)
	SINON
# --- Cas sender FRAF3 (cas BOUYGUES)
		erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 3, 8)
		erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 4, 8)
	FINSI

	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 5, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::locationArea) >> 12) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 6, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::locationArea) >> 8) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 7, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::locationArea) >> 4) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 8, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::locationArea) & 0xf))
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 9, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::cellId) >> 12) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 10, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::cellId) >> 8) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 11, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::cellId) >> 4) & 0xf)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 12, (i_get_art_field(g_iartin,$Ttap310ZB_GPRS::cellId) & 0xf))
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local , 13, 0xf)
FINSI

#####################################################################
# Mise a jour du champ MSISDN (V3t4)
#####################################################################
# Substituer le 1er octet, puis normalisation $GPRS
# utilisation d un article temporaire

caract1_660004642 = i_get_art_fieldtab(g_iartin,$Ttap310ZB_GPRS::MSISDN,0)
caract2_660004642 = i_get_art_fieldtab(g_iartin,$Ttap310ZB_GPRS::MSISDN,1)

caract_660004642 = caract1_660004642*10+caract2_660004642

SI ( ((caract1_660004642 == 1)&&(caract2_660004642==9)) || ((caract1_660004642 == 9)&&(caract2_660004642==1)) )
ALORS
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0x1)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0x1)
FINSI
SI ( ((caract1_660004642 == 1)&&(caract2_660004642==0)) || ((caract1_660004642 == 1)&&(caract2_660004642==8)) )
ALORS
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0x1)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0x2)
FINSI
SI ( ((caract1_660004642 == 1)&&(caract2_660004642==2)) || ((caract1_660004642 == 1)&&(caract2_660004642==0xA)) )
ALORS
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0x1)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0x4)
FINSI
SI ( ((caract1_660004642 == 0)&&(caract2_660004642==1)) || ((caract1_660004642 == 8)&&(caract2_660004642==1)) )
ALORS
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0x2)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0x1)
FINSI
SI ( ((caract1_660004642 == 2)&&(caract2_660004642==1)) || ((caract1_660004642 == 0xA)&&(caract2_660004642==1)) )
ALORS
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0x4)
	erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0x1)
FINSI

#normalisation de g_iartout4 avec automate GPRS vers g_iartout
#erreur = i_dup_chp_rnisGSM(g_iartout4, g_iartout,$Ttap310ZB_GPRS::MSISDN,$Tdpvgsm::MSISDN, -$NORM:GPRS,0)

#####################################################################
# Traitement des champs CAMEL
#
#####################################################################

# Les champs Camel ne sont present que si servicekey et callRefNb sont present
# Sinon article OK mais champs CAMEL absents
#Deb Defect 159
SI  ((i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::callRefNb)) && (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_serviceKey)))
ALORS
# Fin Def 159
	taille_callRefNb_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::callRefNb-1)
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.1","")
	erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.1","C_CallRefNum",(taille_callRefNb_660004642/2)*8)
	indice_octet_660004642 = 0


	POINT BOUCLE_CALLREFNB
	SI (indice_octet_660004642 < taille_callRefNb_660004642)
	ALORS
		caract_660004642 = i_get_fieldtab_char_660004265(g_iartin,$Ttap310ZB_GPRS::callRefNb,indice_octet_660004642)
		#caract = i_get_art_fieldtab(g_iartin,$Ttap310ZB_GPRS::callRefNb,indice_octet)
		SI ((caract_660004642 >= 0x30) && (caract_660004642 <= 0x39))
		ALORS
			erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::C_CallRefNum,indice_octet_660004642,caract_660004642-0x30)
		SINON
			SI ((caract_660004642 >= 0x61) && (caract_660004642 <= 0x66))
			ALORS
				erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::C_CallRefNum,indice_octet_660004642,caract_660004642-0x61+0xA)
			SINON
				SI ((caract_660004642 >= 0x41) && (caract_660004642 <= 0x46))
				ALORS
					erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::C_CallRefNum,indice_octet_660004642,caract_660004642-0x41+0xA)
				SINON
					trace("Ttap310ZB_GPRS :Erreur duplication champ C_CallRefNum digit incorrect")
					ERREUR_660004642 = ERR_DUPL_660004642
					code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
					erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "C_CallRefNum", 0)
					SAUT STOCKE_ERRONE
				FINSI
			FINSI
		FINSI
		indice_octet_660004642 = indice_octet_660004642 + 1
		SAUT BOUCLE_CALLREFNB
	FINSI

	SI ( erreur_660004642 != 0)
	ALORS
		trace("Ttap310ZB_GPRS :Erreur duplication champ callRefNb")
		ERREUR_660004642 = ERR_DUPL_660004642
		code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
		erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "C_CallRefNum", 0)
		SAUT STOCKE_ERRONE
	FINSI

	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::mscAddress))
	ALORS
		taille_mscAddr_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::mscAddress-1)

		SI (taille_mscAddr_660004642 < 9)
		ALORS
			taille_mscAddress_660004642 = taille_mscAddr_660004642
		SINON
			taille_mscAddress_660004642 = 9
		FINSI

		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.2","")
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.2","C_MSCAddress",taille_mscAddress_660004642*8)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_MSCAddress,g_iartin.mscAddress[],taille_mscAddress_660004642)

		SI ( erreur_660004642 != 0)
		ALORS
			trace("Ttap310ZB_GPRS :Erreur duplication champ mscAddress")
			ERREUR_660004642 = ERR_DUPL_660004642
			code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
			erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "mscAddress", 0)
			SAUT STOCKE_ERRONE
		FINSI
	FINSI

	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_serverAddr))
	ALORS
		taille_srvAddr_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_serverAddr-1)

		SI (taille_srvAddr_660004642 < 9)
		ALORS
			taille_serverAddr_660004642 = taille_srvAddr_660004642
		SINON
			taille_serverAddr_660004642 = 9
		FINSI
		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.3","")
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.3","C_SrvAddress1",taille_serverAddr_660004642*8)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_SrvAddress1,g_iartin.C_serverAddr[],taille_serverAddr_660004642)
		SI ( erreur_660004642 != 0)
		ALORS
			trace("Ttap310ZB_E :Erreur duplication champ C_serverAddr")

			ERREUR_660004642 = ERR_DUPL_660004642
			code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
			erreur_660004642=i_PlvMessEmettre(8070, 2, g_iartin ,"" , 2, code_rejet_660004642, "C_serverAddr", 0)
			SAUT STOCKE_ERRONE
		FINSI
	FINSI

	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_DestNumber))
	ALORS
		taille_DestNum_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_DestNumber-1)

		SI (taille_DestNum_660004642 < 9)
		ALORS
			taille_DestNumber_660004642 = taille_DestNum_660004642
		SINON
			taille_DestNumber_660004642 = 9
		FINSI

		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.4","")
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.4","C_DestNum1",taille_DestNumber_660004642*8)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_DestNum1,g_iartin.C_DestNumber[],taille_DestNumber_660004642)

		SI ( erreur_660004642 != 0)
		ALORS
			trace("Ttap310ZB_GPRS :Erreur duplication champ C_DestNumber")
			ERREUR_660004642 = ERR_DUPL_660004642
			code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
			erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "C_DestNum1", 0)
			SAUT STOCKE_ERRONE
		FINSI
	FINSI

	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.5","")

	erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_Key1,i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_serviceKey))
	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_servLevel))
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_Level1,i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_servLevel))
	SINON
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_Level1,0xF)
	FINSI
	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_initCFInd))
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_initCFInd))
	SINON
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,0xF)
	FINSI
	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_defCallHand))
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_DefChInd1,i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_defCallHand))
	SINON
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_DefChInd1,0xF)
	FINSI
	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::C_modifList))
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_Modif1,i_get_art_field(g_iartin,$Ttap310ZB_GPRS::C_modifList))
	SINON
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::C_Modif1,0xF)
	FINSI

	SI ( erreur_660004642 != 0)
	ALORS
		trace("Ttap310ZB_GPRS :Erreur duplication champs Camels")
		ERREUR_660004642 = ERR_DUPL_660004642
		code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
		erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "C_Modif1", 0)
		SAUT STOCKE_ERRONE
	FINSI

	SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::CseInfo))
	ALORS
		taille_CseInfo_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::CseInfo-1)
		# QC521
		#taille_CseInfo=taille_CseInfo*2
		# /QC521
		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.6","")
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.6","C_CSEInfo1",taille_CseInfo_660004642)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_CSEInfo1,g_iartin.CseInfo[],taille_CseInfo_660004642)

		SI ( erreur_660004642 != 0)
		ALORS
			trace("Ttap310ZB_GPRS :Erreur duplication champs CseInfo")
			ERREUR_660004642 = ERR_DUPL_660004642
			code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
			erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "CseInfo", 0)
			SAUT STOCKE_ERRONE
		FINSI
	FINSI

########################################################
# Mise a jour du champ V4t18.7  C_AccPtNameNI
#########################################################


	SI(i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::accPtNameNI))
	ALORS
		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.7","")
		taille_AccessPtName_660004642 =i_get_art_field(g_iartin, $Ttap310ZB_GPRS::accPtNameNI-1)
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.7","C_AccPtNameNI",taille_AccessPtName_660004642)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_AccPtNameNI,g_iartin.accPtNameNI[],taille_AccessPtName_660004642)
	FINSI

########################################################
# Mise a jour du champ V4t18.8  C_AccPtNameOI
#########################################################

	SI(i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::accPtNameOI))
	ALORS
		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t18.8","")
		taille_AccessPtName_660004642 =i_get_art_field(g_iartin, $Ttap310ZB_GPRS::accPtNameOI-1)
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t18.8","C_AccPtNameOI",taille_AccessPtName_660004642)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_AccPtNameOI,g_iartin.accPtNameOI[],taille_AccessPtName_660004642)
	FINSI
#Deb Defect 159
FINSI
#Fin Defect 159
#####################################################################
# Fin de MAJ des champs CAMEL V4t18.1 a V4t18.8
#####################################################################

#####################################################################
# MAJ des champs V4t20.x
#####################################################################

############################################
#T4t20.1/V4t20.1
#PDPaddr
# G3R1lot1 prise en compte IPV6 fonction 101
############################################
nb_sep_660004642=0
indice_octet_660004642=0

# lorsque la fonction conversion 101 sera OK supprimer les lignes suivantes jusqu'a "fin suppression"
SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::PdpAddress))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.1","")
	taille_PdpAddress_660004642=i_get_art_field(g_iartin, $Ttap310ZB_GPRS::PdpAddress-1)
	SI (taille_PdpAddress_660004642 > 16)
	ALORS
# IPV6, la fonction 101 n'a pas fonctionnee normalement. PdpAddress contient des multiples ::
# dans ce cas fct 101 = fct 0 (pas de conversion)
# recherche nb de paires nulles 0x0000 = nb_0000
		POINT PDPADD1
		SI (indice_octet_660004642 < taille_PdpAddress_660004642)
		ALORS
			res_660004642=g_iartin.PdpAddress[indice_octet_660004642]
			SI (res_660004642 == 0x3A)
			ALORS
				nb_sep_660004642 = nb_sep_660004642 + 1
			FINSI
			indice_octet_660004642=indice_octet_660004642 + 1
			SAUT PDPADD1
		FINSI
		nb_0000_660004642 = 8 - nb_sep_660004642

		indice_octet_660004642=0
		indice_res_660004642 = 0
		res_660004642 = 0

# duplication vers le champ PDPaddr du Tdpvgsm
		POINT PDPADD2
		resT_660004642 = 0
		SI (indice_octet_660004642 < taille_PdpAddress_660004642 && indice_res_660004642 < 16)
		ALORS
			POINT PDPADD3
			res_660004642 = g_iartin.PdpAddress[indice_octet_660004642]
			SI (res_660004642 != 0x3A && indice_octet_660004642 < taille_PdpAddress_660004642)
			ALORS
				SI (res_660004642 >= 0x30 && res_660004642 <= 0x39)
				ALORS
					resT_660004642= resT_660004642 * 0x10 + (res_660004642 - 0x30)
				SINON
					SI (res_660004642 >= 0x41 && res_660004642 <= 0x46)
					ALORS
						resT_660004642= resT_660004642 * 0x10 + (res_660004642 - 0x37)
					SINON
						SI (res_660004642 >= 0x61 && res_660004642 <= 0x66)
						ALORS
							resT_660004642= resT_660004642 * 0x10 + (res_660004642 - 0x57)
						SINON
							ERREUR_660004642 = ERR_DISTR_660004642
							code_rejet_660004642 = MODULE_660004642 + ERREUR_660004642 + EFFICACE_660004642
							erreur_660004642=i_PlvMessEmettre(8910, 2, g_iartin ,"" , 2, code_rejet_660004642, "PDPaddr", 0)
							SAUT STOCKE_ERRONE
						FINSI
					FINSI
				FINSI
				indice_octet_660004642=indice_octet_660004642 + 1
				SAUT PDPADD3
			SINON
				g_iartout.PDPaddr[indice_res_660004642]= resT_660004642 / 0x100
				indice_res_660004642 = indice_res_660004642 + 1
				g_iartout.PDPaddr[indice_res_660004642]= resT_660004642 - ((resT_660004642 / 0x100) * 0x100)
				indice_res_660004642 = indice_res_660004642 + 1
				resT_660004642 = 0

				res_660004642 = g_iartin.PdpAddress[indice_octet_660004642 + 1]
				SI (res_660004642 != 0x3A)
				ALORS
					indice_octet_660004642=indice_octet_660004642 + 1
					SAUT PDPADD2
				SINON
					# cas double ::
					POINT PDPADD4
					SI (nb_0000_660004642 > 0)
					ALORS
						nb_0000_660004642 = nb_0000_660004642 -1
						g_iartout.PDPaddr[indice_res_660004642]= 0x00
						indice_res_660004642 = indice_res_660004642 + 1
						g_iartout.PDPaddr[indice_res_660004642]= 0x00
						indice_res_660004642 = indice_res_660004642 + 1
						SAUT PDPADD4
					SINON
						indice_octet_660004642=indice_octet_660004642 + 2
						SAUT PDPADD2
					FINSI
				FINSI
			FINSI
		FINSI
	SINON
# cas normal, la conversion par la fonction 101 est OK
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.1","PDPaddr",taille_PdpAddress_660004642)
		erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PDPaddr,g_iartin.PdpAddress[],taille_PdpAddress_660004642)
	FINSI
FINSI
# fin suppression

#############################################
# T4t20.2/V4t20.2
# accPointName3
#############################################

SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::AccessPtNamNI))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.2", "")
	taille_AccessPtName_660004642=i_get_art_field(g_iartin,$Ttap310ZB_GPRS::AccessPtNamNI-1)
	erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.2","accPointName3",taille_AccessPtName_660004642)
	erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::accPointName3,g_iartin.AccessPtNamNI[],taille_AccessPtName_660004642)
FINSI

#############################################
# T4t20.3/V4t20.3
# accPointName4
#############################################

SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::AccessPtNamOI))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.3", "")
	taille_AccessPtName_660004642=i_get_art_field(g_iartin,$Ttap310ZB_GPRS::AccessPtNamOI-1)
	erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.3","accPointName4",taille_AccessPtName_660004642)
	erreur_660004642 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::accPointName4,g_iartin.AccessPtNamOI[],taille_AccessPtName_660004642)
FINSI

#############################################
# T4t20.4/V4t20.4
# chargingID
#############################################

SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::ChargingId))
ALORS
	erreur_660004642=i_ajout_tlv(g_iartout,"T4t20.4","")
	ChargingId_660004642 = i_get_art_field(g_iartin,$Ttap310ZB_GPRS::ChargingId)
	erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::chargingID,ChargingId_660004642)
FINSI

###########################################################
# T4t20.5 , T4t20.6
# SeqNum
# PartialType
#############################################################

SI (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::PartialTypeInd))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.5","")
	erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.6","")

	erreur_660004642 = i_get_field_str(g_iartin,"PartialTypeInd",pt_PartialTypeInd_660004642)
	SI (i_strcmp(pt_PartialTypeInd_660004642,"L")==0)
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::SeqNum,0x02)
	SINON
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::SeqNum,0x01)
	FINSI

	SI (i_strcmp(pt_PartialTypeInd_660004642,"F")==0)
	ALORS
		erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::PartialType,0x01)
	SINON
		SI(i_strcmp(pt_PartialTypeInd_660004642,"I")==0)
		ALORS
			erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::PartialType,0x02)
		SINON
			erreur_660004642 = i_set_art_field(g_iartout,$Tdpvgsm::PartialType,0x03)
		FINSI
	FINSI
FINSI

################################################
# T4t20.7 T4t20.8
# RecEntId1 RecEntId2
##################################################

# G2R2 : concatenation adresses IPV4 et IPV6
erreur_660004642=i_get_field_str(g_iartin,"RecGSNCum",pt_RecodeGSN1_660004642)
erreur_660004642=i_get_field_str(g_iartin,"RecGSNCumIPV6",pt_RecodeGSN2_660004642)
erreur_660004642=i_format_str2(pt_RecodeGSN_660004642, "%s%s", pt_RecodeGSN1_660004642, pt_RecodeGSN2_660004642)

erreur_660004642=i_get_field_str(g_iartin,"recEntityTypCum",pt_RecodeTYPE_660004642)

recEntitycode1_660004642=i_get_art_field(g_iartin,$Ttap310ZB_GPRS::RecEntCode1)
recEntitycode2_660004642=i_get_art_field(g_iartin,$Ttap310ZB_GPRS::RecEntCode2)

### Appel a la fonction getGSNAdress
nb_pass_660004642 = 1
v4t207_maj_660004642 = 0
v4t208_maj_660004642 = 0

nb_resultat_660004642 = getGSNAdress_660004265(pt_RecodeGSN_660004642, pt_RecodeTYPE_660004642, recEntitycode1_660004642, recEntitycode2_660004642 , pt_GSNres1_660004642, pt_GSNres2_660004642, pt_TYPEres1_660004642, pt_TYPEres2_660004642)

SI(nb_resultat_660004642!=0)
ALORS
	POINT MAJ_VQUATREt20
	SI(nb_pass_660004642 ==1)
	ALORS
		i_strcpy(pt_GSNres_660004642,pt_GSNres1_660004642)
		i_strcpy(pt_TYPEres_660004642,pt_TYPEres1_660004642)
	SINON
		i_strcpy(pt_GSNres_660004642,pt_GSNres2_660004642)
		i_strcpy(pt_TYPEres_660004642,pt_TYPEres2_660004642)
	FINSI
	erreur_660004642 = i_ConvertirChaine(pt_GSNres_660004642,i_strlen(pt_GSNres_660004642),3,pt_GSNres_hex_660004642,i_strlen(pt_GSNres_660004642),1)
# Deb Defect 160 suppression des points des @IPV4 et conversion hexa
	SI ((i_strtab(pt_GSNres_hex_660004642,1)!=0x2E) &&(i_strtab(pt_GSNres_hex_660004642,2)!=0x2E) && (i_strtab(pt_GSNres_hex_660004642,3)!=0x2E))
	ALORS
		SAUT IPV6
	SINON
		i_get_sub_str(pt_GSNres_hex_660004642,0,i_strlen(pt_GSNres_660004642)/2-1,pt_GSNres_hex_660004642)
		erreur_660004642 = i_recupererValeur(pt_GSNres_hex_660004642,pt_res_660004642,20,'.')
		SI(erreur_660004642==0)
		ALORS
			chToEntier1_660004642 = toInteger_660004265(pt_res_660004642)
			erreur_660004642 = i_recupererValeur(pt_GSNres_hex_660004642,pt_res2_660004642,20,'.')
			SI(erreur_660004642==0)
			ALORS
				chToEntier2_660004642 = toInteger_660004265(pt_res2_660004642)
				erreur_660004642 = i_recupererValeur(pt_GSNres_hex_660004642,pt_res3_660004642,20,'.')
				SI(erreur_660004642==0)
				ALORS
					chToEntier3_660004642 = toInteger_660004265(pt_res3_660004642)
					erreur_660004642 = i_recupererValeur(pt_GSNres_hex_660004642,pt_res4_660004642,20,'.')
					SI(erreur_660004642==0)
					ALORS
						chToEntier4_660004642 = toInteger_660004265(pt_res4_660004642)
#DRE 17/02/09 G2R2 lot 1
#                                               SI((i_strcmp(pt_TYPEres,"4")==0)&&(!v4t207_maj))
						SI((i_strcmp(pt_TYPEres_660004642,"3")==0)&&(!v4t207_maj_660004642))
						ALORS
							erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.7", "")
							erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.7","RecEntId1",4)
							erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId1,0,chToEntier1_660004642)
							erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId1,1,chToEntier2_660004642)
							erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId1,2,chToEntier3_660004642)
							erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId1,3,chToEntier4_660004642)
							v4t207_maj_660004642 = 1
						SINON
#DRE 17/02/09 G2R2 lot 1
							SI((i_strcmp(pt_TYPEres_660004642,"4")==0)&&(!v4t208_maj_660004642))
							ALORS
								erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.8", "")
								erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.8","RecEntId2",4)
								erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId2,0,chToEntier1_660004642)
								erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId2,1,chToEntier2_660004642)
								erreur_660004642= i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId2,2,chToEntier3_660004642)
								erreur_660004642 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::RecEntId2,3,chToEntier4_660004642)
								v4t208_maj_660004642 = 1
							FINSI
						FINSI
						#SAUT  Suite_V4t20_10
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
	nb_pass_660004642 = nb_pass_660004642 +1
	SI(nb_pass_660004642 == nb_resultat_660004642)
	ALORS
		SAUT MAJ_VQUATREt20
	SINON
		SAUT Suite_V4t20_10
	FINSI

	POINT IPV6
# DRE 11/02/09 G2R2 lot1
	SI((i_strcmp(pt_TYPEres_660004642,"3")==0)&&(!v4t207_maj_660004642))
	ALORS
#Defect 175
		erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.7", "")
		erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.7","RecEntId1",16)
		erreur_660004642 = FormatIPV6_Hex_660004265(pt_GSNres_660004642,g_iartout,$Tdpvgsm::RecEntId1)
		v4t207_maj_660004642 =1
	SINON
# DRE 11/02/09 G2R2 lot1
		SI((i_strcmp(pt_TYPEres_660004642,"4")==0)&&(!v4t208_maj_660004642))
		ALORS
#Defect 175
			erreur_660004642 = i_ajout_tlv(g_iartout,"T4t20.8", "")
			erreur_660004642 = i_resize_tlv(g_iartout,"T4t20.8","RecEntId2",16)
			erreur_660004642 = FormatIPV6_Hex_660004265(pt_GSNres_660004642,g_iartout,$Tdpvgsm::RecEntId2)
			v4t208_maj_660004642 =1
		FINSI
	FINSI
	nb_pass_660004642 = nb_pass_660004642 +1
	SI(nb_pass_660004642 == nb_resultat_660004642)
	ALORS
		SAUT MAJ_VQUATREt20
	FINSI
FINSI

#Deb Def 160
POINT Suite_V4t20_10
#Fin Def 160
################################################
# T4t20.10
# totVolOut totVolIn
##################################################
#QC203
erreur_660004642 = i_cree_art("Conv_URS",g_iartout9)

SI((i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::DataVolumeOut))&& (i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::DataVolumeIn)))
ALORS
	erreur_660004642=i_ajout_tlv(g_iartout,"T4t20.10", "")
FINSI

SI(i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::DataVolumeOut))
ALORS
	erreur_660004642 = i_set_art_field(g_iartout9, $Conv_URS::DataVolumexx, i_get_art_field(g_iartin,$Ttap310ZB_GPRS::DataVolumeOut))
	erreur_660004642 = i_dup_chp_1val(g_iartout9, g_iartout,$Conv_URS::totVolxx, $Tdpvgsm::totVolOut)
FINSI

SI(i_valid_field_n(g_iartin,$Ttap310ZB_GPRS::DataVolumeIn))
ALORS
	erreur_660004642 = i_set_art_field(g_iartout9, $Conv_URS::DataVolumexx, i_get_art_field(g_iartin,$Ttap310ZB_GPRS::DataVolumeIn))
	erreur_660004642 = i_dup_chp_1val(g_iartout9, g_iartout,$Conv_URS::totVolxx, $Tdpvgsm::totVolIn)
FINSI



#####################################################################
# Fin de MAJ des champs V4t20.x
#####################################################################

erreur_660004642 = i_maj_ila(g_iartout)

#####################################################################
# Mise a jour 'date d'entree dans le CE' + 'EEC'
# g_ibloc_date mis a jour dans Pcode Txxha ou trait_pla_file_bloc()
#####################################################################
# QC1331
#erreur=set_timeInCE_EEC(0)
########### Date_Audit
erreur_660004642 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004642 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004642 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

# Ajout des T3t55 et T3t56
SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GFlag2))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T3t55","")
FINSI

SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GValue))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T3t56","")
FINSI

SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GretaTag))
ALORS
	erreur_660004642 = i_ajout_tlv(g_iartout,"T3t99","")
FINSI

erreur_660004642 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_INCONNU_660004642, Multidistribution_Non_660004642)
SI (erreur_660004642 == TRAI_KO_660004642)
ALORS
# QC1005
	trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
#	ERREUR = ERR_DISTR
#	code_rejet = MODULE + ERREUR + EFFICACE
#	erreur=i_PlvMessEmettre(8911, 2, g_iartin ,"" , 1, code_rejet, 0, 0)
	SAUT STOCKE_ERRONE
FINSI

trace("Ttap310ZB_GPRS : Fin Distribution OK")
RETOUR TRAIT_OK

POINT STOCKE_ERRONE
trace( "Fin Distribution Stockage de l'article en ERRONE" )
erreur_660004642 = i_make_art_rej(g_iartin, g_iartout11, code_rejet_660004642)
erreur_660004642 = i_stocke_art(g_iartout11, 0, PT_ERRONE, 0)
RETOUR TRAIT_OK
#--------------------------- Ttap310ZB_GPRS_dis.src -------------------------------
