DEFINITION Multidistribution_Non_660004623 0
DEFINITION DISTRIBUTION_SPECIALE_660004623 0
DEFINITION ERR_SYNTAX_660004623 0xA040
DEFINITION C_Tdpv_660004623 "Tdpvgsm"
DEFINITION C_NON_ACTIVE_660004623 "N/A"
DEFINITION C_Article_660004623 "Tmib"
DEFINITION NUMTAB_660004623 4
DEFINITION TRAI_KO_660004623 -1
REGISTRE ENTIER date_plat_660004623
REGISTRE ENTIER date_660004623
REGISTRE ENTIER date_fin_660004623
REGISTRE ENTIER erreur_660004623
REGISTRE ENTIER code_rejet_660004623
REGISTRE ENTIER code_errone_660004623
REGISTRE ENTIER type_cra_660004623
REGISTRE ENTIER EFFICACE_660004623
REGISTRE ENTIER MIBLOC_660004623
REGISTRE ENTIER MIBSTATUS_660004623
REGISTRE ENTIER MIBNOTIF_660004623
REGISTRE ENTIER TicketType_660004623
REGISTRE ENTIER tentite_660004623
REGISTRE ENTIER status_660004623
REGISTRE ENTIER size_status_660004623
REGISTRE ENTIER size_contrat_660004623
REGISTRE ENTIER StatutMobile_660004623
REGISTRE ENTIER longueur_660004623
REGISTRE ENTIER index_660004623
REGISTRE ENTIER date_audit_660004623
REGISTRE ENTIER res_660004623
REGISTRE ENTIER heure_660004623
REGISTRE ENTIER icar_660004623
REGISTRE ENTIER MOD_660004623
REGISTRE ENTIER VAL_660004623
REGISTRE ENTIER indiq_660004623
REGISTRE ENTIER length_660004623
REGISTRE ENTIER resul_660004623
REGISTRE POINTEUR pt_CHAMP_ERRONE_660004623
REGISTRE POINTEUR pt_idemet_660004623
REGISTRE POINTEUR pt_1_660004623
REGISTRE POINTEUR pt_2_660004623
REGISTRE POINTEUR pt_CalledMsisdn_660004623
REGISTRE POINTEUR pt_SGTQS_660004623
REGISTRE POINTEUR pt_BUFFER_660004623
REGISTRE POINTEUR pt_res1_660004623
################################################################
# Pcode de DISTRIBUTION : Tmib_dis.src
# Service MIB: Mobile Internet for Business 
# Article : Tmib notification type SMS ou STATUS
#       ou : Tmib localisation
################################################################
# 
# URS/RBE	09/09/05	Creation
# URS/PSA	20/01/06	FO 52, 54, 55
# URS/PSA	27/01/06	Appel a aiguillage2
# URS/PSA	01/02/06	Recup AX_IDEMET dans table externe
# URS/PSA	10/02/06	FO 82
# 19/04/06 FO 115 date_plat/date_audit
# 19/04/06 FO 181 stockage en errone
# 12/05/06 PSA Appel fonction i_incr_redist_dist pour compteur redistribution
# 01/09/06 JLG report FO CaME : 240, 242
# 01/09/06 JLG changement d'article Conversion par Conv_URS (pb fusion sofrecom)
# 07/11/06 PKH FO232 recuperation du code SGTQS et concatenation avec AX_IDEMET pour inter. variablecontexte
# 26/01/07 PKH F0402 Controle sur le champ CalledMsisdn si non numerique et non N/A alors en errone
# 09/08/07 Creation enveloppe optionnelle E_Redist2
# 08/12/10 G3R1lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 29/02/2012 - JLG -G3R6 QC1005 modif alarme retour aiguillage
# 02/07/2014 - JLG -G5R1 QC1405, champ eec du DPV si g_ieec > 500
################################################################











# Initialisations
EFFICACE_660004623 = 2
MIBLOC_660004623 = 0
MIBSTATUS_660004623 = 0
MIBNOTIF_660004623 = 0
size_contrat_660004623 = 0
size_status_660004623 = 0
TicketType_660004623 = 0
tentite_660004623 = 0
StatutMobile_660004623 = 0
indiq_660004623 = 0
length_660004623 = 0
resul_660004623 = 0

