DEFINITION SORTANT_660004609 0
DEFINITION ENTRANT_660004609 1
DEFINITION RENVOIM_660004609 2
DEFINITION REACH_660004609 4
DEFINITION RENVREA_660004609 5
DEFINITION RENVOIG_660004609 6
DEFINITION TRANSIT_660004609 8
DEFINITION MsgCrtS_660004609 13
DEFINITION MsgCrtE_660004609 14
DEFINITION DUP_ALC_R4_660004609 0
DEFINITION DUP_ALC_R4_NO_SIM_660004609 1
DEFINITION DUP_ALC_R4_TRANSIT_660004609 2
DEFINITION DUP_ALC_R4_PSEUDO_660004609 3
DEFINITION DUP_ALC_R4_VPN_660004609 4
DEFINITION DUP_ALC_R4_VPN_32_660004609 5
DEFINITION DUP_ALC_R4_SORTANT_660004609 6
DEFINITION DUP_ALC_R4_MSG_CT_S_660004609 7
DEFINITION DUP_ALC_R4_MSG_CT_E_660004609 8
DEFINITION LG_SVCKEY_660004609 4
DEFINITION Multidistribution_Non_660004609 0
DEFINITION Multidistribution_Oui_660004609 1
DEFINITION DISTRIBUTION_SPECIALE_660004609 0
DEFINITION DISTRIBUTION_INCONNU_660004609 1
DEFINITION TRAI_KO_660004609 -1
DEFINITION MODULE_DISTR_660004609 0xA000
DEFINITION ERR_NORM_660004609 0x010
DEFINITION ERR_VALO_660004609 0x020
DEFINITION ERR_DUPL_660004609 0x0D0
DEFINITION ERR_DISTR_660004609 0x110
DEFINITION RNSAC_660004609 "RoutinNumberSac"
REGISTRE ENTIER flag_rdt_660004609
REGISTRE ENTIER date_cra_660004609
REGISTRE ENTIER date_fin_660004609
REGISTRE ENTIER AIG_pseudo_DPV_660004609
REGISTRE ENTIER indice_duplication_660004609
REGISTRE ENTIER type_cra_660004609
REGISTRE ENTIER pseudo_DPV_660004609
REGISTRE ENTIER erreur_660004609
REGISTRE ENTIER IMSI_present_660004609
REGISTRE ENTIER lien_present_660004609
REGISTRE ENTIER is_emergency_no_sim_660004609
REGISTRE ENTIER val_tlserv_660004609
REGISTRE ENTIER val_svcsup_660004609
REGISTRE ENTIER vsvcsup_660004609
REGISTRE ENTIER Q1_660004609
REGISTRE ENTIER Q2_660004609
REGISTRE ENTIER channel_type_660004609
REGISTRE ENTIER L3t6_660004609
REGISTRE ENTIER val_UMTSco_660004609
REGISTRE ENTIER vsystype_660004609
REGISTRE ENTIER tailleChpTrans_660004609
REGISTRE ENTIER lg_INserv_660004609
REGISTRE ENTIER nbsvcIN_660004609
REGISTRE ENTIER num_660004609
REGISTRE ENTIER octet_660004609
REGISTRE ENTIER taille_ISDN_660004609
REGISTRE ENTIER fnur_present_660004609
REGISTRE ENTIER userRate_660004609
REGISTRE ENTIER userProtocol_660004609
REGISTRE ENTIER tranInd_660004609
REGISTRE ENTIER CSDaddInfo_val_660004609
REGISTRE ENTIER MPTYM_present_660004609
REGISTRE ENTIER duration1_660004609
REGISTRE ENTIER duration2_660004609
REGISTRE ENTIER duration3_660004609
REGISTRE ENTIER duration_val_660004609
REGISTRE ENTIER occurenceNb_val_660004609
REGISTRE ENTIER participantsNb_val_660004609
REGISTRE ENTIER mptys_present_660004609
REGISTRE ENTIER lg_camel_660004609
REGISTRE ENTIER lg_camel2_660004609
REGISTRE ENTIER indice_chp_camel_660004609
REGISTRE ENTIER taille_660004609
REGISTRE ENTIER lg_CRNMSCId_660004609
REGISTRE ENTIER lg_CRN_660004609
REGISTRE ENTIER offset_CRN_660004609
REGISTRE ENTIER lg_MSCId_660004609
REGISTRE ENTIER offset_MSCId_660004609
REGISTRE ENTIER lg_lastSCPNb_660004609
REGISTRE ENTIER offset_lastSCPNb_660004609
REGISTRE ENTIER nb_camel_660004609
REGISTRE ENTIER lg_numero_660004609
REGISTRE ENTIER lg_SCPAddress1_660004609
REGISTRE ENTIER offset_SCPAddress1_660004609
REGISTRE ENTIER offset_svckey1_660004609
REGISTRE ENTIER C_servkey_660004609
REGISTRE ENTIER lg_NewNumSCP1_660004609
REGISTRE ENTIER offset_NewNumSCP1_660004609
REGISTRE ENTIER offset_infoGiven1_660004609
REGISTRE ENTIER lg_SCPAddress2_660004609
REGISTRE ENTIER offset_SCPAddress2_660004609
REGISTRE ENTIER offset_svckey2_660004609
REGISTRE ENTIER lg_NewNumSCP2_660004609
REGISTRE ENTIER offset_NewNumSCP2_660004609
REGISTRE ENTIER offset_infoGiven2_660004609
REGISTRE ENTIER offset_FCIdata1_660004609
REGISTRE ENTIER offset_IP1_660004609
REGISTRE ENTIER offset_IP2_660004609
REGISTRE ENTIER ZBPrefixVal_660004609
REGISTRE ENTIER ZBPrefixDigit1_660004609
REGISTRE ENTIER ZBPrefixDigit2_660004609
REGISTRE ENTIER ZBPrefixDigit3_660004609
REGISTRE ENTIER ZBPrefixDigitD_660004609
REGISTRE ENTIER ZBPrefixDigitO_660004609
REGISTRE ENTIER ZBPrefixDigitT_660004609
REGISTRE ENTIER indice_chp_prefix_660004609
REGISTRE ENTIER RoutingNumberVal_660004609
REGISTRE ENTIER RoutingNumberError_660004609
REGISTRE ENTIER RoutingNumberTmpVal_660004609
REGISTRE ENTIER RoutingNumberTmpVal2_660004609
REGISTRE ENTIER RoutingNumberLong_660004609
REGISTRE ENTIER RoutingNumberTON_660004609
REGISTRE ENTIER RoutingNumberNPI_660004609
REGISTRE ENTIER MNP_present_660004609
REGISTRE ENTIER portab_status_660004609
REGISTRE ENTIER port_proc_invok_660004609
REGISTRE ENTIER TON_origLocNum_660004609
REGISTRE ENTIER NPI_origLocNum_660004609
REGISTRE ENTIER origLocNum_present_660004609
REGISTRE ENTIER is_roamers_660004609
REGISTRE ENTIER is_roamers_court_660004609
REGISTRE ENTIER idpart_not_00_660004609
REGISTRE ENTIER is_sortant_VPN_660004609
REGISTRE ENTIER is_sortant_VPN32_660004609
REGISTRE ENTIER taille_lien_660004609
REGISTRE ENTIER taille_local_660004609
REGISTRE ENTIER taille_idpart_660004609
REGISTRE ENTIER val_svckey1_660004609
REGISTRE ENTIER val_tentite_660004609
REGISTRE ENTIER calledNumber_present_660004609
REGISTRE ENTIER lg_buf_660004609
REGISTRE ENTIER val_nbUT_660004609
REGISTRE ENTIER res_660004609
REGISTRE ENTIER Prefix_sav_660004609
REGISTRE ENTIER IMSI_OrangeCo_660004609
REGISTRE ENTIER LocalLengt_660004609
REGISTRE ENTIER PREFIXjoig_660004609
REGISTRE ENTIER long_660004609
REGISTRE ENTIER indice_660004609
REGISTRE POINTEUR pt_local_660004609
REGISTRE POINTEUR pt_PrefixJoing_660004609
REGISTRE POINTEUR pt_PrefixJoingDCB_660004609
REGISTRE POINTEUR pt_portjoing_660004609
REGISTRE POINTEUR pt_IMSI_660004609
REGISTRE POINTEUR pt_MCCMNC_660004609
REGISTRE POINTEUR pt_conteneur_660004609
REGISTRE POINTEUR pt_PrefixeSVA_660004609
REGISTRE POINTEUR pt_PrefixeSVADCB_660004609
REGISTRE ENTIER longueur_660004609
REGISTRE ENTIER is_roamers_special_660004609
REGISTRE ENTIER val_elem_660004609
REGISTRE ENTIER origine_660004609
REGISTRE POINTEUR pt_BUF_660004609
REGISTRE POINTEUR str_svckey1_660004609
REGISTRE POINTEUR pt_cleVPN_660004609
REGISTRE POINTEUR pt_cle_CellID_OF_660004609
REGISTRE POINTEUR pt_idpart_660004609
REGISTRE POINTEUR pt_CleRoutingNumberSAC_660004609
REGISTRE POINTEUR pt_portabilite_660004609
REGISTRE ENTIER code_rejet_660004609
REGISTRE ENTIER EFFICACE_660004609
REGISTRE ENTIER MODULE_660004609
REGISTRE ENTIER ERREUR_660004609
REGISTRE ENTIER OMOFPrefix_index_660004609
REGISTRE POINTEUR pt_pref_OMOF_660004609
REGISTRE POINTEUR pt_omof_660004609
REGISTRE ENTIER longueur_pref_660004609
REGISTRE ENTIER flag_pref_idpart_660004609
REGISTRE ENTIER flag_pref_local_660004609
REGISTRE ENTIER date_table_660004609
REGISTRE ENTIER bT3T8ITX_660004609
REGISTRE POINTEUR ptr_valeurDATE_660004609
REGISTRE POINTEUR ptr_date_res_660004609
#########################################################################
#    Article ALCATEL U1X -- Module de Distribution TcitR4_dis.src
#
#    Creation 26/09/05 Par : MP
#
# g_iartout  Tdpvgsm
# g_iartout2 Tnormal
# g_iartout5 TnormalHAscii
# g_iartout6 TnormalHAscii
# g_iartout7 TnormalHAscii
# g_iartout11 Rejet
# g_iartout12 : sauvegarde de l'article IN (g_iartin)
#
#########################################################################
# Date : 08/03/2006
# Auteur: RAS
# FE 0007 : Traitement RN pour le cas TRANSIT dans le numero demande
#           Nouvelles regles de normalisations pour le type TRANSIT (Format National)
#           Troncature des numeros au format international
# Date : 27/03/2006
# FE 0009 : Maj T3t1/scvsup T3t1/tlserv , T3t6/PortOrigNet
#
# 14/02/2007 - JLG - G3R0CzME : Modification de la normalisation des types 08 (TRANSIT)
# 23/05/2007 - JLG - FO518 et FO519
# 28/06/2007 - RHE - G1R4 - Cell_id: Alimentation de V4T52.1 par camel2/FCIdata
# 23/07/2007 - RHE - G1R4 : FO 550 : correction offset camel2/FCIdata
# 03/07/2007 - DRE - G1R4 - Cell_id: Alimentation de V4T52.1 par camel2/FCIdata modif suite mail Issam du 02/08/07 18:15
# 17/08/2007 - PKH - G1R5 - caracteres # et/ou * admisent pour Roamer_court et Roamer
# 22/01/2008 - PSA - G1R6 - modification du traitement du prefixe Routing Number
# 14/02/2008 - PKH - G1R6 - G1R6 lot 3 Suppression du code SAC dans le champ local pour le dc REACH
# 14/02/2008 - JLG - G1R8 - lot1 suppression du prefixe ZB pour Le type RENVREA dans le champ T3t3 (local)
# 29/10/2008 - JLG - G2R1 - lot1 Item : Fiabilisation CRA Zone Blanche
# 14/11/2008 - JLG - G2R1 - lot2 Item : OMOF
# 02/12/2008 - JLG - G2R1 - QC265 : si RN pas d'OMOF
# 11/02/2009 - JLG - G2R1 - QC326 (OMOF : test longueur)
# 15/04/2009 - DRE - G2R2 - Fiabilisation CRAs Zone Blanche Complement spec: CRA_ALCATEL_Circuit_R7_A22.0.doc
# 06/11/2009 - PKH - G2R5 - Fiabilisation des CRAs ZB entrant pour les cras 0x08 et Ox04 V3T34  lot2
# 21/01/2010 - JLG - G2R6 - evol, QC534 : IMSI <> 20801 comme au GSMCE au lieu de <> 208
# 11/06/2010 - JLG - G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2,
#                               ajout champ T3t55 (GFlag2) et T3t56 (GValue)
# 22/11/2010 - JLG - G3R1lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 10/03/2011 - JLG - G3R2C4 fusion G3R1C600 avec G3R2C3 (ajout champ T3t99)
# 16/03/2011 - PKH - G3R3 lot2 Mapping ABC
# 13/04/2011 - PKH - G3R3 lot3 Curling_Free
# 06/07/2011 - JLG - QC896 champ T3t63 (LastCallingNb)
# 06/07/2011 - PKH - G3R4 lot1 Gestion du prefixe de portabilite pour les SVA
# 08/08/2011 - PKH - G3R4 QC903 traitement du prefix sva a l'identique de RN pour type 0x04 et 0x05
# 08/07/2011 - PKH - G3R4 QC905 G3R4 controle de la longueur du champ idpart et local avant traitement des prefix
# 10/08/2011 - PKH - G3R4 QC910 Libelle V3t70 PrefixeSVA au lieu de PrefixeSAV
# 23/08/2011 - PKH - G3R4 QC914 V3t12 portpref doit etre absent si prefix SVA detecte (present pour prefix RN)
# 23/08/2011 - PKH - G3R4 QC915 Creation du champ V3t70 si le prefix SVA est detecte
# 29/02/2012 - JLG -G3R6 QC1005 modif alarme retour aiguillage
# 04/05/2012 - PKH - G3R7 - Gestion du code MNC pour les MVNOs Lights
# 24/10/2012 - PKH - G3R8 lot2 Prefix de joignabilite
# 04/12/2012 - PKH - QC1148 generation du T3t63 pour les MsgCrtE
# 10/01/2013 - PKH - QC1154 generation du T3t63 pour les MsgCrtE
# 22/05/2013 - JLG - G3R10 lot2 : Modification prefixe itinerance Free et Full MVNO
# 05/07/2013 - JLG - G3R10 QC1237 prefixe 9033 ou 9133
# 11/02/2014 - JLG - G5R1 QC1331, Built 3 : Changement Marque Audit
# 01/04/2014 - RHE - G5R1 Modification de l'alimentation du champ V3t8 ITX
# 20/05/2014 - RHE - G5R1 Modification de l'alimentation du champ V3t8 ITX (QC 1386)
# 02/07/2014 - JLG -G5R1 QC1405, champ eec du DPV si g_ieec > 500
###########################################################################
# Declaration des constantes








# Declaration des variables
#AIG_pseudo_DPV pour aiguille un pseudo DVP cree
# FE_0007
#G2R1 lot1 : ZB_idpart et ZB_local remplacees par ZBPrefixVal
#G3R4 lot1 Prefix sav
#G3R7
#G3R8 Lot2

#G3R8 Lot2




#G3R3 lot3 Curling_Free

#G1R5
#G1R6
# G3R0CzME
# /G3R0CzME

#G1R4
#Fin G1R4

#G1R5
#Fin G1R5


#G3R3lot3 Curling_free

#G1R6

# G2R1 lot2, OMOF

#\G2R1 lot2
#G3R10
trace("")
trace("**** TcitR4 : Module de distribution : Debut ****")

# Initialisation des variables
#G3R10
flag_pref_idpart_660004609 = 0
flag_pref_local_660004609 = 0
pt_omof_660004609="pt_omof12345678901"
i_strcpy(pt_omof_660004609, "")

AIG_pseudo_DPV_660004609 = -1
indice_duplication_660004609 = DUP_ALC_R4_660004609
pseudo_DPV_660004609 = 0
erreur_660004609 = 0
is_emergency_no_sim_660004609 = 0
#G2R1 lot1 : ZB_idpart et ZB_local remplacees par ZBPrefixVal
ZBPrefixVal_660004609 = -1
#OMOFPrefix_index = -1
is_roamers_660004609 = 0
is_roamers_court_660004609 = 0
idpart_not_00_660004609 = 0
is_sortant_VPN_660004609 = 0
is_sortant_VPN32_660004609 = 0
is_roamers_special_660004609 = 0
longueur_660004609 = 0
Prefix_sav_660004609 = -1
IMSI_OrangeCo_660004609 = 0

