DEFINITION Multidistribution_Non_660004632 0
DEFINITION DISTRIBUTION_INCONNU_660004632 1
DEFINITION TRAI_KO_660004632 -1
REGISTRE ENTIER erreur_660004632
REGISTRE ENTIER code_rejet_660004632
REGISTRE ENTIER date_DC_660004632
REGISTRE ENTIER RecordType_660004632
REGISTRE ENTIER successindic_660004632
REGISTRE ENTIER oiwtype_660004632
REGISTRE ENTIER diwtype_660004632
REGISTRE ENTIER indice_660004632
REGISTRE ENTIER res_660004632
REGISTRE ENTIER cntnbtext_660004632
REGISTRE ENTIER cntnbaudio_660004632
REGISTRE ENTIER cntnbimage_660004632
REGISTRE ENTIER cntnbvideo_660004632
REGISTRE ENTIER cntnbother_660004632
REGISTRE ENTIER flag_rdt_660004632
REGISTRE ENTIER taille_Oaddr_660004632
REGISTRE ENTIER taille_Daddr_660004632
REGISTRE ENTIER taille_Oaddr2_660004632
REGISTRE ENTIER taille_Daddr2_660004632
REGISTRE ENTIER taille_660004632
REGISTRE ENTIER taille2_660004632
REGISTRE ENTIER flag00_660004632
REGISTRE ENTIER b_MailOaddr_660004632
REGISTRE ENTIER b_MailDaddr_660004632
REGISTRE POINTEUR pt_1_660004632
REGISTRE POINTEUR pt_2_660004632
REGISTRE POINTEUR pt_Oaddr_660004632
REGISTRE POINTEUR pt_Daddr_660004632
REGISTRE POINTEUR pt_val_idemet_660004632
############################################################################
# DISTRIBUTION TmmscNsn_dis.src
#	Article Article : CDR de bloc du TMMSC-NSN en entree de Platine
#	Pcode de distribution
#	Creation le 305/04/2011 pour la G3R3 lot3
#
# TYPE_MMSOM	48 0x30
# TYPE_MMSTM	49 0x31
# TYPE_MM3OR	50 0x32
# TYPE_MM3RR	51 0x33
# TYPE_MM4OR	52 0x34
# TYPE_MM4RR	53 0x35
# TYPE_MM7OR	54 0x36
# TYPE_MM7RR	55 0x37
#
# Historique
#  05/04/2011 DECI -JLG- G3R3 lot3 item remplacement du MMS-C
#  01/06/2011 DECI -JLG- G3R3 lot3 QC875 format mail + valeur limite V4t35.3
#  03/06/2011 DECI -JLG- G3R3 lot3 QC877 format MSISDN (octet FF final)
#  08/06/2011 DECI -JLG- G3R3 lot3 QC886 V4t35.2=RECIPIENT_RANGE+1
#  10/06/2011 DECI -JLG- G3R3 lot3 QC875 participantsNb
#  28/09/2011 DECI -JLG- G3R4 Changement alarme 8188 (fait partie de NOKIA) par nouvelle alarme 6409 de MMSC_NSN
#  03/02/2012 DECI -JLG- G3R5 lot2 QC1006 : retour arriere QC1003
#  29/02/2012 DECI -JLG -G3R6 QC1005 modif alarme retour aiguillage
#  10/01/2013 DECI -JLG -G3R9 lot1 Differenciation Idemet MMS-Nokia
# 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
############################################################################




pt_1_660004632 = "pt_1_11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
pt_2_660004632 = "pt_2_22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
pt_Oaddr_660004632 = "pt_Oaddr_3333333333333333333333333333333333333333333333333333333333333333333333333"
pt_Daddr_660004632 = "pt_Daddr_4444444444444444444444444444444444444444444444444444444444444444444444444"
pt_val_idemet_660004632 = "pt_val_idemet666666666666666666666666"

trace("<<<__LINE__<<<__FILE__<<< ====== Debut du pcode de DISTRIBUTION =========")

# i_strcpy(pt_1,"") , realise plus bas
# i_strcpy(pt_2,"") , realise plus bas
i_strcpy(pt_Oaddr_660004632,"")
i_strcpy(pt_Daddr_660004632,"")
#i_strcpy(pt_val_idemet,"") , realise plus bas


## Creation article Conv_URS (g_iartout9)
#erreur = i_cree_art("Conv_URS",g_iartout9)

# Creation article Conversion (g_iartout8)
#erreur = i_cree_art("Conversion",g_iartout8)


# DATE_DC (date_DC extraite du champ Loggingtime decompose en LoggingT et LoggingSiecle)
date_DC_660004632 = i_get_art_field(g_iartin, $TmmscNsn::ddebut)
#res = -1
#indiceSource = 6
#indiceRes = 0
#POINT BOUCLE_DATE
#SI (indiceSource > -1)
#ALORS
#	quartet1=i_get_art_fieldtab(g_iartin,$TmmscNsn::LoggingT, indiceSource * 2)
#	quartet2=i_get_art_fieldtab(g_iartin,$TmmscNsn::LoggingT, (indiceSource * 2) + 1)
#	erreur=i_set_art_fieldtab(g_iartout8, $Conversion::DATE, (indiceRes * 2), quartet1)
#	erreur=i_set_art_fieldtab(g_iartout8, $Conversion::DATE, (indiceRes * 2) + 1, quartet2)
#	indiceSource = indiceSource - 1
#	indiceRes = indiceRes + 1
#	SAUT BOUCLE_DATE
#FINSI
#res = -1
#res = i_get_art_field(g_iartout8, $Conversion::DATEN)
#date_DC = i_DHgetLocalTime(4, 7, res)

########################################################
# Cpt applicatif CPT_RDT=1509 (REDISTRIBUTION)
########################################################
# comptabilisation des CRAs issus de la redistribution
# date_fin = date_debut car duree = 0
erreur_660004632= i_incr_redist_dist_660004265(date_DC_660004632)


##################################################################################
# E_Redistri2 : Enveloppe optionnelle
# flag_rdt : nb de passage en redistribution (lecture de l'enveloppe obligatoire)
##################################################################################
flag_rdt_660004632 = -1
flag_rdt_660004632 = i_LireRedistCpt()

SI (flag_rdt_660004632 == 0)
ALORS
	erreur_660004632 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004632 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

####################################################################
#	duplication du g_iartin (TmmscNsn) vers format pivot Tdpvgsm (g_iartout)
####################################################################
erreur_660004632 = i_dup_art_tab(g_iartin,g_iartout,"Tdpvgsm")
#trace("<<<__LINE__<<<__FILE__<<< [TmmscNsn_dis] **** duplication DPV 3.3 ****")