# INITIALISATION POINTEUR
pt_CHAMP_ERRONE_660004623 = "01234567890123456789"
pt_SGTQS_660004623 = "7899877899877890987987789"
pt_BUFFER_660004623 = "99999999999999999999999999999999999999999999999999999999999999999999999999999999999"
pt_idemet_660004623	= "4444444444444444444444444444444444444444444444444444444444444444444444444"
pt_1_660004623 = "22222222222222222222222222222222222222222222222222222"
pt_2_660004623 = "33333333333333333333333333333333333333333333333333333"
#pt_marque_audit = "9876543210123456712345"
pt_CalledMsisdn_660004623 = "555555555555555555555555555555"
pt_res1_660004623 = "888888888888888888888888888888"
#####################################################################################
i_strcpy(pt_1_660004623,"")
i_strcpy(pt_2_660004623,"")
i_strcpy(pt_CalledMsisdn_660004623,"")

trace("Pcode de distribution de Tmib")
#erreur = i_fdump_art(g_iartin)

SI (i_LireRedistCpt() == 0)
ALORS
	erreur_660004623 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004623 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004623=i_get_art_field(g_iartin,$Tmib::dfin)
erreur_660004623= i_incr_redist_dist_660004265(date_fin_660004623)


#FO323 recuperation du code SGTQS
i_strcpy (pt_SGTQS_660004623,"")
i_strcpy (pt_SGTQS_660004623,i_LireEECSGTQS(g_ieec))


erreur_660004623=i_get_art_str(g_iartin, $Tmib::TicketType, pt_1_660004623)
i_get_sub_str(pt_1_660004623, 0, 0, pt_2_660004623)
#trace2("Valeur de TType : %s",pt_1,"")
#trace2("Valeur de TType : %s",pt_2,"")

SI (i_strcmp("N", pt_2_660004623) == 0)
ALORS
	MIBNOTIF_660004623 = 1
	TicketType_660004623 = 0x61
	tentite_660004623 = 0x11
SINON
	SI (i_strcmp("S", pt_2_660004623) == 0)
	ALORS
		MIBSTATUS_660004623 = 1
		TicketType_660004623 = 0x62
		tentite_660004623 = 0x12
	SINON
		SI (i_strcmp("L", pt_2_660004623) == 0)
		ALORS
			MIBLOC_660004623 = 1
			TicketType_660004623 = 0x63
			tentite_660004623 = 0x13
		SINON
			#trace("Erreur sur TicketType")
			i_strcpy(pt_CHAMP_ERRONE_660004623, "TicketType")
			code_rejet_660004623 = ERR_SYNTAX_660004623 + EFFICACE_660004623
			erreur_660004623 = i_PlvMessEmettre(6050,2,g_iartin,"",3,code_rejet_660004623, pt_CHAMP_ERRONE_660004623, TicketType_660004623)
		FINSI
	FINSI
FINSI

# calcul de la variable status
size_status_660004623 = g_iartin.STATUS!NELEM

# FO 52
# NELEM donne le nombre d element y compris le F de bourrage eventuel
SI g_iartin.STATUS[size_status_660004623-1] == 0xF
ALORS
        size_status_660004623 = size_status_660004623 - 1
FINSI


#trace1("taille status : %d",size_status)
SI (size_status_660004623 == 1)
ALORS
	status_660004623 = g_iartin.STATUS[0]
SINON
	SI (size_status_660004623 == 2)
	ALORS
		status_660004623 = g_iartin.STATUS[0]*10 + g_iartin.STATUS[1]
	SINON
		SI (size_status_660004623 == 3)
		ALORS
			status_660004623 = g_iartin.STATUS[0]*100 + g_iartin.STATUS[1]*10 + g_iartin.STATUS[2]
		SINON
			status_660004623 = g_iartin.STATUS[0]*1000 + 
			g_iartin.STATUS[1]*100 + 
			g_iartin.STATUS[2]*10 + 
			g_iartin.STATUS[3]
		FINSI
	FINSI
FINSI
#trace1("MIB - status : %d",status)