LocalLengt_660004609 = 0
PREFIXjoig_660004609 = 0
long_660004609 = 0
indice_660004609 = 0

str_svckey1_660004609 = "-str_svckey"
pt_cleVPN_660004609 ="ALCATEL_VPN31_4294967295"
# G3R0CzME
pt_BUF_660004609 = "111111111111111111111111111111111111111111111111111111111111111111111111111"
# /G3R0CzME

# G1R4
pt_cle_CellID_OF_660004609 = "pt_cle_CellID_OF22222222222222222222222222222222"
# Fin G1R4
# G1R5
pt_idpart_660004609 = "pt_idpart91291291291291291291291299129129129192192919291291291902919299129919291229192991"
#Fin G1R5
pt_CleRoutingNumberSAC_660004609 = "pt_CleRoutingNumberSAC"

#G3R3 lot3 Curling Free

pt_portabilite_660004609 = "pt_portabilite7070707707070707070707"
#/G3R3 lot3 Curling Free

pt_PrefixeSVA_660004609 = "pt_PrefixeSVA7373737373737373737373737373737373737373737377373"
pt_PrefixeSVADCB_660004609 = "pt_PrefixeSVADCB9393939393933939393939393939393939399339393933"

pt_IMSI_660004609 = "pt_IMSI95959595995595959595959595959595595959595959595959595959595955959"
pt_MCCMNC_660004609 = "pt_MCCMNC345345345345345345343543534353435343534354353435345334353453345"
pt_conteneur_660004609 = "pt_conteneur38973893789387938789837938739387938773983738978339783937839"
#G1R6

pt_local_660004609 = "pt_local94949494994949494949494949494949494949494949"
pt_PrefixJoing_660004609 = "pt_PrefixJoing353535353353535353553"
pt_PrefixJoingDCB_660004609 = "pt_PrefixJoingDCB768678767876567876565677867656"
pt_portjoing_660004609 = "pt_portjoing040404040404040404040404040"
pt_pref_OMOF_660004609 = "pt_pref_OMOF91291291291291291291291299129129129192192919291291291902919299129919291229191"

i_strcpy(str_svckey1_660004609,"")
i_strcpy(pt_cleVPN_660004609,"")
i_strcpy(pt_cle_CellID_OF_660004609,"")
i_strcpy(pt_idpart_660004609,"")
i_strcpy(pt_CleRoutingNumberSAC_660004609,"")
i_strcpy(pt_portabilite_660004609,"")
i_strcpy(pt_PrefixeSVA_660004609,"")
i_strcpy(pt_PrefixeSVADCB_660004609,"")
i_strcpy(pt_IMSI_660004609,"")
i_strcpy(pt_MCCMNC_660004609,"")
i_strcpy(pt_conteneur_660004609,"")
i_strcpy(pt_local_660004609,"")
i_strcpy(pt_PrefixJoing_660004609,"")
i_strcpy(pt_PrefixJoingDCB_660004609,"")
i_strcpy(pt_portjoing_660004609,"")

EFFICACE_660004609 = 1
MODULE_660004609 = MODULE_DISTR_660004609
ERREUR_660004609 = 0
code_rejet_660004609 = 0

#G5R1
ptr_valeurDATE_660004609 ="ptr_valeurDATE0123456789"
ptr_date_res_660004609 ="ptr_date_res0123456789"
i_strcpy (ptr_valeurDATE_660004609,"")
i_strcpy (ptr_date_res_660004609,"")

# OGA-227/230  sauvegarde de l'article IN
erreur_660004609= i_dup_art_id(g_iartin , g_iartout12)
erreur_660004609 = i_cree_art("Conv_URS",g_iartout9)

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

SI (flag_rdt_660004609 == 0)
ALORS
  erreur_660004609 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004609 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)


####################################################################
# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004609=i_get_art_field(g_iartin,$TcitR4::dfin)
erreur_660004609= i_incr_redist_dist_660004265(date_fin_660004609)

#G5R1
####################################################################################
# Modification de l'alimentation du champ T3t8 ITX
# bT3T8ITX : 1 si DATEFIN_ITX absent de table VariableContexte ou si  date_cra < DATEFIN_ITX
####################################################################################

date_cra_660004609 = i_get_art_field(g_iartin,$TcitR4::DATE)
        
bT3T8ITX_660004609 = 0
date_table_660004609 = 0
SI(i_get_tab_field("VariableContexte",date_cra_660004609,"DATEFIN_ITX") == g_inull)
ALORS
	trace("DATEFIN_ITX Absent de la table VariableContexte -> msgITX present")
	bT3T8ITX_660004609 = 1
SINON        
	i_strcpy(ptr_valeurDATE_660004609, i_get_tab_field("VariableContexte", date_cra_660004609, "DATEFIN_ITX"))
	i_get_sub_str(ptr_valeurDATE_660004609,2,-1,ptr_date_res_660004609)
	erreur_660004609 = i_cree_art("Conv_URS", g_iartout7)
	erreur_660004609 = i_set_art_str (g_iartout7,$Conv_URS::DATE,ptr_date_res_660004609)
	date_table_660004609 = i_get_art_field(g_iartout7, $Conv_URS::DATEN)
  trace1(" date_cra   = %d", date_cra_660004609)
	trace1(" date_table = %d", date_table_660004609)
  SI (date_cra_660004609 < date_table_660004609)
  ALORS       
  	trace("date_cra < date_table -> msgITX present")
  	bT3T8ITX_660004609 = 1
  FINSI
FINSI	    

#================================================================#
# Determibation du booleen  IMSI_OrangeCo pour les MVNO ligths   #
#================================================================#
#G3R7
SI (i_valid_field_n(g_iartin, $TcitR4::IMSI))
ALORS
  erreur_660004609 = i_get_art_str(g_iartin, $TcitR4::IMSI, pt_IMSI_660004609)
  SI (i_strplcmp (pt_IMSI_660004609,"20801",0,5) == 0)
  ALORS
    IMSI_OrangeCo_660004609 = 1
  SINON
    SI (i_strplcmp(pt_IMSI_660004609,"208",0,3) == 0)
    ALORS
      i_get_sub_str(pt_IMSI_660004609,0,4,pt_MCCMNC_660004609)
      erreur_660004609 = i_format_str2( pt_conteneur_660004609, "%s%s", "L_", pt_MCCMNC_660004609)
      SI (i_get_tab_field("MVNO", date_fin_660004609, pt_conteneur_660004609)) != g_inull
      ALORS
        IMSI_OrangeCo_660004609 = 1
      FINSI
    FINSI
  FINSI
SINON
  IMSI_OrangeCo_660004609 = 0
FINSI

#/G3R7

####################################################################
# Determination si besoin de creer un pseudoDPV
####################################################################
#G3R7 ajout de la condition IMSI_OrangeCo == 0
#suppression de la condition IMSI <> 20801
type_cra_660004609 = i_get_art_field(g_iartin, $TcitR4::type)
# QC534 : IMSI <> 20801 comme au GSMCE au lieu de <> 208
# Si IMSI  non Orange France ( <> 20801 ), on generera un pseudo DPV
SI ( type_cra_660004609 == RENVOIM_660004609 && IMSI_OrangeCo_660004609 == 0)
ALORS
  pseudo_DPV_660004609 = 1
FINSI

#\G3R7
####################################################################
#  Reorganisation du champ local
erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)

####################################################################
# Traitement des Messages Courts Entrants et Sortants
####################################################################
val_tlserv_660004609 = i_get_art_field(g_iartin, $TcitR4::tlserv)
SI ((type_cra_660004609 == 1) && (val_tlserv_660004609 == 0x21))
ALORS
  trace ("Traitement des messages courts entrants")
  type_cra_660004609 = MsgCrtE_660004609
FINSI
SI ((type_cra_660004609 == 0) && (val_tlserv_660004609 == 0x22))
ALORS
  trace ("Traitement des messages courts sortants")
  type_cra_660004609 = MsgCrtS_660004609
FINSI

SI ((type_cra_660004609 == MsgCrtS_660004609) || (type_cra_660004609 == MsgCrtE_660004609))
ALORS

  SI (type_cra_660004609 == MsgCrtS_660004609)
  ALORS
    indice_duplication_660004609 = DUP_ALC_R4_MSG_CT_S_660004609
  SINON
    indice_duplication_660004609 = DUP_ALC_R4_MSG_CT_E_660004609
  FINSI

# Generation du DPV
  trace1("table duplication utilisee : <%d>",indice_duplication_660004609)
  erreur_660004609 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",indice_duplication_660004609)
  SI (erreur_660004609 != 0)
  ALORS
    trace("Erreur de duplication")
    ERREUR_660004609 = ERR_DUPL_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8284, 2,  g_iartout12, "", 3, code_rejet_660004609, type_cra_660004609, "Tdpvgsm")
    SAUT STOCKE_ERRONE
  FINSI
  
#G5R1
# Ajout de T3t8/msgITX si (bT3T8ITX == 1) et indice_duplication == {0, 1, 2, 3, 4, 5, 6}
SI (bT3T8ITX_660004609 == 1) && 
	  ((indice_duplication_660004609 == 0) 
	  || (indice_duplication_660004609 == 1) 
	  || (indice_duplication_660004609 == 2) 
	  || (indice_duplication_660004609 == 3) 
	  || (indice_duplication_660004609 == 4) 
	  || (indice_duplication_660004609 == 5) 
	  || (indice_duplication_660004609 == 6))
ALORS
	SI (i_valid_field_n(g_iartin,$TcitR4::msgITX))
  ALORS
		erreur_660004609 = i_ajout_tlv(g_iartout,"T3t8","")
  	erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcitR4::msgITX))
		trace ("Ajout du champ msgITX")
	FINSI
FINSI


# Traitement specifique pour les MsgCrtS
  SI (type_cra_660004609 == MsgCrtS_660004609)
  ALORS
# MAJ du champ V3t2 (Idpart)
    calledNumber_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::idpart)
    SI (calledNumber_present_660004609)
    ALORS
      erreur_660004609 = i_test_field_ila_off_n(g_iartin,$TcitR4::idpart,"Lrnis",1)
      SI (erreur_660004609 != 0)
      ALORS
# On est dans le Cas IMSI Roamer
# Le cas Non Roamer est envoye en errone si il n'est pas au format Lrnis
        erreur_660004609 = rm_escape_char_end_660004265(g_iartin, $TcitR4::idpart)
        taille_idpart_660004609 = i_get_art_field(g_iartin, $TcitR4::idpart-1)
        erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
        trace("Echec normalisation : copie sans TON+NPI")
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_IDENT,0)
        SI (erreur_660004609 != 0)
        ALORS
          trace("Erreur duplication champ idpart")
          ERREUR_660004609 = ERR_NORM_660004609
          code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
          erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609,"idpart", 0)
          SAUT STOCKE_ERRONE
        FINSI
      SINON
        erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_EVOL_IDPART,0)
        SI ( erreur_660004609 != 0 )
        ALORS
          SI ((i_get_art_fieldtab(g_iartin, $TcitR4::IMSI, 4) != 1 ) &&
            (i_get_art_fieldtab(g_iartin, $TcitR4::IMSI, 3) != 0 ) &&
            (i_get_art_fieldtab(g_iartin, $TcitR4::IMSI, 2) != 8 ) &&
            (i_get_art_fieldtab(g_iartin, $TcitR4::IMSI, 1) != 0 ) &&
            (i_get_art_fieldtab(g_iartin, $TcitR4::IMSI, 0) != 2 ))
          ALORS
            taille_idpart_660004609 = i_get_art_field(g_iartin, $TcitR4::idpart-1)
            erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
            trace("Echec normalisation : copie sans TON+NPI")
            erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_IDENT,0)
            SI (erreur_660004609 != 0)
            ALORS
              trace("Erreur duplication champ idpart")
              ERREUR_660004609 = ERR_NORM_660004609
              code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
              erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609,"idpart", 0)
              SAUT STOCKE_ERRONE
            FINSI
          SINON
            trace("Erreur duplication champ idpart")
            ERREUR_660004609 = ERR_NORM_660004609
            code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
            erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609,"idpart", 0)
            SAUT STOCKE_ERRONE
          FINSI
        FINSI
      FINSI
    FINSI

#   Ajout du champ V4t38.1 origCallpartId
    calledNumber_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::idpart)
    SI (calledNumber_present_660004609)
    ALORS
      erreur_660004609 = i_cree_art("TnormalHAscii", g_iartout5)
      erreur_660004609 = i_ajout_tlv(g_iartout5, "T3t1", "buf")
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout5, $TcitR4::idpart, $TnormalHAscii::buf, -$NORM:AUT_IDENT,0)
      res_660004609 = i_get_art_field(g_iartout5, $TnormalHAscii::buf -1)
      erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.1","")
      erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout5.buf[], res_660004609)
      erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004609)
    FINSI

# Ajout du champ V4t38.2 dialledDigits
    calledNumber_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::idpart)
    SI (calledNumber_present_660004609)
    ALORS
      lg_buf_660004609 = i_get_art_fieldlength(g_iartin,$TcitR4::idpart)
      trace1("Longueur idpart :<%d>",lg_buf_660004609)
      SI( lg_buf_660004609 > 2 )
      ALORS
        erreur_660004609 = i_cree_art("TnormalHAscii", g_iartout7)
        erreur_660004609 = i_ajout_tlv(g_iartout7, "T3t1", "buf")
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout7, $TcitR4::idpart, $TnormalHAscii::buf, -$NORM:CIT_IDENT,0)
        res_660004609 = i_get_art_field(g_iartout7, $TnormalHAscii::buf -1)
        erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.2","")
        erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::dialledDigits, g_iartout7.buf[], res_660004609)
        erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.2","dialledDigits", res_660004609)
      FINSI
    FINSI
  FINSI


# Ajout du champ V4t38.3 equipmentType
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.3","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.3","equipmentType",1)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::equipmentType, 0x01)

# Ajout du champ CSD additionnal infos (T3t37)
  fnur_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::FNUR)
  SI ( fnur_present_660004609 )
  ALORS
    userRate_660004609 = i_get_art_field(g_iartin, $TcitR4::FNUR)
  SINON
    userRate_660004609 = 0xFF
  FINSI

  userProtocol_660004609 = 0xFF
  tranInd_660004609 = 0xFF

  SI (userRate_660004609 != 0xFF)
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout,"T3t37","")
    erreur_660004609 = i_resize_tlv(g_iartout,"T3t37","CSDaddInfo",3)
    CSDaddInfo_val_660004609 = userRate_660004609 * 0x10000 + userProtocol_660004609 *0x100 + tranInd_660004609
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::CSDaddInfo,CSDaddInfo_val_660004609)
  FINSI

# Mise a jour du champ systype
  val_UMTSco_660004609 = i_get_art_field(g_iartin, $TcitR4::UMTSco)
  SI (val_UMTSco_660004609==-1)
  ALORS
    vsystype_660004609 = 0x00
  SINON
    SI (val_UMTSco_660004609==0x01)
    ALORS
      vsystype_660004609 = 0x01
    SINON
      vsystype_660004609 = 0x00
    FINSI
  FINSI
  erreur_660004609 = i_set_art_field(g_iartout,$Tdpvgsm::systype,vsystype_660004609)

####################################################################
# Mise a jour du champ portOrigNet (T3t6)
# FE_0009 : copie de LocationNumber sans TON et NPI
####################################################################

# On verifie que le champ origLocNumber est present
  origLocNum_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::LocationNum)
  SI (origLocNum_present_660004609)
  ALORS
    SI (i_get_art_field(g_iartin, $TcitR4::LocationNum-1) == 0)
    ALORS
      origLocNum_present_660004609 = 0
    FINSI
  FINSI
# Si le champ est absent le T3t6 du DPV sera absent
  SI (origLocNum_present_660004609)
  ALORS
    SI (i_get_art_field(g_iartin, $TcitR4::LocationNum-1) >= 2)
    ALORS
      TON_origLocNum_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::LocationNum, 0)
      NPI_origLocNum_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::LocationNum, 1)
# PortOrigNet sera absent du DPV si en entree le champ
# OrigLocNumber a un TON NPI different de A1
      SI ( (TON_origLocNum_660004609 == 0xA) && (NPI_origLocNum_660004609 == 1) )
      ALORS
        erreur_660004609 = i_ajout_tlv(g_iartout,"T3t6","")

# copie de LocationNumber sans le TONNPI
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcitR4::LocationNum, $Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
        SI ( erreur_660004609 != 0 )
        ALORS
          trace("Erreur duplication champ portOrigNet")
          ERREUR_660004609 = ERR_NORM_660004609
          code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
          erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12,"", 2, code_rejet_660004609, "portOrigNet", 0)
          SAUT STOCKE_ERRONE
        FINSI
      FINSI
    FINSI
  FINSI