SI (erreur_660004632 != 0)
ALORS
	trace("<<<__LINE__<<<__FILE__<<< [TmmscNsn_dis] Erreur de duplication")
	code_rejet_660004632 = 0xA000 + 0x0D0 + 1
	erreur_660004632=i_PlvMessEmettre(6400, 2 , g_iartin ,"", 2, code_rejet_660004632,"Tdpvgsm", 0)
	SAUT STOCKE_ERRONE
FINSI

####################################################################
#	Mise a jour des champs Tdpvgsm (g_iartout)
####################################################################

# V3t1.1 type	:-	:-	:CSTE:00 (RecordType) ok
successindic_660004632 = i_get_art_field(g_iartin, $TmmscNsn::SuccessIndic)
oiwtype_660004632 = i_get_art_field(g_iartin, $TmmscNsn::Oiwtype)
diwtype_660004632 = i_get_art_field(g_iartin, $TmmscNsn::Diwtype)

SI (successindic_660004632 == 128)
ALORS
	SI (oiwtype_660004632 == 0)
	ALORS
		RecordType_660004632 = 0x30
	SINON
		SI (oiwtype_660004632 == 471)
		ALORS
			RecordType_660004632 = 0x32
		SINON
			SI (oiwtype_660004632 == 451)
			ALORS
				RecordType_660004632 = 0x34
			SINON
				SI (oiwtype_660004632 / 100 == 7)
				ALORS
					RecordType_660004632 = 0x36
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

SI (successindic_660004632 == 134 || successindic_660004632 == 132 || successindic_660004632 == 135 || successindic_660004632 == 302 || successindic_660004632 == 308)
ALORS
	SI (diwtype_660004632 == 0)
	ALORS
		RecordType_660004632 = 0x31
	SINON
		SI (diwtype_660004632 == 470)
		ALORS
			RecordType_660004632 = 0x33
		SINON
			SI (diwtype_660004632 == 450)
			ALORS
				RecordType_660004632 = 0x35
			SINON
				SI (diwtype_660004632 / 100 == 7)
				ALORS
					RecordType_660004632 = 0x37
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::type, RecordType_660004632)


# V3t1.2  tentite	:D	:D	:CSTE:02

# V3t1.3  idemet	:D	:D	:MSET:FF:9	ok
# G3R9 lot1
i_strcpy(pt_val_idemet_660004632, "")
i_strcpy(pt_1_660004632,"")
i_strcpy(pt_2_660004632,"")

i_strcpy (pt_1_660004632, i_LireEECSGTQS(g_ieec))
erreur_660004632 = i_format_str2(pt_2_660004632, "%s%s", "AX_IDEMET_", pt_1_660004632)
trace2("<<<__LINE__<<<__FILE__<<< --------- SGTQS=<%s>, cle idemet=<%s> -----------", pt_1_660004632, pt_2_660004632)
i_strcpy(pt_val_idemet_660004632,i_get_tab_field("VariableContexte", date_DC_660004632, pt_2_660004632))
trace2("<<<__LINE__<<<__FILE__<<< pt_val_idemet=<%s>", pt_val_idemet_660004632, "")
SI (i_strcmp( pt_val_idemet_660004632,g_inull) != 0)
ALORS
	erreur_660004632 = affectation_tab_660004265(g_iartout,$Tdpvgsm::idemet,pt_val_idemet_660004632)
SINON
	erreur_660004632 = affectation_tab_660004265(g_iartout,$Tdpvgsm::idemet,"33052000000FFFFFFF")
FINSI


# V3t1.4  IMSI		:D	:D	:MSET:99:8	vu
# Ex dans g_iartin : 333336343838363233383400FFFFFFFFFFFFFFFFFF
i_strcpy(pt_1_660004632,"")
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigImsi, 0) != 0x00)
	ALORS
		erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::OrigImsi, pt_1_660004632)
		SI (!i_strplcmp(pt_1_660004632,"393939393939393939393939393939", 0, 30))
		ALORS
#   			la table de duplication initialise a 9999999999999999
#   			on ajoute le F final pour etre conforme au format IMSI
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xF)
		SINON
			indice_660004632 = 0
			flag00_660004632 = 0
			POINT BOUCLE_IMSI1
			SI (indice_660004632 < 16)
			ALORS
				SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigImsi, indice_660004632) != 0x00 && i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigImsi, indice_660004632) != 0xFF && flag00_660004632 != 1)
				ALORS
					erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::IMSI, indice_660004632, i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigImsi,indice_660004632) - 0x30)
					indice_660004632 = indice_660004632 + 1
					SAUT BOUCLE_IMSI1
				SINON
					flag00_660004632 = 1
					erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI, indice_660004632, 0xF)
					indice_660004632 = indice_660004632 + 1
					SAUT BOUCLE_IMSI1
				FINSI
			FINSI
		FINSI
	SINON
#   			la table de duplication initialise a 9999999999999999
#   			on ajoute le F final pour etre conforme au format IMSI
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI, 15, 0xF)
	FINSI
FINSI

SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
ALORS
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::DestImsi, 0) != 0x00)
	ALORS
		erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::DestImsi, pt_1_660004632)
		SI (!i_strplcmp(pt_1_660004632,"393939393939393939393939393939", 0, 30))
		ALORS
#   			la table de duplication initialise a 9999999999999999
#   			on ajoute le F final pour etre conforme au format IMSI
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI, 15, 0xF)
		SINON
			indice_660004632 = 0
			flag00_660004632 = 0
			POINT BOUCLE_IMSI3
			SI (indice_660004632 < 16)
			ALORS
				SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::DestImsi, indice_660004632) != 0x00 && i_get_art_fieldtab(g_iartin,$TmmscNsn::DestImsi, indice_660004632) != 0xFF && flag00_660004632 != 1)
				ALORS
					erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::IMSI, indice_660004632, i_get_art_fieldtab(g_iartin,$TmmscNsn::DestImsi,indice_660004632) - 0x30)
					indice_660004632 = indice_660004632 + 1
					SAUT BOUCLE_IMSI3
				SINON
					flag00_660004632 = 1
					erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI, indice_660004632, 0xF)
					indice_660004632 = indice_660004632 + 1
					SAUT BOUCLE_IMSI3
				FINSI
			FINSI
		FINSI
	SINON
#   			la table de duplication initialise a 9999999999999999
#   			on ajoute le F final pour etre conforme au format IMSI
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI, 15, 0xF)
	FINSI
FINSI


# V3t1.5  DATE	:-	:-	:MSET:11:7 (DATE_DC, date_DC)
erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_DC_660004632)


# V3t1.6   DUREE		:D	:D	:1VAL :MsgSize
# V3t1.7   svcsup		:-	:-	:MSET:FF:1
# V3t1.7   tlserv		:-	:-	:MSET:FF:1
erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0xE0 + (0x0F & RecordType_660004632))