SI (MIBNOTIF_660004623 == 1)
ALORS
	SI (status_660004623 == 99)
	ALORS
		StatutMobile_660004623 = 0x0F
	SINON
		SI (status_660004623 == 32)
		ALORS
			StatutMobile_660004623 = 0x09
		SINON
			SI (status_660004623 == 31)
			ALORS
				StatutMobile_660004623 = 0x08
			FINSI
		FINSI
	FINSI
FINSI
#trace1("MIB_dist Valeur MIBNOTIF : %d",MIBNOTIF)
#trace1("MIB_dist Valeur status : %d",status)
#trace1("MIB_dist Valeur StatutMobile : %d",StatutMobile)

SI (MIBSTATUS_660004623 == 1)
ALORS
	SI (status_660004623 == 00)
	ALORS
		StatutMobile_660004623 = 0x01
	SINON
		SI (status_660004623 == 01)
		ALORS
			StatutMobile_660004623 = 0x02
		SINON
			SI (status_660004623 == 11)
			ALORS
				StatutMobile_660004623 = 0x03
			SINON
				SI (status_660004623 == 12)
				ALORS
					StatutMobile_660004623 = 0x04
				SINON
					SI (status_660004623 == 21)
					ALORS
						StatutMobile_660004623 = 0x06
					SINON
						SI (status_660004623 == 31)
						ALORS
							StatutMobile_660004623 = 0x08
						SINON
							SI (status_660004623 == 32)
							ALORS
								StatutMobile_660004623 = 0x09
							SINON
								SI (status_660004623 == 99)
								ALORS
									StatutMobile_660004623 = 0x0F
								FINSI
							FINSI
						FINSI
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI
#trace1("MIB_dist Valeur MIBSTATUS : %d",MIBSTATUS)
#trace1("MIB_dist Valeur status : %d",status)
#trace1("MIB_dist Valeur StatutMobile : %d",StatutMobile)

SI (MIBLOC_660004623 == 1)
ALORS
	SI (status_660004623 == 11)
	ALORS
		StatutMobile_660004623 = 0x03
	SINON
		SI (status_660004623 == 12)
		ALORS
			StatutMobile_660004623 = 0x04
		SINON
			SI (status_660004623 == 13)
			ALORS
				StatutMobile_660004623 = 0x05
			SINON
				SI (status_660004623 == 21)
				ALORS
					StatutMobile_660004623 = 0x06
				SINON
					SI (status_660004623 == 22)
					ALORS
						StatutMobile_660004623 = 0x07
					SINON
						SI (status_660004623 == 41)
						ALORS
							StatutMobile_660004623 = 0x0A
						SINON
							SI (status_660004623 == 42)
							ALORS
								StatutMobile_660004623 = 0x0B
							SINON
								SI (status_660004623 == 43)
								ALORS
									StatutMobile_660004623 = 0x0C
								SINON
									SI (status_660004623 == 44)
									ALORS
										StatutMobile_660004623 = 0x0D
									SINON
										SI (status_660004623 == 49)
										ALORS
											StatutMobile_660004623 = 0x0E
										SINON
											SI (status_660004623 == 99)
											ALORS
												StatutMobile_660004623 = 0x0F
											SINON
												SI (status_660004623 == 101)
												ALORS
													StatutMobile_660004623 = 0x10
												SINON
													SI (status_660004623 == 102)
													ALORS
														StatutMobile_660004623 = 0x11
													SINON
														SI (status_660004623 == 103)
														ALORS
															StatutMobile_660004623 = 0x12
														SINON
															SI (status_660004623 == 104)
															ALORS
																StatutMobile_660004623 = 0x13
															SINON
																SI (status_660004623 == 105)
																ALORS
																	StatutMobile_660004623 = 0x14
																SINON
																	SI (status_660004623 == 111)
																	ALORS
																		StatutMobile_660004623 = 0x15
																	SINON
																		SI (status_660004623 == 112)
																		ALORS
																			StatutMobile_660004623 = 0x16
																		SINON
																			SI (status_660004623 == 201)
																			ALORS
																				StatutMobile_660004623 = 0x17
																			SINON
																				SI (status_660004623 == 202)
																				ALORS
																					StatutMobile_660004623 = 0x18
																				SINON
																					SI (status_660004623 == 203)
																					ALORS
																						StatutMobile_660004623 = 0x19
																					SINON
																						SI (status_660004623 == 204)
																						ALORS
																							StatutMobile_660004623 = 0x1A
																						SINON
																							SI (status_660004623 == 205)
																							ALORS
																								StatutMobile_660004623 = 0x1B
																							SINON
																								SI (status_660004623 == 211)
																								ALORS
																									StatutMobile_660004623 = 0x1C
																								SINON
																									SI (status_660004623 == 212)
																									ALORS
																										StatutMobile_660004623 = 0x1D
																									SINON
																										SI (status_660004623 == 213)
																										ALORS
																											StatutMobile_660004623 = 0x1E
																										SINON
																											SI (status_660004623 == 311)
																											ALORS
																												StatutMobile_660004623 = 0x1F
																											SINON
																												SI (status_660004623 == 312)
																												ALORS
																													StatutMobile_660004623 = 0x20
																												FINSI
																											FINSI
																										FINSI
																									FINSI
																								FINSI
																							FINSI
																						FINSI
																					FINSI
																				FINSI
																			FINSI
																		FINSI
																	FINSI
																FINSI
															FINSI
														FINSI
													FINSI
												FINSI
											FINSI
										FINSI
									FINSI
								FINSI
							FINSI
						FINSI
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI
#trace1("MIB_dist Valeur MIBLOC : %d",MIBLOC)
#trace1("MIB_dist Valeur status : %d",status)
#trace1("MIB_dist Valeur StatutMobile : %d",StatutMobile)