#Correction de la QC1154 generation du champ DPV V3t63 pour les Msg court entrant
  SI (type_cra_660004609 == MsgCrtE_660004609)
  ALORS
    SI (i_valid_field_n(g_iartin,$TcitR4::idpart))
    ALORS
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t63", "LastCallingNb")
      erreur_660004609 = i_dup_chp_1val(g_iartout, g_iartout, $Tdpvgsm::idpart, $Tdpvgsm::LastCallingNb)
      # pour le calcul du champ T3t63 du pseudo_DPV (present si type_cra == RENVOIM)
      erreur_660004609 = i_dup_chp_1val(g_iartout, g_iartout9, $Tdpvgsm::LastCallingNb, $Conv_URS::idpart)
    FINSI
  FINSI

# Mise a jour des champ timeInCE et eec (T3t30)
  # QC1331
  #erreur=set_timeInCE_EEC(0)
  ########### Date_Audit
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
  ########### eec
# QC1405
  SI (g_ieec > 500)
  ALORS
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
  SINON
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
  FINSI
#/QC1405

  SAUT STOCK_DPV
FINSI


####################################################################
# Detection des Cas des SORTANT VPN et SORTANT VPN 32
####################################################################

SI (type_cra_660004609 == SORTANT_660004609)
ALORS
  lg_INserv_660004609 = i_get_art_field(g_iartin, ($TcitR4::INserv)-1)
  SI ( lg_INserv_660004609 > 0 )
  ALORS
    nbsvcIN_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::INserv, 0)
    SI ( nbsvcIN_660004609 >= 1)
    ALORS
      val_svckey1_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::INserv, 1)*256 +
      i_get_art_fieldtab(g_iartin, $TcitR4::INserv, 2)
      SI (val_svckey1_660004609 != 0)
      ALORS
        trace1("Valeur de val_svckey1 : <%d>", val_svckey1_660004609)

#FE_0007 Ajout table des marques VPN

        erreur_660004609=i_EntierToString(val_svckey1_660004609,str_svckey1_660004609,11)
        trace2("Service Key1 du CAMEL :<%s> ",str_svckey1_660004609,"")
        erreur_660004609=i_format_str2(pt_cleVPN_660004609,"%s%s","ALCATEL_VPN31_",str_svckey1_660004609)
        date_cra_660004609=i_get_art_field(g_iartin,$TcitR4::DATE)
        SI(i_get_tab_field("Marque_VPN",date_cra_660004609,pt_cleVPN_660004609)!=g_inull)
        ALORS
          trace("TcitR4:type sortant VPN3.1")
          is_sortant_VPN_660004609 = 1
#                                           indice_duplication = DUP_ALC_R4_VPN
        FINSI
      FINSI
    FINSI
  FINSI
  lg_camel_660004609 = i_get_art_field(g_iartin, ($TcitR4::camel-1))

#ANO PVCS 2166 test sur les deux champ Camel phase 1 et phase 2 pour detecter les VPNs

  SI(lg_camel_660004609 > 0)
  ALORS
    indice_chp_camel_660004609=$TcitR4::camel
  SINON
    indice_chp_camel_660004609=$TcitR4::camel2
  FINSI
  taille_660004609=0
  lg_lastSCPNb_660004609 = i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, 0)
  taille_660004609 = lg_lastSCPNb_660004609 + 1
# Sous champ  "Number Of Invoked CAMEL Services"
  taille_660004609 = taille_660004609 + 1
# Sous champ "SCP Address (item 1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, taille_660004609)
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 1
# Sous champ "Storage Of Service Key (item 1)"
# ANO PVCS 1954
  C_servkey_660004609 = (i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, taille_660004609)*0x1000000 +
  i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, taille_660004609+1)*0x10000 +
  i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, taille_660004609+2)*0x100 +
  i_get_art_fieldtab(g_iartin, indice_chp_camel_660004609, taille_660004609+3))
  SI (C_servkey_660004609 != 0)
  ALORS
    trace1("Valeur de C_servkey : <%d>", C_servkey_660004609)
#FE_0007 Ajout table des marques VPN

    erreur_660004609=i_EntierToString(C_servkey_660004609,str_svckey1_660004609,11)
    trace2("Storage of service key du CAMEL :<%s> ",str_svckey1_660004609,"")
    erreur_660004609=i_format_str2(pt_cleVPN_660004609,"%s%s","ALCATEL_VPN32_",str_svckey1_660004609)
    date_cra_660004609=i_get_art_field(g_iartin,$TcitR4::DATE)
    SI (i_get_tab_field("Marque_VPN",date_cra_660004609,pt_cleVPN_660004609)!=g_inull)
    ALORS
      trace("TcitR4 :type sortant VPN3.2")
      is_sortant_VPN32_660004609 = 1
    FINSI
  FINSI
FINSI

# FE_007S0F5  memorisation du numero partenaire

SI(type_cra_660004609 == SORTANT_660004609 )
ALORS
  SI(i_valid_field_n(g_iartin, $TcitR4::idpart))
  ALORS
    erreur_660004609 = i_cree_art("TnormalHAscii", g_iartout6)
    erreur_660004609 = i_ajout_tlv(g_iartout6, "T3t1", "buf")
    erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout6, $TcitR4::idpart, $TnormalHAscii::buf, -$NORM:AUT_IDENT,0)
  FINSI
FINSI

#FE_0007 supression du prefixe 77A du champ idpart au format inconnu 8[0,1]*

SI( ((is_sortant_VPN_660004609 == 1) || (is_sortant_VPN32_660004609 == 1)) && (i_valid_field_n(g_iartin,$TcitR4::idpart) != 0))
ALORS
  SI((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0)==0x8)&&
    ((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1)==0x0)||
    (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1)==0x1) ))
  ALORS
    SI( (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,2)==0x7)&&
      (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,3)==0x7)&&
      (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,4)==0xA)  )
    ALORS
      trace("FE_0007 type sortant VNP prefixe par 77A")
      erreur_660004609=i_set_art_fieldtab(g_iartin,$TcitR4::idpart,2,0xF)
      erreur_660004609=i_skip_f_in_field_n(g_iartin,$TcitR4::idpart)
      erreur_660004609=i_set_art_fieldtab(g_iartin,$TcitR4::idpart,2,0xF)
      erreur_660004609=i_skip_f_in_field_n(g_iartin,$TcitR4::idpart)
      erreur_660004609=i_set_art_fieldtab(g_iartin,$TcitR4::idpart,2,0xF)
      erreur_660004609=i_skip_f_in_field_n(g_iartin,$TcitR4::idpart)
    FINSI
  FINSI
FINSI
####################################################################
# Detection des appels urgents sortants sans carte SIM
####################################################################

IMSI_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::IMSI)
val_tlserv_660004609 = i_get_art_field(g_iartin,$TcitR4::tlserv)

SI ((val_tlserv_660004609 == 0x12) && (type_cra_660004609 == SORTANT_660004609))
ALORS
  lien_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::lien)
  SI ((!IMSI_present_660004609) && (!lien_present_660004609))
  ALORS
    is_emergency_no_sim_660004609 = 1
    indice_duplication_660004609 = DUP_ALC_R4_NO_SIM_660004609
  FINSI
FINSI

####################################################################
# Detection des Cas des roamers SORTANT et roamers court SORTANT
####################################################################
## OGA 303 : changement du test de detection des roamers (pb des roamers numeros long dont idpart 91...)

#G3R7 ajout de IMSI_OrangeCo == 0
SI ( (type_cra_660004609 == SORTANT_660004609) && (is_emergency_no_sim_660004609 != 1) && IMSI_OrangeCo_660004609 == 0)
ALORS
  SI( i_valid_field_n(g_iartin, $TcitR4::idpart) != 0 )
  ALORS
# Les TON+NPI 81 et A1 sont maintenant autorises */
    SI((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0) != 0x09 ) &&
# On autorise TON+NPI 80 */
      ((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 1)
      || (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 0)) &&
# cas des roamers courts
      (i_get_art_fieldlength(g_iartin,$TcitR4::idpart)<= 8)
      )
    ALORS
# Pour savoir si c est un roamer court ou nom on teste la longueur reele du champ
# Idpart jusqu au premier F de bourrage : si <= 8 roamer court sinon roamer
#FE_0008
      is_roamers_court_660004609 = 1
    SINON
      is_roamers_660004609 = 1

      SI ( (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0) == 8) &&
        ((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 0)
        || (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 1)) )
      ALORS
        SI (!((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,2) == 0) &&
          (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,3) == 0)) )
        ALORS
          idpart_not_00_660004609 = 1
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#trace1("[G1R5] --- is_roamer_cour=%d----",is_roamers_court)
#trace1 ("[G1R5] --- is_roamer=%d--------",is_roamers)
####################################################################
# Detection des Cas des roamers ENTRANT et RENVOIM
####################################################################

#G3R7 ajout de la condition IMSI_OrangeCo == 0
#suppression de IMSI<>20801
SI ( ( type_cra_660004609 == ENTRANT_660004609 && IMSI_OrangeCo_660004609 == 0) || ( type_cra_660004609 == RENVOIM_660004609  && IMSI_OrangeCo_660004609 == 0) )
ALORS
  is_roamers_660004609 = 1
FINSI
#\G3R7
####################################################################
# Determination des sous champ du champ "camel" (Camel phase1)
####################################################################

lg_camel_660004609 = i_get_art_field(g_iartin, ($TcitR4::camel-1))
lg_camel2_660004609 = i_get_art_field(g_iartin, ($TcitR4::camel2-1))

#
# Determination des sous champ du champ "camel" (Camel phase1)
#
taille_660004609=0
SI ( lg_camel_660004609 > 0 )
ALORS
# Sous champ "Last Number Given By SCP"
  lg_lastSCPNb_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, 0)
  offset_lastSCPNb_660004609 = 1
  taille_660004609 = lg_lastSCPNb_660004609 + 1

# Sous champ  "Number Of Invoked CAMEL Services"
  nb_camel_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)
  taille_660004609 = taille_660004609 + 1

# Sous champ "SCP Address (item 1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)
  lg_SCPAddress1_660004609=lg_numero_660004609
  offset_SCPAddress1_660004609=taille_660004609 + 1
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "Storage Of Service Key (item 1)"
  offset_svckey1_660004609 = taille_660004609
  C_servkey_660004609 = (i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)*1000 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609+1)*100 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609+2)*10 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609+3))
  taille_660004609 = taille_660004609 + LG_SVCKEY_660004609

# Sous champ "New Number Given By SCP (item 1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)
  lg_NewNumSCP1_660004609=lg_numero_660004609
  offset_NewNumSCP1_660004609=taille_660004609 + 1

# Sous champ "Information given by SCP (item 1)" et "Type of SCP Call (item 1)"
  offset_infoGiven1_660004609= taille_660004609 + lg_numero_660004609 + 1
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 3

  SI ( nb_camel_660004609 == 2 )
  ALORS
# Sous champ "SCP Address (item 2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)
    lg_SCPAddress2_660004609=lg_numero_660004609
    offset_SCPAddress2_660004609=taille_660004609 + 1
    taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "Storage Of Service Key (item 2)"
    offset_svckey2_660004609 = taille_660004609
    taille_660004609 = taille_660004609 + LG_SVCKEY_660004609

# Sous champ "New Number Given By SCP (item 2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel, taille_660004609)
    lg_NewNumSCP2_660004609=lg_numero_660004609
    offset_NewNumSCP2_660004609=taille_660004609 + 1

# Sous champ "Information given by SCP (item 2)" et "Type of SCP Call (item 2)"
    offset_infoGiven2_660004609= taille_660004609 + lg_numero_660004609 + 1
    taille_660004609 = taille_660004609 + lg_numero_660004609 + 3
  FINSI
FINSI

####################################################################
# Determination des sous champ du champ "camel2" (Camel phase2)
####################################################################

#
# Determination des sous champ du champ "camel2" (Camel phase2)
#
SI ( lg_camel2_660004609 > 0 )
ALORS
# Sous champ "Last Number Given By SCP"
  lg_lastSCPNb_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, 0)
  offset_lastSCPNb_660004609 = 1
  taille_660004609 = lg_lastSCPNb_660004609 + 1

# Sous champ "Number Of Invoked CAMEL Services"
  nb_camel_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
  taille_660004609 = taille_660004609 + 1

# Sous champ "SCP Address (item 1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
  lg_SCPAddress1_660004609=lg_numero_660004609
  offset_SCPAddress1_660004609=taille_660004609 + 1
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "Storage Of Service Key (item 1)"
  offset_svckey1_660004609 = taille_660004609
  C_servkey_660004609 = (i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)*1000 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609+1)*100 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609+2)*10 +
  i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609+3))
  taille_660004609 = taille_660004609 + LG_SVCKEY_660004609

# Sous champ "New Number Given By SCP (item 1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
  lg_NewNumSCP1_660004609=lg_numero_660004609
  offset_NewNumSCP1_660004609=taille_660004609 + 1

# Sous champ "Information given by SCP (item 1)" et "Type of SCP Call (item 1)"
  offset_infoGiven1_660004609= taille_660004609 + lg_numero_660004609 + 1
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 3

# Sous champ "List of FCI data (item1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
  offset_FCIdata1_660004609 = taille_660004609 + 1
  taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "List of SCI data (item1)"
  lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
  offset_IP1_660004609 = taille_660004609 + lg_numero_660004609 + 1
  taille_660004609 = offset_IP1_660004609 + 1

  SI ( nb_camel_660004609 == 2 )
  ALORS
# Sous champ "SCP Address (item 2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
    lg_SCPAddress2_660004609=lg_numero_660004609
    offset_SCPAddress2_660004609=taille_660004609 + 1
    taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "Storage Of Service Key (item 2)"
    offset_svckey2_660004609 = taille_660004609
    taille_660004609 = taille_660004609 + LG_SVCKEY_660004609

# Sous champ "New Number Given By SCP (item 2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
    lg_NewNumSCP2_660004609=lg_numero_660004609
    offset_NewNumSCP2_660004609=taille_660004609 + 1

# Sous champ "Information given by SCP (item 2)" et "Type of SCP Call (item 2)"
    offset_infoGiven2_660004609= taille_660004609 + lg_numero_660004609 + 1
    taille_660004609 = taille_660004609 + lg_numero_660004609 + 3

# Sous champ "List of FCI data (item2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
    taille_660004609 = taille_660004609 + lg_numero_660004609 + 1

# Sous champ "List of SCI data (item2)"
    lg_numero_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::camel2, taille_660004609)
    offset_IP2_660004609 = taille_660004609 + lg_numero_660004609 + 1
    taille_660004609 = offset_IP2_660004609 + 1
  FINSI
FINSI

####################################################################
# Traitement d un eventuel prefixe Zone Blanche pour
#  Le type TRANSIT dans le champ idpart
#  Le type REACH dans le champ local
#  (evolution G1R8) Le type RENVREA dans le champ local
#  G2R1 lot1 : ZB_idpart et ZB_local remplacees par ZBPrefixVal
####################################################################
#evolution G1R8 : ZB
SI ( (type_cra_660004609 == TRANSIT_660004609) || (type_cra_660004609 == REACH_660004609) || (type_cra_660004609 == RENVREA_660004609) )
ALORS
  ZBPrefixVal_660004609 = -1
  erreur_660004609 = 0
  SI (type_cra_660004609 == TRANSIT_660004609)
  ALORS
    indice_chp_prefix_660004609 = $TcitR4::idpart
  SINON
    indice_chp_prefix_660004609 = $TcitR4::local
  FINSI
# On teste que les 8 premiers chiffres du champ pour etre sur que
# Sa taille reelle jusqu au premier F de bourrage est >= a 8
  SI( (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,0)<=10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,1)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,2)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,3)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,4)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,5)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,6)<10)
    && (i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,7)<10) )
  ALORS
# TON et NPI sont non significatifs test de xx600
    ZBPrefixDigit1_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,2)
    ZBPrefixDigit2_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,3)
    ZBPrefixDigit3_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,4)
    SI (ZBPrefixDigit1_660004609==6 && ZBPrefixDigit2_660004609==0 && ZBPrefixDigit3_660004609==0)
    ALORS
      ZBPrefixDigitD_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,5)
      ZBPrefixDigitO_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,6)
      ZBPrefixDigitT_660004609=i_get_art_fieldtab(g_iartin,indice_chp_prefix_660004609,7)
      SI ( ZBPrefixDigitD_660004609 >= 7 && ZBPrefixDigitD_660004609 <= 9 && 
      	   ZBPrefixDigitO_660004609 >= 7 && ZBPrefixDigitO_660004609 <= 9 && 
      	  (ZBPrefixDigitT_660004609 == 1 || ZBPrefixDigitT_660004609 == 2 || ZBPrefixDigitT_660004609 == 4 || ZBPrefixDigitT_660004609 == 9) )
      ALORS