# V3t1.7   support1	:-	:-	:MSET:FF:1
# V3t1.7   systype	:-	:-	:MSET:FF:1
# V3t1.7   reserve2	:-	:-	:MSET:FF:1
# V3t1.7   origine	:-	:-	:MSET:FF:1
# V3t1.7   indeff		:-	:-	:CSTE:00
# calcule plus haut : successindic = i_get_art_field(g_iartin, $TmmscNsn::SuccessIndic)
SI (successindic_660004632 == 128 || successindic_660004632 == 134)
ALORS
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::indeff, 0)
SINON
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::indeff, 1)
FINSI


# V3t1.7   tterm		:-	:-	:CSTE:00
SI (successindic_660004632 == 128)
ALORS
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x21)
SINON
	SI (successindic_660004632 == 134)
	ALORS
		erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x22)
	SINON
		SI (successindic_660004632 == 135)
		ALORS
			erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x23)
		SINON
			SI (successindic_660004632 == 132)
			ALORS
				erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x29)
			FINSI
		FINSI
	FINSI
FINSI


# V3t1.7   indtax		:-	:-	:MSET:FF:1
# V3t1.7   nbUT			:-	:-	:MSET:FF:4
# V3t1.7   chgcar		:-	:-	:MSET:FF:2
# V3t1.7   couleur	:-	:-	:MSET:FF:1


# calcul taille reelle de Oaddr (jusqu' a l'octet 0x00) et detection format mail
erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::Oaddr, pt_Oaddr_660004632)
#trace2("<<<__LINE__<<<__FILE__<< Oaddr=<%s>",pt_Oaddr,"")
taille_660004632=i_strlen(pt_Oaddr_660004632)
indice_660004632 = 0
#QC875
b_MailOaddr_660004632 = 0
POINT Boucle_OaddrLg
SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_Oaddr_660004632,"00", indice_660004632, 2) != 0)
ALORS
	SI (i_strplcmp(pt_Oaddr_660004632,"40", indice_660004632, 2) == 0)
	ALORS
		b_MailOaddr_660004632 = 1
	FINSI
	indice_660004632 = indice_660004632 + 2
	SAUT Boucle_OaddrLg
FINSI
taille_Oaddr_660004632 = indice_660004632
#trace1("<<<__LINE__<<<__FILE__<<< taille_Oaddr=<%d>",taille_Oaddr)

# calcul taille reelle de Daddr (jusqu' a l'octet 0x00) et detection format mail
erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::Daddr, pt_Daddr_660004632)
#trace2("<<<__LINE__<<<__FILE__<< Daddr=<%s>",pt_Daddr,"")
taille_660004632=i_strlen(pt_Daddr_660004632)
indice_660004632 = 0
b_MailDaddr_660004632 = 0
POINT Boucle_DaddrLg
SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_Daddr_660004632,"00", indice_660004632, 2) != 0)
ALORS
	SI (i_strplcmp(pt_Daddr_660004632,"40", indice_660004632, 2) == 0)
	ALORS
		b_MailDaddr_660004632 = 1
	FINSI
	indice_660004632 = indice_660004632 + 2
	SAUT Boucle_DaddrLg
FINSI
taille_Daddr_660004632 = indice_660004632
#trace1("<<<__LINE__<<<__FILE__<<< taille_Daddr=<%d>",taille_Daddr)
#/QC875

##################
# V3t2  idpart   #
##################
#Ex Oaddr : 2B33333633393439393236352F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
#Ex Daddr : 2B33333634383836323338342F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"

SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
ALORS
###########################################
# Test si cas d'un mail, QC875
###########################################
#Oaddr (email ou +num)
	SI (b_MailOaddr_660004632)
	ALORS
## anomalie interne 2938 : pas de "+.....@....." de mms-nokia pas reconduit pour MMSC-NSN
#		caract = i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,0)
#		SI (caract == 0x2B)
#		ALORS
#			trace("<<<__LINE__<<<__FILE__<<< Erreur duplication champ idpart : adresse mail commencant par +")
#			ERREUR = ERR_DUPL
#			code_rejet = MODULE + ERREUR + EFFICACE
#			erreur=i_PlvMessEmettre(8187, 2, g_iartin, "", 2, code_rejet, "idpart" , 0)
#			SAUT STOCKE_ERRONE
#		FINSI
## /anomalie interne 2938

		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		#taille_Oaddr est en nb de quartets => /2 pour avoir le nb d'octets
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		SI (taille_Oaddr2_660004632 < 19)
		ALORS
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t2","idpart", (8 * taille_Oaddr2_660004632) + 8)
		SINON
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t2","idpart", 8 * 19)
		FINSI
# on affecte au premier octet de idpart 0
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,0,0)
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,1,0)
# suivi par la valeur en ascii de Oaddr
# on recupere element par element les elements du tableau numerique(hexa) Oaddr
		taille_660004632 = taille_Oaddr2_660004632
		SI (taille_Oaddr2_660004632 > 18)
		ALORS
			taille_660004632 = 18
		FINSI
		indice_660004632 = 0
		POINT	BOUCLE_idpart_mailOaddr
		SI (indice_660004632 < taille_660004632)
		ALORS
			res_660004632 = i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632)
			# +2 et +3 car 1er octet = 0x00, res / 0x10 = quartet de poids fort de l'octet, res - (res / 0x10) * 0x10 = poids faible
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,(indice_660004632*2)+2, res_660004632 / 0x10)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,(indice_660004632*2)+3, res_660004632 - (res_660004632 / 0x10) * 0x10)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_mailOaddr
		FINSI
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::idpart, pt_1_660004632)
#		trace2("<<<__LINE__<<<__FILE__<< idpart mis a jour =<%s>",pt_1,"")
		SAUT FIN_idpart
	FINSI

###########################################
# Test si format_MSISDN (commence par +)
###########################################
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,0) == '+')
	ALORS
		taille_660004632 = taille_Oaddr_660004632
		SI (taille_Oaddr_660004632 > 39)
		ALORS
			taille_660004632 = 39
		FINSI
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		# extraction de la partie numerique de OADDR apres '+' donc indice = 1
		indice_660004632 = 1
		POINT BOUCLE_idpart_plusOaddr
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0' && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632-1, i_get_art_fieldtab(g_iartin, $TmmscNsn::Oaddr, indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_plusOaddr
		FINSI
		#QC877 : deux f a la fin du numero DCB
		res_660004632 = (indice_660004632-1) / 2
		SI ((indice_660004632-1) == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*(indice_660004632-1))
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632 -1, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*(indice_660004632-1) + 4)
		FINSI
		SAUT FIN_idpart
	FINSI