##############################################################################
# Conversion DPV3.3
##############################################################################

############################################################################
# Duplication Tdpv33 (g_iartout)
############################################################################
#Duplication article d entree vers DPV TLV

SI (i_dup_art_tab( g_iartin, g_iartout, C_Tdpv_660004623))
ALORS
	#trace("ERREUR de duplication")
	code_errone_660004623 = 0xA0D0
	code_errone_660004623 = code_errone_660004623 + EFFICACE_660004623
	erreur_660004623 = i_PlvMessEmettre(6204,2,g_iartin,"",2,code_errone_660004623,C_Tdpv_660004623,0)
	SAUT STOCKE_ERRONE
FINSI

# V3t1.1        type

#trace1("MIB_dist Valeur MIBNOTIF : %d",MIBNOTIF)
#trace1("MIB_dist Valeur MIBSTATUS : %d",MIBSTATUS)
#trace1("MIB_dist Valeur MIBLOC : %d",MIBLOC)
#trace1("MIB_dist Valeur TicketType : %d",TicketType)
erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::type,TicketType_660004623)

# V3t1.2        tentite

#trace1("MIB_dist Valeur MIBNOTIF : %d",MIBNOTIF)
#trace1("MIB_dist Valeur MIBSTATUS : %d",MIBSTATUS)
#trace1("MIB_dist Valeur MIBLOC : %d",MIBLOC)
#trace1("MIB_dist Valeur tentite : %d",tentite)
erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::tentite,tentite_660004623)

# V3t1.3
# V3t1.3 idemet (defaut table dup)
#AX_IDEMET = 0

	i_strcpy(pt_idemet_660004623, " ")
#	erreur = i_get_art_str( g_iartout, $V3t1.5, pt_AR )
#	i_strcpy(pt_idemet, i_get_tab_field("valeurcontexte", i_get_art_field(g_iartin, $DATE ), pt_AR))

#FO323 recherche du type de plateforme ? partir de code SGTQS dans la table VariableContexte
#i_strcpy(pt_idemet, i_get_tab_field("VariableContexte", i_get_art_field(g_iartin,$Tmib::DATE), "AX_IDEMET_MIB"))	
	i_strcpy (pt_BUFFER_660004623,"")
	erreur_660004623 = i_format_str2(pt_BUFFER_660004623,"%s%s","AX_IDEMET_",pt_SGTQS_660004623)

i_strcpy(pt_idemet_660004623, i_get_tab_field("VariableContexte", i_get_art_field(g_iartin,$Tmib::DATE),pt_BUFFER_660004623))

#trace2("[Tvpn32_dis] AX_IDEMET =%s",pt_idemet,"")