# Le numero est bien de la forme xx600[789][789][1249] soit 600DOT
        SI (ZBPrefixVal_660004609 == -1)
        ALORS
          ZBPrefixVal_660004609 = 600*1000 + ZBPrefixDigitD_660004609*100 + ZBPrefixDigitO_660004609*10 + ZBPrefixDigitT_660004609
        FINSI
        
        SI (indice_chp_prefix_660004609 == $TcitR4::idpart)
        ALORS
          flag_pref_idpart_660004609 = 1
        SINON
        	SI (indice_chp_prefix_660004609 == $TcitR4::local)
        	ALORS
        		flag_pref_local_660004609 = 1
        	FINSI
        FINSI
# Suppression du prefixe de portabilite du champ d origine
# D1
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# D2
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# D3
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# D4
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# D5
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# D6
        erreur_660004609 = i_set_art_fieldtab(g_iartin, indice_chp_prefix_660004609, 2, 0x0f)
        erreur_660004609 = i_skip_f_in_field_n(g_iartin, indice_chp_prefix_660004609)
# Forcage du TON+NPI selon T
        SI ((ZBPrefixDigitT_660004609 == 4) || (ZBPrefixDigitT_660004609 == 9))
        ALORS
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,0,0xA)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,1,0x1)
        FINSI
        SI (ZBPrefixDigitT_660004609 == 1)
        ALORS
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,0,0x9)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,1,0x1)
        FINSI
        SI (ZBPrefixDigitT_660004609 == 2)
        ALORS
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,0,0x8)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,indice_chp_prefix_660004609,1,0x1)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

####################################################################
# Traitement d un eventuel routing Number a extraire
#  Le type
#  Le type
####################################################################

RoutingNumberVal_660004609=-1
RoutingNumberError_660004609 = 0
MNP_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::portInvoked-2)
SI (MNP_present_660004609)
ALORS
  port_proc_invok_660004609 = i_get_art_field(g_iartin, $TcitR4::portInvoked)
  portab_status_660004609 = i_get_art_field(g_iartin, $TcitR4::portStatus)
  SI ( (type_cra_660004609 == REACH_660004609) || (type_cra_660004609 == RENVREA_660004609) )
  ALORS
    SI (portab_status_660004609 == 3)
    ALORS
# Portpref a extraire du champ routeingNumber
      trace1 (">>__LINE__>> traitement RN cas type = <%d> ======",type_cra_660004609)
      RoutingNumberLong_660004609 = i_get_art_field(g_iartin, $TcitR4::portInvoked - 1 )
      SI (RoutingNumberLong_660004609 >= 10)
      ALORS
# Atention, ici TON contient TON et NPI (1octet)
        RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::routingNum, 0)
        SI (RoutingNumberTON_660004609 == 0xA1)
        ALORS
          RoutingNumberTmpVal_660004609  = i_get_art_fieldtab(g_iartin,$TcitR4::routingNum,1)
          RoutingNumberTmpVal_660004609  = ((RoutingNumberTmpVal_660004609&0xF0) >> 4 )*1000+ (RoutingNumberTmpVal_660004609&0x0F)*100
          RoutingNumberTmpVal2_660004609 = i_get_art_fieldtab(g_iartin,$TcitR4::routingNum,2)
          RoutingNumberTmpVal2_660004609 = ((RoutingNumberTmpVal2_660004609&0xF0) >> 4 )*10+ (RoutingNumberTmpVal2_660004609&0x0F)
          RoutingNumberTmpVal_660004609  = RoutingNumberTmpVal_660004609+RoutingNumberTmpVal2_660004609

          # Debut G1R6 : appel table externe pour determiner le RN
          erreur_660004609 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004609)
          erreur_660004609 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004609)
          #G3R3 lot3 Curling_Free
          i_strcpy(pt_portabilite_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_CleRoutingNumberSAC_660004609))
          SI (i_strcmp(pt_portabilite_660004609,"porta") == 0)
            # Fin G1R6
          ALORS
            trace2(">>__LINE__>> RN trouve (routingNum) en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
            SI ( RoutingNumberVal_660004609 != -1 )
            ALORS
              RoutingNumberError_660004609 = 1
            SINON
# Memorisation du prefixe pour A1 RN (porta)*
              RoutingNumberVal_660004609=RoutingNumberTmpVal_660004609
            FINSI
          SINON
            #QC903 G3R4
            SI (i_strcmp(pt_portabilite_660004609,"sva") == 0)
            ALORS
              trace2(">>__LINE__>> SVA trouve  en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
              SI ( RoutingNumberVal_660004609 != -1 )
              ALORS
                RoutingNumberError_660004609 = 1
              SINON
# Memorisation du prefixe pour A1 RN (sva)*
                Prefix_sav_660004609 = RoutingNumberTmpVal_660004609
                i_strcpy (pt_PrefixeSVA_660004609,pt_CleRoutingNumberSAC_660004609)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::routingNum,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::routingNum)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::routingNum,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::routingNum)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::routingNum,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::routingNum)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::routingNum,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::routingNum)
              FINSI
            FINSI

          FINSI
        FINSI
      FINSI
    SINON
      SI (port_proc_invok_660004609 == 1 && !flag_pref_local_660004609)
      ALORS
# Portpref a extraire du champ location identity
        # FE 0007
        trace1(" Extraction Routing Number pour le type:<%d>", type_cra_660004609)
        RoutingNumberLong_660004609 = i_get_art_field(g_iartin, $TcitR4::local - 1 )
        SI (RoutingNumberLong_660004609 >= 8)
        ALORS
          RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 0)
          RoutingNumberNPI_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 1)
          SI ((RoutingNumberTON_660004609 == 0xA) && (RoutingNumberNPI_660004609 == 1))
          ALORS
            RoutingNumberTmpVal_660004609=i_get_art_fieldtab(g_iartin,$TcitR4::local,2)*1000
            RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+ i_get_art_fieldtab(g_iartin,$TcitR4::local,3)*100 
            RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+ i_get_art_fieldtab(g_iartin,$TcitR4::local,4)*10 
            RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+i_get_art_fieldtab(g_iartin,$TcitR4::local,5)
            # Debut G1R6 : appel table externe pour determiner le RN
            erreur_660004609 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004609)
            erreur_660004609 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004609)
            # Fin G1R6
            #G3R3 lot3 Curling_Free
            i_strcpy(pt_portabilite_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_CleRoutingNumberSAC_660004609))
            SI (i_strcmp(pt_portabilite_660004609,"porta") == 0)
            ALORS
              trace2(">>__LINE__>> RN trouve (local) en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
              SI ( RoutingNumberVal_660004609 != -1 )
              ALORS
                RoutingNumberError_660004609 = 1
              SINON
              	flag_pref_local_660004609 = 1
# Suppression du prefixe pour A1 RN *
                RoutingNumberVal_660004609=RoutingNumberTmpVal_660004609
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
              FINSI
            SINON
              #QC903 G3R4
              SI (i_strcmp(pt_portabilite_660004609,"sva") == 0)
              ALORS
                trace2(">>__LINE__>> sva trouve (local) en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
                SI ( RoutingNumberVal_660004609 != -1 )
                ALORS
                  RoutingNumberError_660004609 = 1
                SINON
# Suppression du prefixe pour A1 RN (sva)*
#G3R4 QC914
                  #RoutingNumberVal=RoutingNumberTmpVal
                  Prefix_sav_660004609 = RoutingNumberTmpVal_660004609
                  i_strcpy (pt_PrefixeSVA_660004609,pt_CleRoutingNumberSAC_660004609)
                  erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                  erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                  erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                  erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                  erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                  erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                  erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
                  erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
                FINSI
              FINSI
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
  SI ( (type_cra_660004609 == RENVOIM_660004609) || (type_cra_660004609 == RENVOIG_660004609) )
  ALORS
    SI (portab_status_660004609 == 3)
    ALORS
# Portpref a extraire du champ routeingNumber
      trace1 (">>__LINE__>> traitement RN cas type = <%d> ======",type_cra_660004609)
      RoutingNumberLong_660004609 = i_get_art_field(g_iartin, $TcitR4::portInvoked - 1 )
      SI (RoutingNumberLong_660004609 >= 10)
      ALORS
# Attention, ici TON contient TON et NPI (1 octet) 
        RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::routingNum, 0)
        SI (RoutingNumberTON_660004609 == 0xA1)
        ALORS
          RoutingNumberTmpVal_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::routingNum, 1)
          RoutingNumberTmpVal_660004609=((RoutingNumberTmpVal_660004609&0xF0) >> 4 )*1000+
          (RoutingNumberTmpVal_660004609&0x0F)*100
          RoutingNumberTmpVal2_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::routingNum, 2)
          RoutingNumberTmpVal2_660004609=((RoutingNumberTmpVal2_660004609&0xF0) >> 4 )*10+
          (RoutingNumberTmpVal2_660004609&0x0F)
          RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+RoutingNumberTmpVal2_660004609
          # Debut G1R6 : appel table externe pour determiner le RN
          erreur_660004609 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004609)
          erreur_660004609 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004609)
          # Fin G1R6
          #G3R3 lot3 Curling_Free
          i_strcpy(pt_portabilite_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_CleRoutingNumberSAC_660004609))
          SI (i_strcmp(pt_portabilite_660004609,"porta") == 0)

          ALORS
            trace2(">>__LINE__>> RN trouve (routingNum) en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
            SI ( RoutingNumberVal_660004609 != -1 )
            ALORS
              RoutingNumberError_660004609 = 1
            SINON
# Memorisation du prefixe pour A1 RN *
              RoutingNumberVal_660004609=RoutingNumberTmpVal_660004609
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

# Extraction inconditionnelle d un eventuel prefixe RN dans le champ idpart si pas d'extraction prefixe ZB sur ce champ
# FE_0007 , memorisation du prefixe pour le cas TRANSIT pour la mise a jour du T3t12
#G3R3lot3 Extraction eventuel d un prefixe ITInerance dans le champ idpart cas TRANSIT
#G3R4lot1 Traitement du prefixe de routage SVA dans le champ idpart cas TRANSIT
#QC905 G3R4 controle de la longueur du champ idpart
#G3R10 suppression detection prefixe ITInerance
SI (!flag_pref_idpart_660004609)
ALORS
	taille_660004609 = g_iartin.idpart!NELEM/2
	trace1("<<__LINE__>> =========taille du champ idpart = %d =============", taille_660004609)
	SI (taille_660004609 == 8)
	ALORS
	  SI( (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0)<=10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,2)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,3)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,4)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,5)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,6)<10)
	    && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,7)<10) )
	  ALORS
	    RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 0)
	    RoutingNumberNPI_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 1)
	    SI ((RoutingNumberTON_660004609 == 0xA) && (RoutingNumberNPI_660004609 == 0x1))
	    ALORS
	      trace1(" Extraction Routing Number pour le type:<%d>", type_cra_660004609)
	      RoutingNumberTmpVal_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 2)*1000
	      RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 3)*100
	      RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 4)*10
	      RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609+i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 5)
	      # Debut G1R6 : appel table externe pour determiner le RN
	      erreur_660004609 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004609)
	      erreur_660004609 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004609)
	      # Fin G1R6
	      #G3R3 lot3 Curling_Free
	      i_strcpy(pt_portabilite_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_CleRoutingNumberSAC_660004609))
	      SI (i_strcmp(pt_portabilite_660004609,"porta") == 0)
	      ALORS
	        # Suppression du prefixe pour A1 RN *
	        trace2(">>__LINE__>> RN trouve (idpart) en table externe RNSAC  = %s==========",pt_CleRoutingNumberSAC_660004609,"")
	        SI ( RoutingNumberVal_660004609 != -1 )
	        ALORS
	          trace("RountingNumberVal deja mis a jour")
	          RoutingNumberError_660004609 = 1
	        SINON
	
	# Memorisation du prefixe pour A1 RN *
	          SI( type_cra_660004609 == TRANSIT_660004609 )
	          ALORS
	            RoutingNumberVal_660004609=RoutingNumberTmpVal_660004609
	            trace1("<<__LINE__<< RoutingNumberVal:<%d>",RoutingNumberVal_660004609)
	          FINSI
	        FINSI
	        flag_pref_idpart_660004609 = 1
	        # suppression du prefix itinerant
	        erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	        erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	        erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	        erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	        erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	        erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	        erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	        erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	
	      SINON
	# G3R10 suppression detection prefixe itinerance, n'existe pas dans MSC Alcatel
	        SI (i_strcmp(pt_portabilite_660004609,"sva") == 0)
	        ALORS
	          SI( type_cra_660004609 == TRANSIT_660004609 )
	          ALORS
	            trace1("<<__LINE__>> detection prefix sav = <%d> ======",RoutingNumberTmpVal_660004609)
	            Prefix_sav_660004609 = RoutingNumberTmpVal_660004609
	            i_strcpy(pt_PrefixeSVA_660004609,pt_CleRoutingNumberSAC_660004609)
	          FINSI
	          flag_pref_idpart_660004609 = 1
	          # suppression du prefix itinerant
	          erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	          erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	          erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	          erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	          erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	          erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	          erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, 2, 0x0f)
	          erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
	        FINSI
	#/G3R10
	      FINSI
	    FINSI
	  FINSI
	FINSI
FINSI


####################################################################
#G2R1 lot2 OMOF
# Traitement d un eventuel prefixe OMOF a extraire
#  type 0x08 (transit)
#  [90/91] 33 (150PQ, Z0BPQ, ou 10020) ZABPQMCDU
#  A1 (150PQ, Z0BPQ, 10020) ZABPQMCDU
# type=TRANSIT => type=0x08
####################################################################
#G3R10
OMOFPrefix_index_660004609 = -1
longueur_pref_660004609 = 0
SI  (type_cra_660004609 == TRANSIT_660004609 && !flag_pref_idpart_660004609 && g_iartin.idpart!NELEM > 12)
ALORS
  erreur_660004609 = 0
  i_strcpy(pt_idpart_660004609, "")
  erreur_660004609 = i_get_art_str(g_iartin, $TcitR4::idpart, pt_idpart_660004609)
  longueur_660004609=i_strlen(pt_idpart_660004609)

  SI ( (i_strplcmp(pt_idpart_660004609,"A1",0,2) == 0 && longueur_660004609 > 12) || ((i_strplcmp(pt_idpart_660004609,"9033",0,4) == 0 || i_strplcmp(pt_idpart_660004609,"9133",0,4) == 0) && longueur_660004609 > 14) )
  ALORS
    i_strcpy(pt_pref_OMOF_660004609, "")
    SI (i_strplcmp(pt_idpart_660004609,"A1",0,2) == 0)
    ALORS
      #retirer le 1er octet A1 puis retirer les 9 digits ZABPQMCDU de droite
      i_get_sub_str(pt_idpart_660004609, 2, -10, pt_pref_OMOF_660004609)
      i_strcpy(pt_omof_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_pref_OMOF_660004609))
      SI (i_strcmp(pt_omof_660004609,"omof") == 0)
      ALORS
        OMOFPrefix_index_660004609=2
        longueur_pref_660004609 = i_strlen(pt_pref_OMOF_660004609)
      FINSI
    SINON
    	#QC1237
      SI (i_strplcmp(pt_idpart_660004609,"9033",0,4) == 0 || i_strplcmp(pt_idpart_660004609,"9133",0,4) == 0)
      ALORS
      #/QC1237
        i_get_sub_str(pt_idpart_660004609, 4, -10, pt_pref_OMOF_660004609)
        i_strcpy(pt_omof_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_pref_OMOF_660004609))
        SI (i_strcmp(pt_omof_660004609,"omof") == 0)
        ALORS
          OMOFPrefix_index_660004609=4
          longueur_pref_660004609 = i_strlen(pt_pref_OMOF_660004609)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

SI (OMOFPrefix_index_660004609 != -1)
ALORS
# Suppression du prefixe OMOF du champ d origine : TON+NPI [33] OMOF ZABPQMCDU
  POINT BOUCLE_OMOF
# Dx
  erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart, OMOFPrefix_index_660004609, 0x0f)
  erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
  longueur_pref_660004609 = longueur_pref_660004609 - 1
  SI longueur_pref_660004609 != 0
  ALORS
    SAUT BOUCLE_OMOF
  FINSI
FINSI
#/G3R10