###########################################
# Test  si Format_ShortID
###########################################
# taille de la partie numerique d'Oaddr
	indice_660004632 = 0
	POINT	BOUCLE_idpart_short1Oaddr
	SI (indice_660004632 < taille_Oaddr_660004632)
	ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_short1Oaddr
		FINSI
	FINSI
# indice = taille de la partie numerique d'Oaddr

	SI (indice_660004632 <= 5 && indice_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		indice_660004632 = 0
		POINT	BOUCLE_idpart_short2Oaddr
		SI (indice_660004632 < taille_Oaddr_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_short2Oaddr
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*indice_660004632 + 4)
		FINSI
		SAUT FIN_idpart
	FINSI
	SAUT FIN_idpart
FINSI


SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS

###########################################
# Test si cas d'un mail, QC875
###########################################
	SI (b_MailDaddr_660004632)
	ALORS
## anomalie interne 2938 : pas de "+.....@....." de mms-nokia pas reconduit pour MMSC-NSN
#		caract = i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,0)
#		SI (caract == 0x2B)
#		ALORS
#			trace("<<<__LINE__<<<__FILE__<<< Erreur duplication champ idpart : adresse mail commencant par +")
#			ERREUR = ERR_DUPL
#			code_rejet = MODULE + ERREUR + EFFICACE
#			erreur=i_PlvMessEmettre(8187, 2, g_iartin, "", 2, code_rejet, "idpart" , 0)
#			SAUT STOCKE_ERRONE
#		FINSI
## /anomalie interne 2938
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		#taille_Daddr est en nb de quartets => /2 pour avoir le nb d'octets
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		SI (taille_Daddr2_660004632 < 19)
		ALORS
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t2","idpart", (8 * taille_Daddr2_660004632) + 8)
		SINON
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t2","idpart", 8 * 19)
		FINSI
# on affecte au premier octet de idpart 0
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,0,0)
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,1,0)
# suivi par la valeur en ascii de Daddr
# on recupere element par element les elements du tableau numerique(hexa) Daddr
		taille_660004632 = taille_Daddr2_660004632
		SI (taille_Daddr2_660004632 > 18)
		ALORS
			taille_660004632 = 18
		FINSI
		indice_660004632 = 0
		POINT	BOUCLE_idpart_mailDaddr
		SI (indice_660004632 < taille_660004632)
		ALORS
			res_660004632 = i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,(indice_660004632*2)+2, res_660004632 / 0x10)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,(indice_660004632*2)+3, res_660004632 - (res_660004632 / 0x10) * 0x10)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_mailDaddr
		FINSI
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::idpart, pt_1_660004632)
#		trace2("<<<__LINE__<<<__FILE__<< idpart mis a jour =<%s>",pt_1,"")
		SAUT FIN_idpart
	FINSI

###########################################
# Test si format_MSISDN (commence par +)
###########################################
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,0) == '+')
	ALORS
		taille_660004632 = taille_Daddr_660004632
		SI (taille_Daddr_660004632 > 39)
		ALORS
			taille_660004632 = 39
		FINSI
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		# extraction de la partie numerique de DADDR apres '+' donc indice = 1
		indice_660004632 = 1
		POINT BOUCLE_idpart_plusDaddr
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0' && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632-1, i_get_art_fieldtab(g_iartin, $TmmscNsn::Daddr, indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_plusDaddr
		FINSI
		#QC877 : deux f a la fin du numero DCB
		res_660004632 = (indice_660004632-1) / 2
		SI ((indice_660004632-1) == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*(indice_660004632-1))
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632 -1, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*(indice_660004632-1) + 4)
		FINSI
		SAUT FIN_idpart
	FINSI

###########################################
# Test  si Format_ShortID
###########################################
# taille de la partie numerique d'Daddr
	indice_660004632 = 0
	POINT	BOUCLE_idpart_short1Daddr
	SI (indice_660004632 < taille_Daddr_660004632)
	ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_short1Daddr
		FINSI
	FINSI
# indice = taille de la partie numerique d'Daddr
	SI (indice_660004632 <= 5 && indice_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t2","")
		indice_660004632 = 0
		POINT	BOUCLE_idpart_short2Daddr
		SI (indice_660004632 < taille_Daddr_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_idpart_short2Daddr
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t2", "idpart", 4*indice_660004632 + 4)
		FINSI
		SAUT FIN_idpart
	FINSI
	SAUT FIN_idpart
FINSI

POINT	FIN_idpart
################### Fin calcul idpart V3t2



##################
#  V3t3  local   #
##################
# Ex OrigDxMsc : 3333363830303037303100 => "3368000701"
# Ex DestDxMsc : 3333363830303037303100 => "3368000701"
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
	# calcul taille reelle de OrigDxMsc (jusqu' a l'octet 0x00)
	erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::OrigDxMsc, pt_1_660004632)
#	trace2("<<<__LINE__<<<__FILE__<< OrigDxMsc=<%s>",pt_1,"")
	taille_660004632=i_strlen(pt_1_660004632)
	indice_660004632 = 0
	POINT BOUCLE_localLg_OrigDxMsc
	SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_1_660004632,"00", indice_660004632, 2) != 0)
		ALORS
		indice_660004632 = indice_660004632 + 2
		SAUT BOUCLE_localLg_OrigDxMsc
	FINSI
	taille_660004632 = indice_660004632
#	trace1("<<<__LINE__<<<__FILE__<<< taille reelle =<%d>",taille)
# taille de la partie numerique d'OrigDxMsc
	indice_660004632 = 0
	POINT	BOUCLE_localLgNum_OrigDxMsc
	SI (indice_660004632 < taille_660004632)
		ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigDxMsc,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigDxMsc,indice_660004632) <= '9')
			ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_localLgNum_OrigDxMsc
		FINSI
	FINSI
#	trace1("<<<__LINE__<<<__FILE__<<< taille de la partie numerique d'OrigDxMsc =<%d>",indice)
# indice = taille de la partie numerique d'OrigDxMsc
	SI (indice_660004632 > 0)
		ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t3","")
		indice_660004632 = 0
		POINT	BOUCLE_local_OrigDxMsc
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin, $TmmscNsn::OrigDxMsc, indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin, $TmmscNsn::OrigDxMsc, indice_660004632) <= '9')
			ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::OrigDxMsc,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_local_OrigDxMsc
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
			ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t3", "local", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::local, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t3", "local", 4*indice_660004632 + 4)
		FINSI
	FINSI
	SAUT FIN_local
FINSI

SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
ALORS
	# calcul taille reelle de DestDxMsc (jusqu' a l'octet 0x00)
	erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::DestDxMsc, pt_1_660004632)