SI (i_strcmp(pt_idemet_660004623,g_inull)) != 0
ALORS
	longueur_660004623= 0
	longueur_660004623=i_strlen(pt_idemet_660004623)
	erreur_660004623 = i_cree_art("Conv_URS",g_iartout10)
	erreur_660004623 = i_set_art_str(g_iartout10,$Conv_URS::recipAddAlp, pt_idemet_660004623)
	index_660004623=0
	POINT BOUCLE0
	SI (index_660004623 < longueur_660004623)
	ALORS
		SI (g_iartout10.recipAddHex[index_660004623] < 0x40)
		ALORS
			g_iartout.idemet[index_660004623]=g_iartout10.recipAddHex[index_660004623] - 0x30
		SINON
			g_iartout.idemet[index_660004623]=g_iartout10.recipAddHex[index_660004623] - 0x37
		FINSI
#		trace1("index=%d",index)
#		trace1("g_iartin.ax_idemet=%x",g_iartout10.recipAddHex[index] - 0x30)
		index_660004623=index_660004623+1
		SAUT BOUCLE0
	FINSI

SINON
	#i_strcpy(pt_idemet,"33007000000FFFFFFF")
	longueur_660004623 = g_iartout.idemet!NELEM
	g_iartout.idemet[0]= 0x3
	g_iartout.idemet[1]= 0x3
	g_iartout.idemet[2]= 0x0
	g_iartout.idemet[3]= 0x1
	g_iartout.idemet[4]= 0x2
	index_660004623 = 5
	POINT BOUCLE
	SI index_660004623 < 11
	ALORS
		g_iartout.idemet[index_660004623]= 0x0
		index_660004623 = index_660004623 + 1
		SAUT BOUCLE
	FINSI
FINSI
index_660004623 = index_660004623 - 1
MOD_660004623=index_660004623%2
SI MOD_660004623!=0
ALORS
	VAL_660004623=((index_660004623/2) + 1)*8
	#trace1(" VAL1 : %d",VAL)
SINON
	VAL_660004623=(index_660004623/2)*8
	#trace1(" VAL2 : %d",VAL)
FINSI
#trace1( " VAL : %d",VAL)
#erreur = i_resize_tlv(g_iartout, "T3t1", "idemet", VAL)

# V3t1.4      IMSI

#trace("============Boucle1=================")
index_660004623=0
POINT BOUCLE1
SI index_660004623 < 15
ALORS
	g_iartout.IMSI[index_660004623]= 0x9
	index_660004623 = index_660004623 + 1
	#trace1(" index : %d",index)
	SAUT BOUCLE1
FINSI

# V3t1.5      DATE

date_660004623=i_get_art_field(g_iartin,$Tmib::DATE)
heure_660004623=i_get_art_field(g_iartin,$Tmib::HEURE)
icar_660004623=date_660004623+heure_660004623
#trace1("Tmib ddebut : %x",date+heure)
#trace1("Tmib ddebut : %x",icar)
erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::DATE,icar_660004623)

# V3t1.13       indeff

SI (MIBNOTIF_660004623 == 1) || (MIBSTATUS_660004623 == 1)
ALORS
	SI (status_660004623 == 0x02)
	ALORS
		res_660004623 = 0x00
	SINON
		res_660004623 = 0x01
	FINSI
SINON
	SI (MIBLOC_660004623 == 1)
	ALORS
		SI (status_660004623 == 0x00)
		ALORS
			res_660004623 = 0x00
		SINON
			res_660004623 = 0x01
		FINSI
	FINSI
FINSI
erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::indeff,res_660004623)

# V3t1.14       tterm

SI (i_valid_field_n(g_iartin, $Tdpvgsm::tentite))
ALORS
	res_660004623 = i_get_art_field(g_iartin, $Tdpvgsm::indeff)
	SI res_660004623 == 0X00
	ALORS
		erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::tterm,res_660004623)
	SINON
		erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::tterm,StatutMobile_660004623)
	FINSI
FINSI

# T3t2       idpart <> CalledMsisdn
index_660004623=0