##------------------------------------------------##
# G3R8Lot2 traitement des prefix de joignabilite   #
# pour les cras de type RENVOIG(0x06)              #
##------------------------------------------------##

SI (type_cra_660004609 == RENVOIG_660004609 && !flag_pref_local_660004609)
ALORS
  trace1(" Extraction prefix de joignabilite pour le type:<%d>", type_cra_660004609)
  LocalLengt_660004609 = i_get_art_field(g_iartin, $TcitR4::local - 1 )
  SI (LocalLengt_660004609 > 6)
  ALORS
    RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 0)
    RoutingNumberNPI_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 1)
    SI ((RoutingNumberTON_660004609 == 0xA) && (RoutingNumberNPI_660004609 == 1))
    ALORS
      erreur_660004609 = i_get_art_str(g_iartin,$TcitR4::local,pt_local_660004609)
      # le champ local n'est pas un tableau numerique en DCB mais en Hexa donc suppression du F final eventuel
      SI (i_get_art_fieldtab(g_iartin, $TcitR4::local, (g_iartin.local!NELEM - 1)) == 0xF)
      ALORS
      	i_get_sub_str(pt_local_660004609, 0, -2, pt_local_660004609)
      FINSI
      # Recherche prefixe de joignabilite (longueur variable) dans le champ local de la forme A1[xxx]...x]ZABPQMCDU[f] 
      i_get_sub_str(pt_local_660004609, 2, -10, pt_PrefixJoing_660004609)
      #interrogation de la table ext RoutinNumberSac
      i_strcpy(pt_portjoing_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_PrefixJoing_660004609))
      SI (i_strcmp(pt_portjoing_660004609,"joig") == 0)
      ALORS
        PREFIXjoig_660004609 = 1
      FINSI
    FINSI
  FINSI
SINON
  SI (type_cra_660004609 == TRANSIT_660004609 && !flag_pref_idpart_660004609)
  ALORS
    trace1(" Extraction prefix de joignabilite pour le type:<%d>", type_cra_660004609)
    LocalLengt_660004609 = i_get_art_field(g_iartin, $TcitR4::idpart - 1 )
    SI (LocalLengt_660004609 > 6)
    ALORS
      RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 0)
      RoutingNumberNPI_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 1)
      SI ((RoutingNumberTON_660004609 == 0xA) && (RoutingNumberNPI_660004609 == 1))
      ALORS
        erreur_660004609 = i_get_art_str(g_iartin,$TcitR4::idpart,pt_idpart_660004609)
        i_get_sub_str(pt_idpart_660004609, 2, -10, pt_PrefixJoing_660004609)
      
        #interrogation de la table ext RoutinNumberSac
        i_strcpy(pt_portjoing_660004609,i_get_tab_field(RNSAC_660004609, date_cra_660004609, pt_PrefixJoing_660004609))
        SI (i_strcmp(pt_portjoing_660004609,"joig") == 0)
        ALORS
          PREFIXjoig_660004609 = 1
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#trace1 ("<<__LINE__>> ============PREFIXjoig = %d =====================",PREFIXjoig)

SI (PREFIXjoig_660004609 == 1 && type_cra_660004609 == RENVOIG_660004609 && !flag_pref_local_660004609)
ALORS
  long_660004609 = i_strlen(pt_PrefixJoing_660004609)
  indice_660004609 = long_660004609
  flag_pref_local_660004609 = 1
  
  POINT BOUCLE1
  SI (indice_660004609 > 0)
  ALORS
    indice_660004609=indice_660004609 - 1
    erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::local:0, 2, 0x0f)
    erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::local)
    SAUT BOUCLE1
  FINSI

FINSI

SI (PREFIXjoig_660004609 == 1 && type_cra_660004609 == TRANSIT_660004609 && !flag_pref_idpart_660004609)
ALORS
  long_660004609 = i_strlen(pt_PrefixJoing_660004609)
  indice_660004609 = long_660004609
  flag_pref_idpart_660004609 = 1
  
  POINT BOUCLE2
  SI (indice_660004609 > 0)
  ALORS
    indice_660004609=indice_660004609 - 1
    erreur_660004609 = i_set_art_fieldtab(g_iartin, $TcitR4::idpart:0, 2, 0x0f)
    erreur_660004609 = i_skip_f_in_field_n(g_iartin, $TcitR4::idpart)
    SAUT BOUCLE2
  FINSI
FINSI

#-------------------------------------------------------------------------#/Fin G3R8 Lot2

####################################################################
# Generation du DPV
####################################################################

SI (type_cra_660004609 == TRANSIT_660004609)
ALORS
  indice_duplication_660004609 = DUP_ALC_R4_TRANSIT_660004609
FINSI
SI ( (type_cra_660004609 == SORTANT_660004609) && (is_roamers_660004609 != 1) && (is_roamers_court_660004609 != 1)
  && (is_emergency_no_sim_660004609 != 1) && (is_sortant_VPN_660004609 != 1)
  && (is_sortant_VPN32_660004609 != 1) )
ALORS
  indice_duplication_660004609 = DUP_ALC_R4_SORTANT_660004609
FINSI

SI ( (is_sortant_VPN_660004609 == 1) && (is_roamers_660004609 != 1) && (is_roamers_court_660004609 != 1) )
ALORS
  indice_duplication_660004609 = DUP_ALC_R4_VPN_660004609
FINSI

SI ( (is_sortant_VPN32_660004609 == 1) && (is_roamers_660004609 != 1) && (is_roamers_court_660004609 != 1) )
ALORS
  indice_duplication_660004609 = DUP_ALC_R4_VPN_32_660004609
FINSI

SI ( (is_roamers_660004609 == 1) || (is_roamers_court_660004609 == 1) )
ALORS
#G1R5-URSLYON pk debut
  SI (type_cra_660004609 == SORTANT_660004609)
  ALORS
    erreur_660004609 = i_get_art_str(g_iartin, $TcitR4::idpart,pt_idpart_660004609)
    #trace2("[G1R5]----pt_idpart=%s------",pt_idpart,"")
    SI  (i_adequation_chaine_expreg(pt_idpart_660004609,"B"))== 0  || (i_adequation_chaine_expreg(pt_idpart_660004609,"C"))== 0
    ALORS
      #trace("[G1R5]--TcitR4--detection du # ou *")
      SI ( (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0) == 8) &&
        ((i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 0)
        || (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1) == 1)) )
      ALORS
        SI (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,2) != 0)
        ALORS
          is_roamers_special_660004609 = 1
          #trace1("[G1R5]---is_roamers_special=%d---------",is_roamers_special)
        FINSI
      FINSI
    FINSI
  FINSI
#G1R5 fin

  indice_duplication_660004609 = DUP_ALC_R4_660004609
  is_sortant_VPN32_660004609 = 0
  is_sortant_VPN_660004609 = 0
FINSI


# FE_0007 S0F5 : troncature a partir du premier digit non numerique pour tous numeros appeles
#G1R5 -URSLYON -pk- pas de troncature pour les is_roamers_special
SI (i_valid_field_n(g_iartin,$TcitR4::idpart) != 0 && is_roamers_special_660004609==0)
ALORS
  erreur_660004609=trunc_num_idpart_660004265($TcitR4::idpart)
FINSI

trace1("table duplication utilisee : <%d>",indice_duplication_660004609)
erreur_660004609 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",indice_duplication_660004609)
SI (erreur_660004609 != 0)
ALORS
  trace("Erreur de duplication")
  ERREUR_660004609 = ERR_DUPL_660004609
  code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
  erreur_660004609=i_PlvMessEmettre(8284, 2,  g_iartout12, "", 3, code_rejet_660004609, type_cra_660004609, "Tdpvgsm")
  SAUT STOCKE_ERRONE
FINSI

#G5R1
# Ajout de T3t8/msgITX si (bT3T8ITX == 1) et indice_duplication == {0, 1, 2, 3, 4, 5, 6}
SI (bT3T8ITX_660004609 == 1) && 
	  ((indice_duplication_660004609 == 0) 
	  || (indice_duplication_660004609 == 1) 
	  || (indice_duplication_660004609 == 2) 
	  || (indice_duplication_660004609 == 3) 
	  || (indice_duplication_660004609 == 4) 
	  || (indice_duplication_660004609 == 5) 
	  || (indice_duplication_660004609 == 6))
ALORS
	SI (i_valid_field_n(g_iartin,$TcitR4::msgITX))
  ALORS
		erreur_660004609 = i_ajout_tlv(g_iartout,"T3t8","")
  	erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcitR4::msgITX))
		trace ("Ajout du champ msgITX")
	FINSI
FINSI

####################################################################
# Mise a jour du champ IMSI
####################################################################

SI ( (type_cra_660004609 == TRANSIT_660004609) || (is_emergency_no_sim_660004609 == 1))
ALORS
  erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::IMSI,15,0xF)
FINSI

####################################################################
# Mise a jour du champ tentite
####################################################################

val_tentite_660004609 = i_get_art_field(g_iartin, $TcitR4::tentite)
SI (val_tentite_660004609 == 2)
ALORS
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::tentite, 0)
FINSI

####################################################################
# Mise a jour du champ svcsup
####################################################################

val_svcsup_660004609 = i_get_art_field(g_iartin,$TcitR4::svcsup)
val_tlserv_660004609 = i_get_art_field(g_iartin,$TcitR4::tlserv)
SI (type_cra_660004609 == TRANSIT_660004609)
ALORS
  SI (val_svcsup_660004609 == 0x04)
  ALORS
    vsvcsup_660004609 = 0x1F
    SAUT OK_SVCSUP
  SINON
    vsvcsup_660004609 = 0xFF
    SAUT OK_SVCSUP
  FINSI
SINON
# FE_0009
  SI(type_cra_660004609 == SORTANT_660004609 )
  ALORS
    SI( (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,0)==0xA )
      && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,1)==0x1 )
      && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,2)==0x0 )
      && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,3)==0x6 )
      && (i_get_art_fieldtab(g_iartin,$TcitR4::idpart,4)==0x0 ) )
    ALORS
      vsvcsup_660004609 = 0xFF
      SAUT OK_SVCSUP
    FINSI
    # Fin FE_0009
  SINON
    SI (val_tlserv_660004609 == 0xff)
    ALORS
      Q1_660004609 = val_svcsup_660004609 & 0xf0
      Q2_660004609 = val_svcsup_660004609 & 0x0f

      # Gestion des cas 11 12 14 15 16 21 22 24 25 26
      #                 91 92 94 95 96 A2 A2 A4 A5 A6

      SI ((Q2_660004609>0) && (Q2_660004609<7) && (Q2_660004609!=3))
      ALORS
        SI ((Q1_660004609==0x10) || (Q1_660004609==0x20) || (Q1_660004609==0x90) || (Q1_660004609==0xa0))
        ALORS
          vsvcsup_660004609 = 0x16
          SAUT OK_SVCSUP
        SINON
          SAUT ERR_SVCSUP
        FINSI
      FINSI

      # Gestion des cas 30 40 B0 C0
      SI ((val_svcsup_660004609==0x30) || (val_svcsup_660004609==0x40)
        || (val_svcsup_660004609==0xb0) || (val_svcsup_660004609==0xc0))
      ALORS
        vsvcsup_660004609 = 0x16
        SAUT OK_SVCSUP
      FINSI

      # Gestion des cas 1A 1C 1D 1E 9A 9C 9D 9E
      SI ((Q2_660004609>9) && (Q2_660004609<0x0f) && (Q2_660004609!=0x0b))
      ALORS
        SI ((Q1_660004609==0x10) || (Q1_660004609==0x90))
        ALORS
          vsvcsup_660004609 = 0x1e
          SAUT OK_SVCSUP
        SINON
          SAUT ERR_SVCSUP
        FINSI
      FINSI

      # Gestion des cas 38 48
      SI ((val_svcsup_660004609==0x38) || (val_svcsup_660004609==0x48))
      ALORS
        vsvcsup_660004609 = 0x1e
        SAUT OK_SVCSUP
      FINSI

      # Gestion du cas 17
      SI (val_svcsup_660004609==0x17)
      ALORS
        vsvcsup_660004609 = 0x17
        SAUT OK_SVCSUP
      FINSI

      # Gestion du cas 1F
      SI (val_svcsup_660004609==0x1F)
      ALORS
        vsvcsup_660004609 = 0x1F
        SAUT OK_SVCSUP
      FINSI
    FINSI
  FINSI
FINSI

POINT   ERR_SVCSUP
i_message1("Erreur champ service support -> 0x%x", val_svcsup_660004609)
SAUT FIN_SVCSUP

POINT   OK_SVCSUP
erreur_660004609 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,vsvcsup_660004609)

POINT   FIN_SVCSUP

####################################################################
# FE_0009
# Mise a jour du champ T3t1.8
####################################################################
trace1("New Number given by the SCP :<%d>", lg_NewNumSCP1_660004609)
trace1("NewNbSCP 1 :<%d>",i_get_art_fieldtab(g_iartin, $TcitR4::camel,offset_NewNumSCP1_660004609))
trace1("NewNbSCP 2 :<%d>",i_get_art_fieldtab(g_iartin, $TcitR4::camel,offset_NewNumSCP1_660004609+1))
SI (type_cra_660004609 == SORTANT_660004609)
ALORS
  SI(((is_sortant_VPN_660004609==1) || (is_sortant_VPN32_660004609==1)) && (lg_NewNumSCP1_660004609!=0)
    && (i_get_art_fieldtab(g_iartin, $TcitR4::camel,offset_NewNumSCP1_660004609) == 0x81)
    &&(i_get_art_fieldtab(g_iartin, $TcitR4::camel,offset_NewNumSCP1_660004609+1) == 0x60) )
  ALORS
    trace("tlserv :0x34")
    erreur_660004609=i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0x34)
  SINON
    SI((i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 0)==0xA )
      &&(i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 1)==0x1 )
      &&(i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 2)==0x0 )
      &&(i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 3)==0x6 )
      &&(i_get_art_fieldtab(g_iartin, $TcitR4::idpart, 4)==0x0 ) )
    ALORS
      trace("tlserv :0x33")
      erreur_660004609=i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0x33)
    FINSI
  FINSI
FINSI


####################################################################
# Mise a jour du champ support1 pour les appels
# Entrants et sortant en fonction du champ V3t6 (channeltype)
####################################################################

SI (( type_cra_660004609 == SORTANT_660004609 ) || ( type_cra_660004609 == ENTRANT_660004609))
ALORS
  L3t6_660004609 = i_get_art_field(g_iartin, $TcitR4::L3t10)
  SI ( (L3t6_660004609 == 0) || (L3t6_660004609 == 5) )
  ALORS
# Le champ channel_type est absent
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::support1,0)
  SINON
# Le champ channel_type est present
# Recuperation du 1er octet de V3t10
    channel_type_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::reqBearSrvc,0)
# Recuperation du quartet de poids fort de l octet precedement obtenu
    channel_type_660004609 = (channel_type_660004609 >> 4) & 0x0f
    SI (channel_type_660004609 == 4)
    ALORS
      erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::support1,1)
    SINON
      erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::support1,0)
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour du champ systype
####################################################################

val_UMTSco_660004609 = i_get_art_field(g_iartin, $TcitR4::UMTSco)
SI (val_UMTSco_660004609==-1)
ALORS
# Le champ UMTSco est absent
  SI ((type_cra_660004609==SORTANT_660004609) || (type_cra_660004609==ENTRANT_660004609))
  ALORS
    vsystype_660004609 = 0x00
  SINON
    vsystype_660004609 = 0xFF
  FINSI
SINON
# Le champ UMTSco est present
  SI ((type_cra_660004609==SORTANT_660004609) || (type_cra_660004609==ENTRANT_660004609))
  ALORS
    SI (val_UMTSco_660004609==0x01)
    ALORS
      vsystype_660004609 = 0x01
    SINON
      vsystype_660004609 = 0x00
    FINSI
  SINON
    vsystype_660004609 = 0xFF
  FINSI
FINSI
erreur_660004609 = i_set_art_field(g_iartout,$Tdpvgsm::systype,vsystype_660004609)

####################################################################
# Mise a jour du champ local (T3t3)
####################################################################
SI (type_cra_660004609 != TRANSIT_660004609)
ALORS
# on teste que le champ locla est present en entree (iso-CE car sur le CE, cela est fait en dup_tab_tlv et si champ absent, pas d'erreur)
  erreur_660004609 = i_valid_field_n(g_iartin, $TcitR4::local)
  SI(erreur_660004609 != 0)
  ALORS
    #G1R6 lot3----------
    taille_local_660004609 = i_get_art_field(g_iartin, $TcitR4::local-1)
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t3", "")
    SI (type_cra_660004609 == REACH_660004609)
    ALORS