#	trace2("<<<__LINE__<<<__FILE__<< DestDxMsc=<%s>",pt_1,"")
	taille_660004632=i_strlen(pt_1_660004632)
	indice_660004632 = 0
	POINT BOUCLE_localLg_DestDxMsc
	SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_1_660004632,"00", indice_660004632, 2) != 0)
	ALORS
		indice_660004632 = indice_660004632 + 2
		SAUT BOUCLE_localLg_DestDxMsc
	FINSI
	taille_660004632 = indice_660004632 / 2
#	trace1("<<<__LINE__<<<__FILE__<<< taille reelle =<%d>",taille)
# taille de la partie numerique d'DestDxMsc
	indice_660004632 = 0
	POINT	BOUCLE_localLgNum_DestDxMsc
	SI (indice_660004632 < taille_660004632)
	ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::DestDxMsc,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::DestDxMsc,indice_660004632) <= '9')
		ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_localLgNum_DestDxMsc
		FINSI
	FINSI
#	trace1("<<<__LINE__<<<__FILE__<<< taille de la partie numerique d'DestDxMsc =<%d>",indice)
# indice = taille de la partie numerique d'DestDxMsc
	SI (indice_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t3","")
		indice_660004632 = 0
		POINT	BOUCLE_local_DestDxMsc
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin, $TmmscNsn::DestDxMsc, indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin, $TmmscNsn::DestDxMsc, indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::DestDxMsc,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_local_DestDxMsc
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t3", "local", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::local, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t3", "local", 4*indice_660004632 + 4)
		FINSI
	FINSI
FINSI

POINT FIN_local
################### Fin calcul local V3t3


##################
# V3t4  MSISDN   #
##################
#Ex Oaddr : 2B33333633393439393236352F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
#Ex Daddr : 2B33333634383836323338342F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"

SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
###########################################
# Test si cas d'un mail, QC875
###########################################
#Oaddr (email ou +num)
	SI (b_MailOaddr_660004632)
	ALORS
## anomalie interne 2938 : pas de "+.....@....." de mms-nokia pas reconduit pour MMSC-NSN
#		caract = i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,0)
#		SI (caract == 0x2B)
#		ALORS
#			trace("<<<__LINE__<<<__FILE__<<< Erreur duplication champ MSISDN : adresse mail commencant par +")
#			ERREUR = ERR_DUPL
#			code_rejet = MODULE + ERREUR + EFFICACE
#			erreur=i_PlvMessEmettre(8187, 2, g_iartin, "", 2, code_rejet, "MSISDN" , 0)
#			SAUT STOCKE_ERRONE
#		FINSI
## /anomalie interne 2938

		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		#taille_Oaddr est en nb de quartets => /2 pour avoir le nb d'octets
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		SI (taille_Oaddr2_660004632 < 19)
		ALORS
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t4","MSISDN", (8 * taille_Oaddr2_660004632) + 8)
		SINON
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t4","MSISDN", 8 * 19)
		FINSI
# on affecte au premier octet de MSISDN 0
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0)
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0)
# suivi par la valeur en ascii de Oaddr
# on recupere element par element les elements du tableau numerique(hexa) Oaddr
		taille_660004632 = taille_Oaddr2_660004632
		SI (taille_Oaddr2_660004632 > 18)
		ALORS
			taille_660004632 = 18
		FINSI
		indice_660004632 = 0
		POINT	BOUCLE_MSISDN_mailOaddr
		SI (indice_660004632 < taille_660004632)
		ALORS
			res_660004632 = i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,(indice_660004632*2)+2, res_660004632 / 0x10)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,(indice_660004632*2)+3, res_660004632 - (res_660004632 / 0x10) * 0x10)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_mailOaddr
		FINSI
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::MSISDN, pt_1_660004632)
#		trace2("<<<__LINE__<<<__FILE__<< MSISDN mis a jour =<%s>",pt_1,"")
		SAUT FIN_MSISDN
	FINSI

###########################################
# Test si format_MSISDN (commence par +)
###########################################
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,0) == '+')
	ALORS
		taille_660004632 = taille_Oaddr_660004632
		SI (taille_Oaddr_660004632 > 39)
		ALORS
			taille_660004632 = 39
		FINSI
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		# extraction de la partie numerique de OADDR apres '+' donc indice = 1
		indice_660004632 = 1
		POINT BOUCLE_MSISDN_plusOaddr
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0' && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632-1, i_get_art_fieldtab(g_iartin, $TmmscNsn::Oaddr, indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_plusOaddr
		FINSI
		#QC877 : deux f a la fin du numero DCB
		res_660004632 = (indice_660004632-1) / 2
		SI ((indice_660004632-1) == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*(indice_660004632-1))
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632-1, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*(indice_660004632-1) + 4)
		FINSI
		SAUT FIN_MSISDN
	FINSI

###########################################
# Test  si Format_ShortID
###########################################
# taille de la partie numerique d'Oaddr
	indice_660004632 = 0
	POINT	BOUCLE_MSISDN_short1Oaddr
	SI (indice_660004632 < taille_Oaddr_660004632)
	ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_short1Oaddr
		FINSI
	FINSI
# indice = taille de la partie numerique d'Oaddr

	SI (indice_660004632 <= 5 && indice_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		indice_660004632 = 0
		POINT	BOUCLE_MSISDN_short2Oaddr
		SI (indice_660004632 < taille_Oaddr_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::Oaddr,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_short2Oaddr
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*indice_660004632 + 4)
		FINSI
		SAUT FIN_MSISDN
	FINSI
	SAUT FIN_MSISDN
FINSI


SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
	ALORS

###########################################
# Test si cas d'un mail, QC875
###########################################
	SI (b_MailDaddr_660004632)
	ALORS
## anomalie interne 2938 : pas de "+.....@....." de mms-nokia pas reconduit pour MMSC-NSN
#		caract = i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,0)
#		SI (caract == 0x2B)
#		ALORS
#			trace("<<<__LINE__<<<__FILE__<<< Erreur duplication champ MSISDN : adresse mail commencant par +")
#			ERREUR = ERR_DUPL
#			code_rejet = MODULE + ERREUR + EFFICACE
#			erreur=i_PlvMessEmettre(8187, 2, g_iartin, "", 2, code_rejet, "MSISDN" , 0)
#			SAUT STOCKE_ERRONE
#		FINSI
## /anomalie interne 2938
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		#taille_Daddr est en nb de quartets => /2 pour avoir le nb d'octets
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		SI (taille_Daddr2_660004632 < 19)
		ALORS
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t4","MSISDN", (8 * taille_Daddr2_660004632) + 8)
		SINON
			erreur_660004632 = i_resize_tlv(g_iartout,"T3t4","MSISDN", 8 * 19)
		FINSI
# on affecte au premier octet de MSISDN 0
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,0,0)
		erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,1,0)