# FO 82 : idpart a mettre a 99999999999F si CalledMsisdn a N/A
erreur_660004623 = i_get_art_str(g_iartin, $Tmib::CalledMsisdn, pt_CalledMsisdn_660004623) 
SI i_strcmp(pt_CalledMsisdn_660004623,C_NON_ACTIVE_660004623) == 0
ALORS
	POINT BOUCLE6
	SI index_660004623 < 11
	ALORS
		g_iartout.idpart[index_660004623] = 0x9
		index_660004623 = index_660004623 + 1
		SAUT BOUCLE6
	FINSI

	SAUT RESIZE_IDPART

#--F0402 URSLYON DEBUT 25/01/07
SINON
  trace("--------rentre dans le test------------")
  indiq_660004623 = -1
  length_660004623=i_strlen(pt_CalledMsisdn_660004623)
  POINT BOUCLE7
  indiq_660004623 = indiq_660004623 + 1
  SI (indiq_660004623 < length_660004623)
  ALORS
       	i_get_sub_str(pt_CalledMsisdn_660004623,indiq_660004623,indiq_660004623,pt_res1_660004623)
        resul_660004623=CONV_ASCIINUMDEC_INT_660004265(pt_res1_660004623)
        SI ( resul_660004623 > -1)
        ALORS
             trace1 ("--------resul=%d-------",resul_660004623)
             SAUT BOUCLE7
        SINON
             i_strcpy(pt_CHAMP_ERRONE_660004623, "CalledMsisdn")
		         code_rejet_660004623 = ERR_SYNTAX_660004623 + EFFICACE_660004623
		         erreur_660004623 = i_PlvMessEmettre(6055,2,g_iartin,"",3,code_rejet_660004623, pt_CHAMP_ERRONE_660004623, pt_CalledMsisdn_660004623)
             SAUT STOCKE_ERRONE
             trace ("---------non numerique---------")     
        FINSI
	  FINSI       


#---F0402 URSLYON FIN 25/01/07

FINSI


POINT BOUCLE2
##trace1( " ============= CalledTab = %x", g_iartin.CalledTab[index])
SI ((g_iartin.CalledTab[index_660004623] >= 0x30) && (g_iartin.CalledTab[index_660004623] <= 0x39) && (index_660004623 < 19) )
ALORS
	g_iartout.idpart[index_660004623]=g_iartin.CalledTab[index_660004623]- 0x30
	index_660004623=index_660004623+1
#	trace1(" index : %d",index)
	SAUT BOUCLE2
SINON
	SI (g_iartin.CalledTab[index_660004623] >= 0x4E)
	ALORS
		index_660004623=index_660004623+1
#		trace1(" index : %d",index)
		SI (g_iartin.CalledTab[index_660004623] >= 0x2F)
		ALORS
			index_660004623=index_660004623+1
#			trace1(" index : %d",index)
			SI (g_iartin.CalledTab[index_660004623] >= 0x41)
			ALORS
				index_660004623=0
				POINT BOUCLE3
				SI index_660004623 < 14
				ALORS
					g_iartout.idpart[index_660004623] = 0xF
					index_660004623=index_660004623 + 1
					SAUT BOUCLE3
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

POINT RESIZE_IDPART

#index=index -1



MOD_660004623=index_660004623%2
SI MOD_660004623!=0
ALORS
	VAL_660004623=((index_660004623/2) + 1)*8
#	trace1(" VAL1 : %d",VAL)
SINON
	VAL_660004623=(index_660004623/2)*8
#	trace1(" VAL2 : %d",VAL)
FINSI
#trace1( " VAL : %d",VAL)
erreur_660004623 = i_resize_tlv(g_iartout, "T3t2", "idpart", VAL_660004623)








# T3t4       MSISDN <> ContratId

#trace("============Boucle4=================")


# FO 54
size_contrat_660004623 = g_iartin.ContratIdTab!NELEM

index_660004623=0
POINT BOUCLE4
SI (index_660004623 < size_contrat_660004623)
ALORS
#trace1( " ============= ContratIdTab = %x", g_iartin.ContratIdTab[index])
	SI ((g_iartin.ContratIdTab[index_660004623] >= 0x30) && (g_iartin.ContratIdTab[index_660004623] <= 0x39))
	ALORS
		g_iartout.MSISDN[index_660004623]=g_iartin.ContratIdTab[index_660004623]- 0x30
		index_660004623=index_660004623+1