#     trace ("code sac detecte A1 053[0-9]")
      RoutingNumberTON_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 0)
      RoutingNumberNPI_660004609=i_get_art_fieldtab(g_iartin, $TcitR4::local, 1)
      val_elem_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::local, 2)
      SI ((RoutingNumberTON_660004609 == 0xA) && (RoutingNumberNPI_660004609 == 1) && (val_elem_660004609 == 0))
      ALORS
        RoutingNumberTmpVal_660004609=i_get_art_fieldtab(g_iartin,$TcitR4::local,3)*100
        RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609 + i_get_art_fieldtab(g_iartin,$TcitR4::local,4)*10
        RoutingNumberTmpVal_660004609=RoutingNumberTmpVal_660004609 + i_get_art_fieldtab(g_iartin,$TcitR4::local,5)

        SI (RoutingNumberTmpVal_660004609 >= 530 && RoutingNumberTmpVal_660004609 <= 539)
        ALORS
#         trace ("suppression du code sac ")
          erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
          erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
          erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
          erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
          erreur_660004609 = i_set_art_fieldtab(g_iartin,$TcitR4::local,2,0x0f)
          erreur_660004609 = i_skip_f_in_field_n(g_iartin,$TcitR4::local)
        FINSI
      FINSI
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::local,$Tdpvgsm::local,-$NORM:CIT_EVOL,0)
    FINSI

#G1R6 lot3 FIN----------------

    SI (is_roamers_660004609)
    ALORS


      SI ( (type_cra_660004609 == SORTANT_660004609) || (type_cra_660004609 == ENTRANT_660004609) )
      ALORS
# OGA 214 copie de local dans le champ V3t3
        erreur_660004609 = i_resize_tlv(g_iartout,"T3t3", "local", taille_local_660004609*8)
        erreur_660004609 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::local,
        i_get_art_fieldptr(g_iartin,$TcitR4::local),taille_local_660004609)
      FINSI
      SI (type_cra_660004609 == RENVOIM_660004609)
      ALORS
# On normalise le champ local avec l automate CIT_ROAMERS
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::local,$Tdpvgsm::local,-$NORM:CIT_ROAMERS,0)
      FINSI
      #SI ( (type_cra == REACH) || (type_cra == RENVREA) || (type_cra == RENVOIG) )
      SI ( (type_cra_660004609 == RENVREA_660004609) || (type_cra_660004609 == RENVOIG_660004609) )
      ALORS
# On normalise le champ local avec l automate CIT_EVOL
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::local,$Tdpvgsm::local,-$NORM:CIT_EVOL,0)
      FINSI
      SI ( erreur_660004609 != 0 )
      ALORS
        trace("Erreur duplication champ local")
        ERREUR_660004609 = ERR_NORM_660004609
        code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
        erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "local", 0)
        SAUT STOCKE_ERRONE
      FINSI


    SINON
# On normalise le champ lien avec l automate CIT_EVOL
      taille_local_660004609 = i_get_art_field(g_iartin, $TcitR4::local-1)
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t3", "")
      SI ( (type_cra_660004609 == SORTANT_660004609) || (type_cra_660004609 == ENTRANT_660004609) )
      ALORS
# OGA 214 copie de local dans le champ V3t3
        erreur_660004609 = i_resize_tlv(g_iartout,"T3t3", "local", taille_local_660004609*8)
        erreur_660004609 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::local,
        i_get_art_fieldptr(g_iartin,$TcitR4::local),taille_local_660004609)
      SINON
# On normalise le champ local avec l automate EVOL
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::local,$Tdpvgsm::local,-$NORM:CIT_EVOL,0)
      FINSI
      SI ( erreur_660004609 != 0 )
      ALORS
        trace("Erreur duplication champ local")
        ERREUR_660004609 = ERR_NORM_660004609
        code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
        erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "local", 0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

POINT MAJ_AUTRES_CHAMPS

####################################################################
#  Mise a jour du champ DATE
####################################################################

date_cra_660004609=i_get_art_field(g_iartin , $TcitR4::DATE)- i_get_art_field(g_iartin, $TcitR4::DUREE)
erreur_660004609=i_set_art_field(g_iartout,$Tdpvgsm::DATE,date_cra_660004609)

####################################################################
# Mise a jour du champ idpart (T3t2)
####################################################################
# G3R0CzME
# avant Tdpvgsm::idpart etait cree lors de la duplication / normalisation voir i_dup_art_tab_choix ci dessus
# utilisation du verbe i_ajout_tlv pour rester compatible avec l existant
# Nota : le verbe i_retrait_tlv ne fonctionne que pour retirer des champs en fin d'article (inutilisable ici)
# URS LYON : FO518 et FO519
SI (type_cra_660004609 == TRANSIT_660004609)
ALORS

  erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout9,$TcitR4::local,$Conv_URS::idpartDCB,-$NORM:CIT_EVOL_TRANSIT  ,0)
  trace1("__LINE__retour i_dup_chp_rnisGSM T3t2 <%d>",erreur_660004609)
  SI ( erreur_660004609 != 0 )
  ALORS trace("__LINE__")
    trace("Erreur duplication champ idpart")
    ERREUR_660004609 = ERR_NORM_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
    SAUT STOCKE_ERRONE
  FINSI
  i_strcpy(pt_BUF_660004609," ")
  origine_660004609=i_get_art_field(g_iartout,$Tdpvgsm::origine)
  trace1("__LINE__origine  0x<%x>",origine_660004609)
  trace1("__LINE__type_cra 0x<%x>",type_cra_660004609)
  erreur_660004609=i_get_art_str(g_iartout9, $Conv_URS::idpartDCB, pt_BUF_660004609)

  #si type=transit (0x08) et origine= international (0x01) et idpartNorm ="0" alors suppression idpart
  SI (origine_660004609 == 0x01)
  ALORS
    SI (i_strcmp(pt_BUF_660004609,"0") != 0)
    ALORS
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
      erreur_660004609 = i_dup_chp_1val(g_iartout9, g_iartout, $Conv_URS::idpartDCB, $Tdpvgsm::idpart)
    FINSI
  SINON
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
    erreur_660004609 = i_dup_chp_1val(g_iartout9, g_iartout, $Conv_URS::idpartDCB, $Tdpvgsm::idpart)
  FINSI
FINSI
# /G3R0CzME

SI ( (type_cra_660004609 != TRANSIT_660004609) && (is_emergency_no_sim_660004609 != 1)
  && (is_sortant_VPN_660004609 != 1) && (is_sortant_VPN32_660004609 != 1) )
ALORS
  calledNumber_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::idpart)
  SI (calledNumber_present_660004609)
  ALORS
    taille_idpart_660004609 = i_get_art_field(g_iartin, $TcitR4::idpart-1)
# Cas ou il reste a dupliquer le champ idpart
    SI ( (is_roamers_660004609 != 1) && (is_roamers_court_660004609 != 1) )
    ALORS
# Cas Normal de duplication (ITINERIS)
      SI (type_cra_660004609 != SORTANT_660004609)
      ALORS
# Remarque : le cas SORTANT classique est deja traite par table de duplication
        erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")

# FE_0008 CIT_EVOL_IDPART
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_EVOL_IDPART,0)

        SI ( erreur_660004609 != 0 )
        ALORS
          trace("Erreur duplication champ idpart")
          ERREUR_660004609 = ERR_NORM_660004609
          code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
          erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609,"idpart", 0)
          SAUT STOCKE_ERRONE
        FINSI
      FINSI
    SINON
      SI (is_roamers_660004609)
      ALORS
        trace ("[G1R5] cas is_roamer----")
        trace("Mise a jour idpart cas roamer")
# Cas de duplication pour un roamers
        SI (type_cra_660004609 == SORTANT_660004609)
        ALORS
# Cas roamers camel : normalisation avec CIT_IDENT
          SI ( (idpart_not_00_660004609) && ((lg_NewNumSCP1_660004609 > 0) || (lg_NewNumSCP2_660004609 > 0)) )
          ALORS
            trace("[G1R5]-1- cas idpart_not_00) && ((lg_NewNumSCP1 > 0) || (lg_NewNumSCP2 > 0")
            erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
            erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_IDENT,0)
            SI ( erreur_660004609 != 0 )
            ALORS
              trace("Erreur duplication champ idpart")
              ERREUR_660004609 = ERR_NORM_660004609
              code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
              erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
              SAUT STOCKE_ERRONE
            FINSI
          SINON
# Cas roamers : si echec normalisation avec CIT_ROAMERS_SORTANT : recopie sans TON+NPI (CIT_IDENT)
            erreur_660004609 = i_cree_art("Tnormal",g_iartout2)

            erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout2,$TcitR4::idpart,0,-$NORM:CIT_ROAMERS_SORTANT,0)
            SI (erreur_660004609 != 0)
            ALORS
              erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
              erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_IDENT,0)
              SI ( erreur_660004609 != 0 )
              ALORS
                trace("Erreur duplication champ idpart")
                ERREUR_660004609 = ERR_NORM_660004609
                code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
                erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
                SAUT STOCKE_ERRONE
              FINSI
            SINON
              erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")
              erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_ROAMERS_SORTANT,0)
              SI ( erreur_660004609 != 0 )
              ALORS
                trace("Erreur duplication champ idpart")
                ERREUR_660004609 = ERR_NORM_660004609
                code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
                erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
                SAUT STOCKE_ERRONE
              FINSI
            FINSI
          FINSI
        SINON
# Cas roamers de type ENTRANT ou RENVOIM (seuls les types SORTANT ENTRANT et RENVOIM peuvent etre roamers
          erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")

# Troncature du numero a partir du premier digit non numerique
# Table TRUNC_ALCATEL_INATIONAL
#         CIT_ROAMERS_IDPART
          erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_ROAMERS_IDPART,0)
          SI ( erreur_660004609 != 0 )
          ALORS
            trace("Erreur duplication champ idpart")
            ERREUR_660004609 = ERR_NORM_660004609
            code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
            erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
            SAUT STOCKE_ERRONE
          FINSI
        FINSI
      SINON
# Cas de duplication pour un roamers court
# Cas roamers court : si echec normalisation avec CIT_ROAMERS_COURT : recopie sans TON+NPI (CIT_IDENT)

# ANO PVCS 1985
        erreur_660004609 = i_ajout_tlv(g_iartout, "T3t2", "")

        erreur_660004609 = i_cree_art("Tnormal",g_iartout2)
        erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout2,$TcitR4::idpart,0,-$NORM:CIT_ROAMERS_COURT,0)
        SI (erreur_660004609 != 0)
        ALORS
          erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_IDENT,0)
          SI ( erreur_660004609 != 0 )
          ALORS
            trace("Erreur duplication champ idpart")
            ERREUR_660004609 = ERR_NORM_660004609
            code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
            erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart", 0)
            SAUT STOCKE_ERRONE
          FINSI
        SINON
          erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::idpart,$Tdpvgsm::idpart,-$NORM:CIT_ROAMERS_COURT,0)
          SI ( erreur_660004609 != 0 )
          ALORS
            trace("Erreur duplication champ idpart")
            ERREUR_660004609 = ERR_NORM_660004609
            code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
            erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "idpart",0)
            SAUT STOCKE_ERRONE
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour du champ MSISDN (T3t4)
####################################################################

SI (type_cra_660004609 != TRANSIT_660004609)
ALORS
# Le champ MSISDN est mis a jour seulement si ce n est pas
# Un appel urgent sans carte SIM (car le champ lien est absent dans ce cas)
## OGA 302 : pas de duplication du MSISDN quand le MSISDN est absent, pour eviter l'envoi en errone
  SI ( (is_emergency_no_sim_660004609 != 1) && (i_valid_field_n(g_iartin, $TcitR4::lien)==1) )
  ALORS
    SI (is_roamers_660004609)
    ALORS
# On normalise le champ lien avec l automate CIT_ROAMERS
      taille_lien_660004609 = i_get_art_field(g_iartin, $TcitR4::lien-1)
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t4", "")
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::lien,
      $Tdpvgsm::MSISDN,-$NORM:CIT_ROAMERS,0)
      SI ( erreur_660004609 != 0 )
      ALORS
        trace("Erreur duplication champ MSISDN")
        ERREUR_660004609 = ERR_NORM_660004609
        code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
        erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "MSISDN", 0)
        SAUT STOCKE_ERRONE
      FINSI
    SINON
# On normalise le champ lien avec l automate CIT_EVOL
      taille_lien_660004609 = i_get_art_field(g_iartin, $TcitR4::lien-1)
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t4", "")
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TcitR4::lien,$Tdpvgsm::MSISDN,-$NORM:CIT_EVOL,0)
      SI ( erreur_660004609 != 0 )
      ALORS
        trace("Erreur duplication champ MSISDN")
        ERREUR_660004609 = ERR_NORM_660004609
        code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
        erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12,"", 2, code_rejet_660004609, "MSISDN", 0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour du champ portOrigNet (T3t6)
# FE_0009 : copie de LocationNumber sans TON et NPI
####################################################################

# On verifie que le champ origLocNumber est present
origLocNum_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::LocationNum)
SI (origLocNum_present_660004609)
ALORS
  SI (i_get_art_field(g_iartin, $TcitR4::LocationNum-1) == 0)
  ALORS
    origLocNum_present_660004609 = 0
  FINSI
FINSI
# Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004609)
ALORS
  SI (i_get_art_field(g_iartin, $TcitR4::LocationNum-1) >= 2)
  ALORS
    TON_origLocNum_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::LocationNum, 0)
    NPI_origLocNum_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::LocationNum, 1)
# PortOrigNet sera absent du DPV si en entree le champ
# OrigLocNumber a un TON NPI different de A1
    SI ( (TON_origLocNum_660004609 == 0xA) && (NPI_origLocNum_660004609 == 1) )
    ALORS
      erreur_660004609 = i_ajout_tlv(g_iartout,"T3t6","")

# copie de LocationNumber sans le TONNPI
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcitR4::LocationNum, $Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004609 != 0 )
      ALORS
        trace("Erreur duplication champ portOrigNet")
        ERREUR_660004609 = ERR_NORM_660004609
        code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
        erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12,"", 2, code_rejet_660004609, "portOrigNet", 0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour du T3t11 GSM IN services invocation
####################################################################

lg_INserv_660004609 = i_get_art_field(g_iartin, ($TcitR4::INserv-1))
nbsvcIN_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::INserv, 0)
taille_ISDN_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::INserv, 1 + (2 * nbsvcIN_660004609))

SI ( ( lg_INserv_660004609 <= 0 ) || ( nbsvcIN_660004609 == 0 ) )
ALORS
  SAUT NO_CMPSV_ISDN
FINSI

# Creation du T4t11.1
erreur_660004609 = i_ajout_tlv(g_iartout, "T4t11.1", "")
erreur_660004609 = i_resize_tlv(g_iartout,"T4t11.1","nbsvcIN",1)

# Mise a jour nbsvcIN
erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, nbsvcIN_660004609)

# Creation du T4t11.2
erreur_660004609 = i_ajout_tlv(g_iartout, "T4t11.2", "")
erreur_660004609 = i_resize_tlv(g_iartout,"T4t11.2","lstSVCIN",2*nbsvcIN_660004609)

# Mise a jour lstSVCIN
# Chaque element est compose de 2 octets

num_660004609 = 0
POINT BOUCLE_CMPSV
erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN,
(2*num_660004609),
i_get_art_fieldtab(g_iartin,
$TcitR4::INserv,
(2*num_660004609 + 1)) )
erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN,
(2*num_660004609 + 1),
i_get_art_fieldtab(g_iartin,
$TcitR4::INserv,
(2*num_660004609 + 2)) )
num_660004609 = num_660004609 + 1
SI (num_660004609 < nbsvcIN_660004609)
ALORS
  SAUT BOUCLE_CMPSV
FINSI

# DPV TLV : mise a jour SCPIN
SI (taille_ISDN_660004609 <= 0)
ALORS
  SAUT NO_CMPSV_ISDN
FINSI
# Creation du T4t11.3
erreur_660004609 = i_ajout_tlv(g_iartout, "T4t11.3", "")

# Mise a jour SCPIN
# Test si la valeur de V4t11.2 = 0020
SI ( (nbsvcIN_660004609 == 0x01)
  && (i_get_art_fieldtab(g_iartout,$Tdpvgsm::lstSVCIN,0) == 0x00)
  && (i_get_art_fieldtab(g_iartout,$Tdpvgsm::lstSVCIN,1) == 0x20) )