# suivi par la valeur en ascii de Daddr
# on recupere element par element les elements du tableau numerique(hexa) Daddr
		taille_660004632 = taille_Daddr2_660004632
		SI (taille_Daddr2_660004632 > 18)
		ALORS
			taille_660004632 = 18
		FINSI
		indice_660004632 = 0
		POINT	BOUCLE_MSISDN_mailDaddr
		SI (indice_660004632 < taille_660004632)
		ALORS
			res_660004632 = i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,(indice_660004632*2)+2, res_660004632 / 0x10)
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,(indice_660004632*2)+3, res_660004632 - (res_660004632 / 0x10) * 0x10)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_mailDaddr
		FINSI
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::MSISDN, pt_1_660004632)
#		trace2("<<<__LINE__<<<__FILE__<< MSISDN mis a jour =<%s>",pt_1,"")
		SAUT FIN_MSISDN
	FINSI

###########################################
# Test si format_MSISDN (commence par +)
###########################################
	SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,0) == '+')
	ALORS
		taille_660004632 = taille_Daddr_660004632
		SI (taille_Daddr_660004632 > 39)
		ALORS
			taille_660004632 = 39
		FINSI
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		# extraction de la partie numerique de DADDR apres '+' donc indice = 1
		indice_660004632 = 1
		POINT BOUCLE_MSISDN_plusDaddr
		SI (indice_660004632 < taille_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0' && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632-1, i_get_art_fieldtab(g_iartin, $TmmscNsn::Daddr, indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_plusDaddr
		FINSI
		#QC877 : deux f a la fin du numero DCB
		res_660004632 = (indice_660004632-1) / 2
		SI ((indice_660004632-1) == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*(indice_660004632 - 1))
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632-1, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*(indice_660004632-1) + 4)
		FINSI
		SAUT FIN_MSISDN
	FINSI

###########################################
# Test  si Format_ShortID
###########################################
# taille de la partie numerique d'Daddr
	indice_660004632 = 0
	POINT	BOUCLE_MSISDN_short1Daddr
	SI (indice_660004632 < taille_Daddr_660004632)
	ALORS
		SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_short1Daddr
		FINSI
	FINSI
# indice = taille de la partie numerique d'Daddr
	SI (indice_660004632 <= 5 && indice_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t4","")
		indice_660004632 = 0
		POINT	BOUCLE_MSISDN_short2Daddr
		SI (indice_660004632 < taille_Daddr_660004632 && i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) >= '0'	&& i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) <= '9')
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MSISDN,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::Daddr,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MSISDN_short2Daddr
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", 4*indice_660004632 + 4)
		FINSI
		SAUT FIN_MSISDN
	FINSI
	SAUT FIN_MSISDN
FINSI

POINT	FIN_MSISDN
################### Fin calcul MSISDN V3t4


#######################
# V3t23  MailIdpart   #
#######################
#Ex Oaddr : 2B33333633393439393236352F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
#Ex Daddr : 2B33333634383836323338342F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
# Test si cas d'un mail, QC875
	SI (b_MailDaddr_660004632)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t23","")
# Valeur en ascii de Daddr
# on recupere element par element les elements du tableau numerique(hexa) Daddr
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MailIdpart, g_iartin.Daddr[], taille_Daddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t23", "MailIdpart", taille_Daddr2_660004632)
	FINSI
FINSI

SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
ALORS
# Test si cas d'un mail, QC875
	SI (b_MailOaddr_660004632)
		ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t23","")
# Valeur en ascii de Oaddr
# on recupere element par element les elements du tableau numerique(hexa) Oaddr
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MailIdpart, g_iartin.Oaddr[], taille_Oaddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t23", "MailIdpart", taille_Oaddr2_660004632)
	FINSI
FINSI

###########################
# V3t24  MailMsOrEntity   #
###########################
#Ex Oaddr : 2B33333633393439393236352F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
#Ex Daddr : 2B33333634383836323338342F545950453D504C4D4E00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ="+33639499265/TYPE=PLMN"
SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
ALORS
# Test si cas d'un mail, QC875
	SI (b_MailDaddr_660004632)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t24","")
# valeur en ascii de Daddr
# on recupere element par element les elements du tableau numerique(hexa) Daddr
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MailMsOrEntity, g_iartin.Daddr[], taille_Daddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t24", "MailMsOrEntity", taille_Daddr2_660004632)
	FINSI
FINSI

SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
# Test si cas d'un mail, QC875
	SI (b_MailOaddr_660004632)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t24","")
# Valeur en ascii de Oaddr
# on recupere element par element les elements du tableau numerique(hexa) Oaddr
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MailMsOrEntity, g_iartin.Oaddr[], taille_Oaddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t24", "MailMsOrEntity", taille_Oaddr2_660004632)
	FINSI
FINSI


###########################
# V3t25  MMSsubscribId2   #
###########################
# Ex DestImsi : 333336343838363233383400FFFFFFFFFFFFFFFFFF
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
	i_strcpy(pt_1_660004632,"")
	# calcul taille reelle de DestImsi (jusqu' a l'octet 0x00)
	erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::DestImsi, pt_1_660004632)
#	trace2("<<<__LINE__<<<__FILE__<< DestImsi=<%s>",pt_1,"")
	taille_660004632=i_strlen(pt_1_660004632)
	indice_660004632 = 0
	POINT Boucle_DestImsiLg
	SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_1_660004632,"00", indice_660004632, 2) != 0)
	ALORS
		indice_660004632 = indice_660004632 + 2
		SAUT Boucle_DestImsiLg
	FINSI
	taille_660004632 = indice_660004632
#	trace1("<<<__LINE__<<<__FILE__<<< taille_DestImsi=<%d>",taille)

	SI (taille_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t25","")
		indice_660004632 = 0
		taille_660004632 = taille_660004632 / 2
		POINT	BOUCLE_MMSsubscribId2
		SI (indice_660004632 < taille_660004632)
		ALORS
			erreur_660004632 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::MMSsubscribId2,indice_660004632,i_get_art_fieldtab(g_iartin,$TmmscNsn::DestImsi,indice_660004632) - 0x30)
			indice_660004632 = indice_660004632 + 1
			SAUT BOUCLE_MMSsubscribId2
		FINSI
		res_660004632 = indice_660004632 / 2
		SI (indice_660004632 == res_660004632 * 2)
		ALORS
			#nombre de quartets pair
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t25", "MMSsubscribId2", 4*indice_660004632)
		SINON
			#nombre de quartets impair (ajout de F final)
			erreur_660004632 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MMSsubscribId2, indice_660004632, 0xF)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t25", "MMSsubscribId2", 4*indice_660004632 + 4)
		FINSI
	FINSI
FINSI