#		trace1(" index : %d",index)
		SAUT BOUCLE4
	SINON
		SI (g_iartin.ContratIdTab[index_660004623] >= 0x4E)
		ALORS
			index_660004623=index_660004623+1
#			trace1(" index : %d",index)
			SI (g_iartin.ContratIdTab[index_660004623] >= 0x2F)
			ALORS
				index_660004623=index_660004623+1
#				trace1(" index : %d",index)
				SI (g_iartin.ContratIdTab[index_660004623] >= 0x41)
				ALORS
					index_660004623=0
					POINT BOUCLE5
					SI index_660004623 < 5
					ALORS
						g_iartout.MSISDN[index_660004623] = 0xF
						index_660004623=index_660004623 + 1
						SAUT BOUCLE5
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

MOD_660004623=size_contrat_660004623%2
SI MOD_660004623!=0
ALORS
	VAL_660004623=(size_contrat_660004623 + 1) * 4
#	trace1(" VAL1 : %d",VAL)
SINON
	VAL_660004623=size_contrat_660004623 * 4
#	trace1(" VAL2 : %d",VAL)
FINSI
#trace1( " VAL : %d",VAL)
erreur_660004623 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", VAL_660004623)

# T3t7

erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::estalloc,icar_660004623)

# T3t35 2



#V3T30.1 date audit
#pt_marque_audit=i_LireMarqueAudit()
#date_audit=i_strtab(pt_marque_audit,0)*256*256*256 + i_strtab(pt_marque_audit,1)*256*256 + i_strtab(pt_marque_audit,2)*256 + i_strtab(pt_marque_audit,3)
# date audit en nb s depuis 1900 (BC191380 nb de s de 1/1/1900  a 1/1/2000)
#date_audit = (date_audit / 10) + 0xBC191380

date_audit_660004623 = i_date_audit()

# date_plat
date_plat_660004623 = i_DHgetLocalTime(NUMTAB_660004623, 7, date_audit_660004623)
#trace1("======== date_plat = %d ========",date_plat)
#trace1("======== date_audit = %d ========",date_audit)

erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,date_plat_660004623)

#V3T30.2 EEC
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004623 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405


########################################################
# Cpt applicatifs
########################################################


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

############################################################################
# Envoi vers IECC (dpv33)
############################################################################
#erreur = i_fdump_art(g_iartout)


#######################################
# Appel fonction distribution
#######################################
erreur_660004623 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_SPECIALE_660004623, Multidistribution_Non_660004623)
# QC1005
SI (erreur_660004623 == TRAI_KO_660004623)
ALORS
	trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
#	code_errone = 0xA0B0
#	code_errone = code_errone + EFFICACE
#	type_cra=i_get_art_field(g_iartout,$Tdpvgsm::type)
#	erreur = i_PlvMessEmettre(7500,2,g_iartin,"",3,code_errone,C_Article,type_cra)
	SAUT STOCKE_ERRONE
FINSI

RETOUR TRAIT_OK

#####################################################################
# POINT de branchement : stockage PT_OK
#####################################################################

POINT STOCKE_OK

erreur_660004623 = i_stocke_art(g_iartin, 0, PT_OK,0)

trace("Fin distribution Article Tmib")
RETOUR TRAIT_OK

#####################################################################
# POINT de branchement : stockage PT_ERRONE
#	       correspond au cas d'erreur syntaxiques et semantiques
#####################################################################

POINT STOCKE_ERRONE

trace("Stockage de l'article en ERRONE")

erreur_660004623 = i_make_art_rej(g_iartin, g_iartout, code_rejet_660004623)
erreur_660004623 = i_stocke_art(g_iartout, 0, PT_ERRONE, 0)

trace("Fin traitement Tmib")
RETOUR TRAIT_OK


###########################################################################
# Stockage en elimine
###########################################################################

POINT STOCKE_DIV
#IFDEF trace_niv1 = 1
trace( "Fin du Pcode de traitement MIB : Stockage en ELIMINE" )
#ENDIF
erreur_660004623 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK

#--------------------------- Fin Tmib_dis.src -------------------------------