ALORS
# Recopie du champ et normalisation
# Cet article permet d utiliser une normalisation
# A partir d une partie d un champ
  erreur_660004609 = i_cree_art("Tnormal",g_iartout2)
  erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)
  erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0,
  i_get_art_fieldtab_ptr(g_iartin,
  $TcitR4::INserv,
  (2*nbsvcIN_660004609)+2),
  taille_ISDN_660004609)

  erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2,
  g_iartout,
  0,
  $Tdpvgsm::SCPIN,
  -$NORM:CIT_SCPIN,
  0)
  SI (erreur_660004609 != 0)
  ALORS
    trace("Erreur dup champ SCPIN")
    ERREUR_660004609 = ERR_NORM_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "SCPIN", 0)
    SAUT STOCKE_ERRONE
  FINSI

SINON
# Simple recopie du champ
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t11.3","SCPIN",8 * taille_ISDN_660004609)

# Chaque element est compose de 1 octet
  num_660004609 = 0
  POINT BOUCLE_ISDN
  octet_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::INserv, (2*nbsvcIN_660004609)+2+num_660004609)
  Q1_660004609 = octet_660004609 / 0x10
  Q2_660004609 = octet_660004609 & 0x0f
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::SCPIN, 2*num_660004609, Q1_660004609)
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::SCPIN, (2*num_660004609)+1, Q2_660004609)
  num_660004609 = num_660004609 + 1
  SI (num_660004609 < taille_ISDN_660004609)
  ALORS
    SAUT BOUCLE_ISDN
  FINSI
FINSI

POINT NO_CMPSV_ISDN

####################################################################
# Mise a jour eventuelle du champ portpref (T3t12)
####################################################################

SI ( RoutingNumberVal_660004609 != -1 )
ALORS
# Si un prefixe RN a ete trouve alors mise a jour du champ du DPV
  erreur_660004609 = i_ajout_tlv(g_iartout, "T3t12", "")
  erreur_660004609 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberVal_660004609 / 1000) % 10 )
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberVal_660004609 / 100)  % 10 )
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberVal_660004609 / 10)   % 10 )
  erreur_660004609 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberVal_660004609 % 10) )
FINSI

####################################################################
# Mise a jour des champs transporteur Entrant et Sortant
####################################################################

# MISE A JOUR DU CHAMP TrSortant
# Pour les types de CRAs 0, 2, 4, 5, 6 et 8

SI (type_cra_660004609==SORTANT_660004609 || type_cra_660004609==RENVOIM_660004609 || type_cra_660004609==REACH_660004609 || type_cra_660004609==RENVREA_660004609 || type_cra_660004609==RENVOIG_660004609 || type_cra_660004609==TRANSIT_660004609 || AIG_pseudo_DPV_660004609==1)
ALORS
# Gestion du format Alcatel sur 5 octet eventuellement precede d un octet ou 2 a ne pas dupliquer

  tailleChpTrans_660004609 = i_get_art_field(g_iartin,($TcitR4::reqBearSrvc-1))
  SI (tailleChpTrans_660004609 <=  7 && tailleChpTrans_660004609 >  2 && i_valid_field_n(g_iartin,$TcitR4::reqBearSrvc))
  ALORS
# Format R7 -- 2 octets + Link identity
    SI (tailleChpTrans_660004609 == 7)
    ALORS
# Cas ou le champ outgoing trunc group est precede de Channel type, Speech version
# Best Speech Full et Best Speech Half
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t16", "")
      erreur_660004609 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004609-2)
      erreur_660004609 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::TrSortant, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::reqBearSrvc,2), tailleChpTrans_660004609-2)
    FINSI
# Format R5 -- 1 octet + Link identity
    SI (tailleChpTrans_660004609 == 6)
    ALORS
# Cas ou le champ outgoing trunc group est precede de Channel type et Speech version
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t16", "")
      erreur_660004609 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004609-1)
      erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::reqBearSrvc,1), tailleChpTrans_660004609-1)
    FINSI
# Format R5 ou R7 -- Link identity seul
    SI (tailleChpTrans_660004609 == 5)
    ALORS
# Cas ou le champ outgoing trunc group est seul
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t16", "")
      erreur_660004609 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004609)
      erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, g_iartin.reqBearSrvc[], tailleChpTrans_660004609)
    FINSI
  FINSI
FINSI

# MISE A JOUR DU CHAMP TrEntrant
# Pour les types de CRAs 1, 2, 4, 5, 6 et 8

SI (type_cra_660004609==ENTRANT_660004609 || type_cra_660004609==RENVOIM_660004609 || type_cra_660004609==REACH_660004609 || type_cra_660004609==RENVREA_660004609 || type_cra_660004609==RENVOIG_660004609 || type_cra_660004609==TRANSIT_660004609)
ALORS
  tailleChpTrans_660004609 = i_get_art_field(g_iartin,($TcitR4::idITG-1))
  SI ( (tailleChpTrans_660004609 <= 7 )
    && (i_valid_field_n(g_iartin,$TcitR4::idITG)) )
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004609 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004609)
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.idITG[], tailleChpTrans_660004609)
  SINON
    SI (i_valid_field_n(g_iartin,$TcitR4::idITG))
    ALORS
      erreur_660004609 = i_ajout_tlv(g_iartout, "T3t17", "")
      erreur_660004609 = i_resize_tlv(g_iartout,"T3t17","TrEntrant", 7)
      erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.idITG[], 7)
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour des champs Camel Services invocation (T3t18)
####################################################################

# ATTENTION : Sont concernes uniquement les R4B !!!!!!!
#
# Determination des sous champs "CallRefNum et MscId"
#
taille_660004609=0
lg_CRNMSCId_660004609 = i_get_art_field(g_iartin, ($TcitR4::CRNMSCId-1))
SI ( lg_CRNMSCId_660004609 > 0 )
ALORS
# Sous champ "CRN : Call Reference Number"
  lg_CRN_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::CRNMSCId,0)
  offset_CRN_660004609 = 1
  taille_660004609 = lg_CRN_660004609 + 1

# Sous champ "MSC Id"
  lg_MSCId_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::CRNMSCId,taille_660004609)
  offset_MSCId_660004609 = taille_660004609 + 1
SINON
  lg_CRN_660004609=0
  lg_MSCId_660004609=0
FINSI

#
# Mise a jour des champ en sortie de duplication
#
SI (lg_camel_660004609 <= 0 && lg_camel2_660004609 <= 0)
ALORS
  SAUT NO_CAMEL
FINSI

SI (lg_camel_660004609 > 0)
ALORS
  indice_chp_camel_660004609 = $TcitR4::camel
FINSI
SI (lg_camel2_660004609 > 0)
ALORS
  indice_chp_camel_660004609 = $TcitR4::camel2
FINSI

SI ( nb_camel_660004609 )
ALORS
# Duplication CAMEL phase 1 vers T3t18 DPV
  SI (lg_CRN_660004609 <= 0 || lg_MSCId_660004609 <= 0)
  ALORS
    trace("Pas de Call Reference Number: pas de Camel")
    SAUT NO_CAMEL
  FINSI
# Creation du champ T4t18.1
  erreur_660004609 = i_ajout_tlv(g_iartout, "T4t18.1", "")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t18.1","C_CallRefNum",lg_CRN_660004609*8)
  erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_CallRefNum,
  i_get_art_fieldtab_ptr(g_iartin, $TcitR4::CRNMSCId, offset_CRN_660004609), lg_CRN_660004609)

# Cet article permet d utiliser une normalisation a partir
# D une partie d un champ

  erreur_660004609 = i_cree_art("Tnormal",g_iartout2)

# Creation du champ T4t18.2
  erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)
  erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0,
  i_get_art_fieldtab_ptr(g_iartin,
  $TcitR4::CRNMSCId,
  offset_MSCId_660004609)
  , lg_MSCId_660004609)

  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.2","")
  erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2, g_iartout, 0, $Tdpvgsm::C_MSCAddress, -$NORM:CIT_EVOL, 0)
  SI ( erreur_660004609 != 0)
  ALORS
    trace("Erreur dup champ MSCAddress")
    ERREUR_660004609 = ERR_NORM_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "C_MSCAddress", 0)
    SAUT STOCKE_ERRONE
  FINSI

  SI ( lg_SCPAddress1_660004609 > 0 )
  ALORS
# Creation du champ T4t18.3
    erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)

    SI (lg_camel_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2,0,
      i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel,offset_SCPAddress1_660004609)
      ,lg_SCPAddress1_660004609)
    FINSI
    SI (lg_camel2_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel2,offset_SCPAddress1_660004609), lg_SCPAddress1_660004609)
    FINSI
    erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.3","")
    erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2, g_iartout, 0, $Tdpvgsm::C_SrvAddress1, -$NORM:CIT_EVOL, 0)
    SI ( erreur_660004609 != 0)
    ALORS
      trace("Erreur dup champ SCPAddress1")
      ERREUR_660004609 = ERR_NORM_660004609
      code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
      erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609 ,"C_SrvAddress1", 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

  SI ( lg_NewNumSCP1_660004609 > 0 )
  ALORS
# Creation du champ T4t18.4
    erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)
    SI (lg_camel_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin, $TcitR4::camel, offset_NewNumSCP1_660004609), lg_NewNumSCP1_660004609)
    FINSI
    SI (lg_camel2_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2,0, i_get_art_fieldtab_ptr(g_iartin, $TcitR4::camel2, offset_NewNumSCP1_660004609), lg_NewNumSCP1_660004609)
    FINSI
    erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.4","")

    SI (is_roamers_660004609)
    ALORS
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2,g_iartout,0,$Tdpvgsm::C_DestNum1,-$NORM:CIT_ROAMERS,0)
    SINON
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2,g_iartout,0,$Tdpvgsm::C_DestNum1,-$NORM:CIT_EVOL,0)
    FINSI
    SI ( erreur_660004609 != 0)
    ALORS
      trace("Erreur dup champ NewNumSCP1")
      ERREUR_660004609 = ERR_NORM_660004609
      code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
      erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "C_DestNum1", 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

# Creation du champ T4t18.5
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.5","")
  SI (lg_camel_660004609 > 0)
  ALORS
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key1, i_get_art_fieldtab_ptr(g_iartin, $TcitR4::camel, offset_svckey1_660004609), 4)
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_InitCfInd1, i_get_art_fieldtab(g_iartin, $TcitR4::camel, offset_infoGiven1_660004609))
  FINSI
  SI (lg_camel2_660004609 > 0)
  ALORS
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key1, i_get_art_fieldtab_ptr(g_iartin, $TcitR4::camel2, offset_svckey1_660004609) ,4)
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_InitCfInd1, i_get_art_fieldtab(g_iartin, $TcitR4::camel2, offset_infoGiven1_660004609))
  FINSI
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_Level1, 0xF)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_DefChInd1, 0xF)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_Modif1, 0xF)

  SI (nb_camel_660004609==1)
  ALORS
    SAUT NO_CAMEL
  FINSI

# Mise a jour des champs Camel Key 2
  SI ( lg_SCPAddress2_660004609 > 0 )
  ALORS
# Creation du champ T4t18.9
    erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)
    SI (lg_camel_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel,offset_SCPAddress2_660004609), lg_SCPAddress2_660004609)
    FINSI
    SI (lg_camel2_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel2,offset_SCPAddress2_660004609), lg_SCPAddress2_660004609)
    FINSI

    erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.9","")
    erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2,g_iartout,0,$Tdpvgsm::C_SrvAddress2,-$NORM:CIT_EVOL,0)

    SI ( erreur_660004609 != 0)
    ALORS
      trace("Erreur dup champ SCPAddress2")
      ERREUR_660004609 = ERR_NORM_660004609
      code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
      erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2, code_rejet_660004609, "C_SrvAddress2", 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

  SI ( lg_NewNumSCP2_660004609 > 0 )
  ALORS
# Creation du champ T4t18.10
    erreur_660004609 = i_memset_field_n(g_iartout2,0,0xFF)
    SI (lg_camel_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel,offset_NewNumSCP2_660004609), lg_NewNumSCP2_660004609)
    FINSI
    SI (lg_camel2_660004609 > 0)
    ALORS
      erreur_660004609 = i_memcpy_art_field_n(g_iartout2, 0, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel2,offset_NewNumSCP2_660004609), lg_NewNumSCP2_660004609)
    FINSI

    erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.10","")
    erreur_660004609 = i_dup_chp_rnisGSM(g_iartout2,g_iartout,0,$Tdpvgsm::C_DestNum2,-$NORM:CIT_EVOL,0)

    SI ( erreur_660004609 != 0)
    ALORS
      trace("Erreur dup champ NewNumSCP2")
      ERREUR_660004609 = ERR_NORM_660004609
      code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
      erreur_660004609=i_PlvMessEmettre(8285, 2, g_iartout12, "", 2 ,code_rejet_660004609 ,"C_DestNum2", 0)
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

# Creation du champ T4t18.11
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t18.11","")
  SI (lg_camel_660004609 > 0)
  ALORS
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key2, i_get_art_fieldtab_ptr(g_iartin,$TcitR4::camel,offset_svckey2_660004609), 4)
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_InitCfInd2, i_get_art_fieldtab(g_iartin,$TcitR4::camel,offset_infoGiven2_660004609))
  FINSI
  SI (lg_camel2_660004609 > 0)
  ALORS
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key2, i_get_art_fieldtab_ptr(g_iartin, $TcitR4::camel2, offset_svckey2_660004609), 4)
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_InitCfInd2, i_get_art_fieldtab(g_iartin,$TcitR4::camel2,offset_infoGiven2_660004609))
  FINSI
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_Level2, 0xF)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_DefChInd2,0xF)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::C_Modif2,0xF)

FINSI

POINT NO_CAMEL

####################################################################
# Mise a jour des champ timeInCE et eec (T3t30)
####################################################################
  # QC1331
  #erreur=set_timeInCE_EEC(0)
  ########### Date_Audit
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
  ########### eec
# QC1405
  SI (g_ieec > 500)
  ALORS
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
  SINON
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
  FINSI
#/QC1405

####################################################################
# Mise a jour eventuelle du champ ZBprefix (T3t34)
#G2R5 lot2 uniquement si cra 0x04 ou 0x8 et D==8 (ZB entrante)
####################################################################

SI (ZBPrefixVal_660004609 != -1)
ALORS
  SI (type_cra_660004609 == TRANSIT_660004609 || type_cra_660004609 == REACH_660004609 )
  ALORS
    SI (ZBPrefixDigitD_660004609 == 8)
    ALORS
      erreur_660004609 = i_ajout_tlv(g_iartout,"T3t34","")
      erreur_660004609 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",24)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,0,ZBPrefixDigit1_660004609)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,1,ZBPrefixDigit2_660004609)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,2,ZBPrefixDigit3_660004609)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,3,ZBPrefixDigitD_660004609)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,4,ZBPrefixDigitO_660004609)
      erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix,5,ZBPrefixDigitT_660004609)
    FINSI
  FINSI
FINSI

####################################################################
# Mise a jour des champs Services Infos (T3t35)
####################################################################

MPTYM_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::MPTYM)
SI (MPTYM_present_660004609)
ALORS
# Ajout du champ T4t35.1 duration
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t35.1","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t35.1","duration",3)
  duration1_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::MPTYM, 0)
  duration2_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::MPTYM, 1)
  duration3_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::MPTYM, 2)
  duration_val_660004609 = duration1_660004609*0x010000 +
  duration2_660004609*0x000100 +
  duration3_660004609*0x000001
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::duration, duration_val_660004609)

# Ajout du champ T4t35.2 occurenceNb
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t35.2","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t35.2","occurenceNb",1)
  occurenceNb_val_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::MPTYM, 6)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::occurenceNb, occurenceNb_val_660004609)

# Ajout du champ T4t35.3 participantsNb
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t35.3","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t35.3","participantsNb",2)
  participantsNb_val_660004609 = i_get_art_fieldtab(g_iartin, $TcitR4::MPTYM, 4)
  SI ( participantsNb_val_660004609 == 0xFF )
  ALORS
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::participantsNb, 0xFFFF)
  SINON
    erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::participantsNb, participantsNb_val_660004609)
  FINSI
FINSI

# Ajout du champs T4t35.4 presenceInd
mptys_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::MPTYM+1)
SI ( mptys_present_660004609 )
ALORS
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t35.4","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t35.4","presenceInd",1)
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::presenceInd, 0x01)
FINSI

####################################################################
# Mise a jour du champ CSD additionnal infos (T3t37)
####################################################################

fnur_present_660004609 = i_valid_field_n(g_iartin, $TcitR4::FNUR)
SI ( fnur_present_660004609 )
ALORS
  userRate_660004609 = i_get_art_field(g_iartin, $TcitR4::FNUR)