###########################
# V3t26 MMStypeOfCont     #
###########################
cntnbtext_660004632 = i_get_art_field(g_iartin, $TmmscNsn::CntNbText)
cntnbaudio_660004632 = i_get_art_field(g_iartin, $TmmscNsn::CntNbAudio)
cntnbimage_660004632 = i_get_art_field(g_iartin, $TmmscNsn::CntNbImage)
cntnbvideo_660004632 = i_get_art_field(g_iartin, $TmmscNsn::CntNbVideo)
cntnbother_660004632 = i_get_art_field(g_iartin, $TmmscNsn::CntNbOther)

res_660004632 = 0
SI (cntnbtext_660004632 > 0)
ALORS
	res_660004632 = 1
FINSI
SI (cntnbaudio_660004632 > 0)
ALORS
	res_660004632 = res_660004632 + 2
FINSI
SI (cntnbimage_660004632 > 0)
ALORS
	res_660004632 = res_660004632 + 4
FINSI
SI (cntnbvideo_660004632 > 0)
ALORS
	res_660004632 = res_660004632 + 8
FINSI
SI (cntnbother_660004632 > 0)
ALORS
	res_660004632 = res_660004632 + 16
FINSI

erreur_660004632 = i_ajout_tlv(g_iartout,"T3t26","")
erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::MMStypeOfCont, res_660004632)


###########################
# V3t27  MMSoutInterf     #
###########################
SI (RecordType_660004632 == 0x31)
ALORS
	erreur_660004632 = i_ajout_tlv(g_iartout,"T3t27","")
	erreur_660004632 = i_set_art_str(g_iartout, $Tdpvgsm::MMSoutInterf, "MM1")
	erreur_660004632 = i_resize_tlv(g_iartout, "T3t27", "MMSoutInterf", 3)
FINSI


SI (RecordType_660004632 == 0x33)
ALORS
	SI (i_valid_field_n(g_iartout, $Tdpvgsm::MailMsOrEntity))
	ALORS
		i_strcpy(pt_1_660004632,"")
		i_strcpy(pt_2_660004632,"")
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::MailMsOrEntity, pt_1_660004632)
		SI (i_adequation_chaine_expreg (pt_1_660004632, "@") == 0)
		ALORS
			indice_660004632 =0
			POINT BOUCLE_V3t27
			i_get_sub_str(pt_1_660004632, indice_660004632, indice_660004632, pt_2_660004632)
			SI (i_strcmp(pt_2_660004632,"@") != 0)
			ALORS
				indice_660004632 = indice_660004632 + 1
				SAUT BOUCLE_V3t27
			FINSI
			indice_660004632 = indice_660004632 + 1
			i_get_sub_str(pt_1_660004632, indice_660004632 , -1, pt_2_660004632)
			erreur_660004632 = i_ajout_tlv(g_iartout,"T3t27","")
			erreur_660004632 = i_set_art_str(g_iartout, $Tdpvgsm::MMSoutInterf, pt_2_660004632)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t27", "MMSoutInterf", i_strlen(pt_2_660004632))
		FINSI
	FINSI
FINSI


SI (RecordType_660004632 == 0x35)
ALORS
	i_strcpy(pt_1_660004632,"")
	# EX DestMmsc : 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
	# calcul taille reelle de DestMmsc (jusqu' a l'octet 0x00)
	erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::DestMmsc, pt_1_660004632)
#	trace2("<<<__LINE__<<<__FILE__<< DestMmsc=<%s>",pt_1,"")
	taille_660004632=i_strlen(pt_1_660004632)
	indice_660004632 = 0
	POINT Boucle_DestMmscLg
	SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_1_660004632,"00", indice_660004632, 2) != 0)
	ALORS
		indice_660004632 = indice_660004632 + 2
		SAUT Boucle_DestMmscLg
	FINSI
	taille_660004632 = indice_660004632
#	trace1("<<<__LINE__<<<__FILE__<<< taille_DestMmsc=<%d>",taille)
	SI (taille_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t27","")
		taille2_660004632 = taille_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MMSoutInterf, g_iartin.DestMmsc[], taille2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t27", "MMSoutInterf", taille2_660004632)
	FINSI
FINSI


SI (RecordType_660004632 == 0x37)
ALORS
	SI (taille_Daddr_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t27","")
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MMSoutInterf, g_iartin.Daddr[], taille_Daddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t27", "MMSoutInterf", taille_Daddr2_660004632)
	FINSI
FINSI



###########################
# V3t28  MMSinInterf      #
###########################
SI (RecordType_660004632 == 0x30)
ALORS
	erreur_660004632 = i_ajout_tlv(g_iartout,"T3t28","")
	erreur_660004632 = i_set_art_str(g_iartout, $Tdpvgsm::MMSinInterf, "MM1")
	erreur_660004632 = i_resize_tlv(g_iartout, "T3t28", "MMSinInterf", 3)
FINSI

SI (RecordType_660004632 == 0x32)
ALORS
	SI (i_valid_field_n(g_iartout, $Tdpvgsm::MailMsOrEntity))
	ALORS
		i_strcpy(pt_1_660004632,"")
		i_strcpy(pt_2_660004632,"")
		erreur_660004632 = i_get_art_str(g_iartout, $Tdpvgsm::MailMsOrEntity, pt_1_660004632)
		SI (i_adequation_chaine_expreg (pt_1_660004632, "@") == 0)
		ALORS
			indice_660004632 =0
			POINT BOUCLE_V3t28
			i_get_sub_str(pt_1_660004632, indice_660004632, indice_660004632, pt_2_660004632)
			SI (i_strcmp(pt_2_660004632,"@") != 0)
			ALORS
				indice_660004632 = indice_660004632 + 1
				SAUT BOUCLE_V3t28
			FINSI
			indice_660004632 = indice_660004632 + 1
			i_get_sub_str(pt_1_660004632, indice_660004632 , -1, pt_2_660004632)
			erreur_660004632 = i_ajout_tlv(g_iartout,"T3t28","")
			erreur_660004632 = i_set_art_str(g_iartout, $Tdpvgsm::MMSinInterf, pt_2_660004632)
			erreur_660004632 = i_resize_tlv(g_iartout, "T3t28", "MMSinInterf", i_strlen(pt_2_660004632))
		FINSI
	FINSI
FINSI


SI (RecordType_660004632 == 0x34)
ALORS
	# EX OrigMmsc : 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
	# calcul taille reelle de OrigMmsc (jusqu' a l'octet 0x00)
	erreur_660004632 = i_get_art_str(g_iartin, $TmmscNsn::OrigMmsc, pt_1_660004632)
#	trace2("<<<__LINE__<<<__FILE__<< OrigMmsc=<%s>",pt_1,"")
	taille_660004632=i_strlen(pt_1_660004632)
	indice_660004632 = 0
	POINT Boucle_OrigMmscLg
	SI (indice_660004632 < taille_660004632 && i_strplcmp(pt_1_660004632,"00", indice_660004632, 2) != 0)
	ALORS
		indice_660004632 = indice_660004632 + 2
		SAUT Boucle_OrigMmscLg
	FINSI
	taille_660004632 = indice_660004632
#	trace1("<<<__LINE__<<<__FILE__<<< taille_OrigMmsc=<%d>",taille)
	SI (taille_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t28","")
		taille2_660004632 = taille_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MMSinInterf, g_iartin.OrigMmsc[], taille2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t28", "MMSinInterf", taille2_660004632)
	FINSI
FINSI


SI (RecordType_660004632 == 0x36)
ALORS
	SI (taille_Oaddr_660004632 > 0)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T3t28","")
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MMSinInterf, g_iartin.Oaddr[], taille_Oaddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T3t28", "MMSinInterf", taille_Oaddr2_660004632)
	FINSI
FINSI



# V4t30.1  timeInCE	:-	:-	:MSET:11
# V4t30.2  eec			:-	:-	:CSTE:-1
# QC1331
#erreur=set_timeInCE_EEC(0)
########### Date_Audit
erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

###########################
# V4t35.2  occurenceNb    #
###########################
# QC886
# EX :g_iartin, V.24(MsgId) : 3034313431303039353731303031303030303030363030303000FFFFFFFFFFFF

#SI (i_get_art_fieldtab(g_iartin,$TmmscNsn::MsgId,22) == 0x00)
#ALORS
res_660004632 = (i_get_art_fieldtab(g_iartin,$TmmscNsn::MsgId,21) - 0x30) * 1000
res_660004632 = res_660004632 + (i_get_art_fieldtab(g_iartin,$TmmscNsn::MsgId,22) - 0x30) * 100
res_660004632 = res_660004632 + (i_get_art_fieldtab(g_iartin,$TmmscNsn::MsgId,23) - 0x30) * 10
res_660004632 = res_660004632 + (i_get_art_fieldtab(g_iartin,$TmmscNsn::MsgId,24) - 0x30)
res_660004632 = res_660004632 + 1

erreur_660004632 = i_ajout_tlv(g_iartout,"T4t35.2","")
SI (res_660004632 >= 0xFF)
ALORS
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::occurenceNb, 0xFF)
SINON
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::occurenceNb, res_660004632)
FINSI



###########################
# V4t35.3  participantsNb #
###########################
#QC875 , valeur limite (entree NbOfSucfulRecip sur 4 octets, sortie participantsNb sur 2 octets)
res_660004632 = i_get_art_field(g_iartin, $TmmscNsn::NbOfSucfulRecip)

erreur_660004632 = i_ajout_tlv(g_iartout,"T4t35.3","")
SI (res_660004632 >= 0 && res_660004632 < 0x0000FFFF)
ALORS
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::participantsNb, res_660004632)
SINON
	erreur_660004632 = i_set_art_field(g_iartout, $Tdpvgsm::participantsNb, -1)