SINON
  SI (i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x17 || i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x1F )
  ALORS
    userRate_660004609 = 0x08
  SINON
    userRate_660004609 = 0xFF
  FINSI
FINSI

SI (i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x17 || i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x1F )
ALORS
  userProtocol_660004609 = 0x04
  tranInd_660004609 = 0x00
SINON
  userProtocol_660004609 = 0xFF
  tranInd_660004609 = 0xFF
FINSI

SI ((userRate_660004609 != 0xFF) || (userProtocol_660004609 != 0xFF) || (tranInd_660004609 != 0xFF))
ALORS
  erreur_660004609 = i_ajout_tlv(g_iartout,"T3t37","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T3t37","CSDaddInfo",3)
  CSDaddInfo_val_660004609 = userRate_660004609 * 0x10000 + userProtocol_660004609 *0x100 + tranInd_660004609
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::CSDaddInfo,CSDaddInfo_val_660004609)
FINSI


####################################################################
# Mise a jour des champs Original CDR infos (T3t38)
####################################################################

# Ajout du champ V4t38.1 origCallpartId

SI (type_cra_660004609 == SORTANT_660004609 || type_cra_660004609 == RENVOIM_660004609)
ALORS
  calledNumber_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::idpart)
  SI (calledNumber_present_660004609)
  ALORS
    erreur_660004609 = i_cree_art("TnormalHAscii", g_iartout5)
    erreur_660004609 = i_ajout_tlv(g_iartout5, "T3t1", "buf")
    erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout5, $TcitR4::idpart, $TnormalHAscii::buf, -$NORM:AUT_IDENT,0)
    res_660004609 = i_get_art_field(g_iartout5, $TnormalHAscii::buf -1)
    erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout5.buf[], res_660004609)
    erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004609)
  FINSI
FINSI

# OMOF
#G3R10, Ajout du champ V4t38.1 origCallpartId, condition incluse dans omof : type_cra == TRANSIT
SI (i_strcmp(pt_omof_660004609,"omof") == 0)
ALORS
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.1","")
  erreur_660004609 = i_set_art_str(g_iartout, $Tdpvgsm::origCallpartId, pt_pref_OMOF_660004609)
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", i_strlen(pt_pref_OMOF_660004609))
FINSI
#\G3R10

# Ajout du champ V4t38.2 dialledDigits

SI ( type_cra_660004609 == SORTANT_660004609 )
ALORS
  calledNumber_present_660004609 = i_valid_field_n(g_iartin,$TcitR4::idpart)
  SI (calledNumber_present_660004609)
  ALORS
    lg_buf_660004609 = i_get_art_fieldlength(g_iartin,$TcitR4::idpart)
    trace1("Longueur idpart :<%d>",lg_buf_660004609)
    SI( lg_buf_660004609 > 2 )
    ALORS
      erreur_660004609 = i_cree_art("TnormalHAscii", g_iartout7)
      erreur_660004609 = i_ajout_tlv(g_iartout7, "T3t1", "buf")
      erreur_660004609 = i_dup_chp_rnisGSM(g_iartin, g_iartout7, $TcitR4::idpart, $TnormalHAscii::buf, -$NORM:CIT_IDENT,0)
      res_660004609 = i_get_art_field(g_iartout7, $TnormalHAscii::buf -1)
      erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.2","")
      erreur_660004609 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::dialledDigits, g_iartout7.buf[], res_660004609)
      erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.2","dialledDigits", res_660004609)
    FINSI
  FINSI
FINSI

# Ajout du champ V4t38.3 equipmentType

erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.3","")
erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.3","equipmentType",1)
erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::equipmentType, 0x01)

# Ajout du champ V4t38.5 originBearSrv

SI (type_cra_660004609 == TRANSIT_660004609)
ALORS
  val_svcsup_660004609 = i_get_art_field(g_iartin, $TcitR4::svcsup)
  erreur_660004609 = i_ajout_tlv(g_iartout,"T4t38.5","")
  erreur_660004609 = i_resize_tlv(g_iartout,"T4t38.5","originBearSrv",1)
  erreur_660004609 = i_set_art_field(g_iartout,$Tdpvgsm::originBearSrv,val_svcsup_660004609)
FINSI


# G1R4 - Cell_id: Alimentation de V4T52.1 par camel2/FCIdata
####################################################################
# Mise a jour du champ callingLocation (T3t52)
# si type_cra = 0, 2 ou 6
####################################################################
SI (type_cra_660004609 == SORTANT_660004609 || type_cra_660004609 == RENVOIM_660004609 || type_cra_660004609 == RENVOIG_660004609)
ALORS

  g_iartout9.CellIDOFH[0] = g_iartin.camel2[(offset_FCIdata1_660004609 + 4)]
  g_iartout9.CellIDOFH[1] = g_iartin.camel2[(offset_FCIdata1_660004609 + 5)]
  g_iartout9.CellIDOFH[2] = g_iartin.camel2[(offset_FCIdata1_660004609 + 6)]

  erreur_660004609 = i_get_art_str(g_iartout9, $Conv_URS::CellIDOFD, pt_BUF_660004609)
  i_get_sub_str(pt_BUF_660004609, 0, 4, pt_BUF_660004609)

  erreur_660004609 = i_format_str2( pt_cle_CellID_OF_660004609, "%s%s", "CellID_OF_", pt_BUF_660004609 )

  date_cra_660004609=i_get_art_field(g_iartin,$TcitR4::DATE)
  SI(i_get_tab_field("VariableContexte",date_cra_660004609,pt_cle_CellID_OF_660004609)!=g_inull)
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t52", "")
    erreur_660004609 = i_resize_tlv(g_iartout,"T4t52.1","callingLocation", 3)
    erreur_660004609 = i_retrait_tlv(g_iartout, "T4t52.2", "")
    # FO 555 : offset_FCIdata1 pointe sur le debut de la sous_structure FCIdata
    # Pour recuperer l'information FCIdata, il faut ignorer les 2 premiers octets
    # (correspondants a Lenght of FCIdata et leg ID
    g_iartout.callingLocation[0] = g_iartin.camel2[(offset_FCIdata1_660004609 + 4)]
    g_iartout.callingLocation[1] = g_iartin.camel2[(offset_FCIdata1_660004609 + 5)]
    g_iartout.callingLocation[2] = g_iartin.camel2[(offset_FCIdata1_660004609 + 6)]

    erreur_660004609 = ((g_iartout.callingLocation[2]/0x10) * 0x10)
    g_iartout.callingLocation[2] = erreur_660004609 + 0x0F


  FINSI
FINSI
# FIN G1R4 - Cell_id: Alimentation de V4T52.1 par camel2/FCIdata

#G2R1 lot1
####################################################################
# Mise a jour du champ callingLocation (T3t57)
# si type_cra = 8 (TRANSIT)ou 4 (REACH)
# ZB_idpart et ZB_local remplacees par ZBPrefixVal
# si ZBPrefixVal=600789 ou 600989 forme 600DOT
# longueur du resize en nb bits = 6 quartets = 6x4 = 24 bits
####################################################################
SI (type_cra_660004609 == TRANSIT_660004609 || type_cra_660004609 == REACH_660004609 )
ALORS
# 15/04/2009 - DRE - G2R2 - Fiabilisation CRAs Zone Blanche Complement spec: CRA_ALCATEL_Circuit_R7_A22.0.doc
  SI (ZBPrefixVal_660004609 != -1 && ZBPrefixDigitO_660004609 == 8)
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout,"T3t57","")
    erreur_660004609 = i_resize_tlv(g_iartout,"T3t57","GDCB",24)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,0,6)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,1,0)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,2,0)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,3,ZBPrefixDigitD_660004609)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,4,ZBPrefixDigitO_660004609)
    erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB,5,ZBPrefixDigitT_660004609)
  FINSI
FINSI
#\G2R1 lot1

#G3R3 LOT2
#################################################################
# Mise a jour du champ LastCallingNb (T3t63)
# Si type cra = 1(ENTRANT) ou 2(RENVOIN) ou 4(REACH) ou 6(RENVOIG) ou 8(TRANSIT)
# valorise par le dernier appelant T3t13/idpart
#################################################################
# G3R4 QC896 evol T3t63
#QC1148 generation du T3t63 pour les MsgCrtE
SI (i_valid_field_n(g_iartin,$TcitR4::idpart))
ALORS
  SI (type_cra_660004609 == ENTRANT_660004609 || type_cra_660004609 == MsgCrtE_660004609 || type_cra_660004609 == RENVOIM_660004609 || type_cra_660004609 == REACH_660004609 || type_cra_660004609 == RENVOIG_660004609)
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t63", "LastCallingNb")
    erreur_660004609 = i_dup_chp_1val(g_iartout, g_iartout, $Tdpvgsm::idpart, $Tdpvgsm::LastCallingNb)
    # pour le calcul du champ T3t63 du pseudo_DPV (present si type_cra == RENVOIM)
    erreur_660004609 = i_dup_chp_1val(g_iartout, g_iartout9, $Tdpvgsm::LastCallingNb, $Conv_URS::idpart)
  FINSI
  SI (type_cra_660004609 == TRANSIT_660004609)
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t63", "LastCallingNb")
    erreur_660004609 = i_dup_chp_1val(g_iartout, g_iartout, $Tdpvgsm::local, $Tdpvgsm::LastCallingNb)
  FINSI
FINSI
#\G3R3 Lot2

# G3R10 suppresion remplissage par prefixe ITInerance du T3t69
#/G3R10

#############################################################
#G3R4lot1 prefix sva
# Mise a jour du champ T3t70 (PrefixeSAV)
##############################################################
#QC915
SI (Prefix_sav_660004609 != -1)
ALORS
  #trace2("<<__LINE__ ====cra 0x04 Prefixe sva DETECTE (PrefixeSVA) = <%s>=====",pt_PrefixeSVA,"")
  erreur_660004609 = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004609 = i_conv_ascii_dcb (pt_PrefixeSVA_660004609, pt_PrefixeSVADCB_660004609)
  erreur_660004609 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixeSVADCB_660004609, longueur_660004609)
  trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur_660004609)
  erreur_660004609 = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004609 * 8)

SINON
#G3R8 lot2 Prefix de joignabilite
  SI (PREFIXjoig_660004609 == 1)
  ALORS
    trace2 ("<<__LINE__>> ============ pt_PrefixJoing = %s cra 06 prefix de joignabilite detecte =====", pt_PrefixJoing_660004609,"")
    erreur_660004609 = i_ajout_tlv(g_iartout,"T3t70","")
    longueur_660004609 = i_conv_ascii_dcb (pt_PrefixJoing_660004609, pt_PrefixJoingDCB_660004609)
    erreur_660004609 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004609, longueur_660004609)
    trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur_660004609)
    erreur_660004609 = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004609 * 8)

  FINSI
FINSI

####################################################################
# Calcul prevalorisation et affectation des valeurs nbut au DPV
# Pas de prevalorisation des DPV type 01 ("Appel entrant")
####################################################################
SI (type_cra_660004609 != ENTRANT_660004609 && type_cra_660004609 != TRANSIT_660004609 && !is_emergency_no_sim_660004609)
ALORS
# Maj temporaire de la valeur du champ indtax a 0x01 avant le calcul
# De prevalorisation
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0x01)
#########
# appel preval
#########

  val_nbUT_660004609 = preval_ut_660004265(g_iartout)

  SI (val_nbUT_660004609 == -1)
  ALORS
# Cas erreur de prevalorisation
    trace("Erreur de prevalorisation")
    ERREUR_660004609 = ERR_VALO_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8286, 2,  g_iartout12 , "", 1, code_rejet_660004609, 0, 0)
    erreur_660004609 = i_stocke_art(g_iartout12, 0,PT_ERRONE,0)
    RETOUR TRAIT_OK
# SAUT STOCKE_ERRONE
  SINON
    SI (val_nbUT_660004609 == -2)
    ALORS
      trace("pas de prevalorisation : retour preval == -2")
    SINON
#   Cas prevalorisation OK
      trace1("Prevalorisation OK (ou inhibee) avec valeur : %d", val_nbUT_660004609)
      erreur_660004609=i_set_art_field(g_iartout,$Tdpvgsm::nbUT,val_nbUT_660004609)
    FINSI
  FINSI
#########
# /appel preval
#########
# Maj de la valeur du champ indtax a 0xff apres le calcul de prevalorisation
  erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0xff)
FINSI

####################################################################
# Stockage du DPV
####################################################################
POINT STOCK_DPV
SI (type_cra_660004609 != TRANSIT_660004609 && !is_emergency_no_sim_660004609)
ALORS
  # Ajout des T3t55 et T3t56
  SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GFlag2))
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout,"T3t55","")
  FINSI

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

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

  SI (AIG_pseudo_DPV_660004609 != 1)
  ALORS
    erreur_660004609 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004609, Multidistribution_Non_660004609)
  SINON
    erreur_660004609 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004609, Multidistribution_Oui_660004609)
  FINSI
  # QC1005
  SI (erreur_660004609 == TRAI_KO_660004609)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
    SAUT STOCKE_ERRONE
  FINSI
SINON
  # Ajout des T3t55 et T3t56
  SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GFlag2))
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout,"T3t55","")
  FINSI

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

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

# QC1005
  erreur_660004609 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_SPECIALE_660004609, Multidistribution_Non_660004609)
  SI (erreur_660004609 == TRAI_KO_660004609)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
    SAUT STOCKE_ERRONE
  FINSI
FINSI

####################################################################
# Creation du pseudo DPV
####################################################################

SI (pseudo_DPV_660004609)
ALORS
  erreur_660004609 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",DUP_ALC_R4_PSEUDO_660004609)
  SI (erreur_660004609 != 0)
  ALORS
    trace("Erreur de duplication")
    ERREUR_660004609 = ERR_DUPL_660004609
    code_rejet_660004609 = MODULE_660004609 + ERREUR_660004609 + EFFICACE_660004609
    erreur_660004609=i_PlvMessEmettre(8284, 2, g_iartout12, "", 2 ,code_rejet_660004609, type_cra_660004609, "Tdpvgsm")
    SAUT STOCKE_ERRONE
  FINSI
  
  #G5R1
# Ajout de T3t8/msgITX si (bT3T8ITX == 1)
SI (bT3T8ITX_660004609 == 1)
ALORS
	SI (i_valid_field_n(g_iartin,$TcitR4::msgITX))
  ALORS
		erreur_660004609 = i_ajout_tlv(g_iartout,"T3t8","")
  	erreur_660004609 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcitR4::msgITX))
		trace ("Ajout du champ msgITX")
	FINSI
FINSI

  pseudo_DPV_660004609 = 0
  AIG_pseudo_DPV_660004609 = 1
# On renseigne <local> a 2080100000000f en validant tout a zero
# Et en renseignant les quartets non nuls (2,8,1 et f)
  erreur_660004609 = i_memset_field_n(g_iartout,$Tdpvgsm::local,0x00)
  erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 0,0x02)
  erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 2,0x08)
  erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 4,0x01)
  erreur_660004609 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,13,0x0f)

  SI ( i_valid_field_n(g_iartin, $TcitR4::IMEI)==1 )
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t5", "")
    erreur_660004609 = i_memset_field_n(g_iartout,$Tdpvgsm::IMEI,0xFFFFFFFFFFFFFFFF)
    erreur_660004609 = i_resize_tlv(g_iartout,"T3t5","IMEI", i_get_art_field(g_iartin,$TcitR4::IMEI-1)*8)
  FINSI

#G3R3 lot2
#########################################
# Ajout du champ T3t63 LastCallingNb
#########################################
  SI (i_valid_field_n(g_iartin,$TcitR4::idpart))
  ALORS
    erreur_660004609 = i_ajout_tlv(g_iartout, "T3t63", "LastCallingNb")
    erreur_660004609 = i_dup_chp_1val(g_iartout9, g_iartout, $Conv_URS::idpart, $Tdpvgsm::LastCallingNb)
  FINSI

#/G3R3 lot2

# PVCS 1984 maj de la variable type_cra
  type_cra_660004609 = i_get_art_field(g_iartout,$Tdpvgsm::type)
# Mise a jour des autres champs du Pseudo DPV
  SAUT MAJ_AUTRES_CHAMPS
FINSI

trace("")
trace("**** TcitR4 : Module de distribution : Fin traitement ****")
RETOUR TRAIT_OK

POINT STOCKE_ERRONE

erreur_660004609 = i_make_art_rej(g_iartout12, g_iartout11, code_rejet_660004609)
erreur_660004609 = i_stocke_art(g_iartout11,0,PT_ERRONE,0)
# /FE 54
RETOUR TRAIT_OK
# ----------------------------- TcitR4_dis.src -------------------------------------------------------------