FINSI



###########################
# V4t40.1  userIdNet      #
###########################
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
	# Test si cas d'un mail, QC875
	SI (b_MailOaddr_660004632)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T4t40.1","")
		# Valeur en ascii de Oaddr
		# on recupere element par element les elements du tableau numerique(hexa) Oaddr
		taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::userIdNet, g_iartin.Oaddr[], taille_Oaddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T4t40.1", "userIdNet", taille_Oaddr2_660004632)
	FINSI
SINON
	SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
	ALORS
		# Test si cas d'un mail, QC875
		SI (b_MailDaddr_660004632)
		ALORS
			erreur_660004632 = i_ajout_tlv(g_iartout,"T4t40.1","")
			# valeur en ascii de Daddr
			# on recupere element par element les elements du tableau numerique(hexa) Daddr
			taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
			erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::userIdNet, g_iartin.Daddr[], taille_Daddr2_660004632)
			erreur_660004632 = i_resize_tlv(g_iartout, "T4t40.1", "userIdNet", taille_Daddr2_660004632)
		FINSI
	FINSI
FINSI



###########################
# V4t50.3  partTransID    #
###########################
SI (RecordType_660004632 == 0x30 || RecordType_660004632 == 0x32 || RecordType_660004632 == 0x34 || RecordType_660004632 == 0x36)
ALORS
	# Test si cas d'un mail, QC875
	SI (b_MailDaddr_660004632)
	ALORS
		erreur_660004632 = i_ajout_tlv(g_iartout,"T4t50.3","")
		# valeur en ascii de Daddr
		# on recupere element par element les elements du tableau numerique(hexa) Daddr
		taille_Daddr2_660004632 = taille_Daddr_660004632 / 2
		erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::partTransID, g_iartin.Daddr[], taille_Daddr2_660004632)
		erreur_660004632 = i_resize_tlv(g_iartout, "T4t50.3", "partTransID", taille_Daddr2_660004632)
	FINSI
SINON
	SI (RecordType_660004632 == 0x31 || RecordType_660004632 == 0x33 || RecordType_660004632 == 0x35 || RecordType_660004632 == 0x37)
	ALORS
		# Test si cas d'un mail, QC875
		SI (b_MailOaddr_660004632)
		ALORS
			erreur_660004632 = i_ajout_tlv(g_iartout,"T4t50.3","")
			# Valeur en ascii de Oaddr
			# on recupere element par element les elements du tableau numerique(hexa) Oaddr
			taille_Oaddr2_660004632 = taille_Oaddr_660004632 / 2
			erreur_660004632 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::partTransID, g_iartin.Oaddr[], taille_Oaddr2_660004632)
			erreur_660004632 = i_resize_tlv(g_iartout, "T4t50.3", "partTransID", taille_Oaddr2_660004632)
		FINSI
	FINSI
FINSI



########## Fin modification DPV pivot ##################


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

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

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


erreur_660004632 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_INCONNU_660004632, Multidistribution_Non_660004632)
SI (erreur_660004632 == TRAI_KO_660004632)
ALORS
# QC1005
	trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
#	code_rejet = 0xA000 + 0x110 + 1
#	erreur=i_PlvMessEmettre(6409, 2, g_iartin, "", 1, code_rejet, 0, 0)
	SAUT STOCKE_ERRONE
FINSI

trace("<<<__LINE__<<<__FILE__<<< **** Fin de distribution pcode TmmscNsn_dis ok ****")
RETOUR TRAIT_OK


POINT	STOCKE_ERRONE
erreur_660004632 = i_make_art_rej(g_iartin, g_iartout11, code_rejet_660004632)
erreur_660004632 = i_stocke_art(g_iartout11,0,PT_ERRONE,0)
trace("<<<__LINE__<<<__FILE__<<< TmmscNsn_dis  errone => Fin de traitement et distribution")
RETOUR TRAIT_OK

#---------------------------------- Fin TmmscNsn_dis.src -------------------------
