DEFINITION C_ZB_1133600DOT_660004669 1
DEFINITION C_ZB_XX600DOT_660004669 2
DEFINITION Multidistribution_Non_660004669 0
DEFINITION Multidistribution_Oui_660004669 1
DEFINITION DISTRIBUTION_INCONNU_660004669 1
DEFINITION TRAI_KO_660004669 -1
DEFINITION TYPE_RENVOIM_660004669 0x02
DEFINITION TYPE_RENVOIG_660004669 0x06
DEFINITION MODULE_DISTR_660004669 0xA000
DEFINITION ERR_NORM_660004669 0x010
DEFINITION ERR_VALO_660004669 0x020
DEFINITION ERR_DUPL_660004669 0x0D0
DEFINITION ERR_DISTR_660004669 0x110
DEFINITION RNSAC_660004669 "RoutinNumberSac"
REGISTRE ENTIER Flag_ZB_660004669
REGISTRE POINTEUR pt_champ_660004669
REGISTRE POINTEUR pt_prefixe_ZB_660004669
REGISTRE ENTIER Prefix_index_660004669
REGISTRE ENTIER erreur_660004669
REGISTRE ENTIER flag_rdt_660004669
REGISTRE ENTIER type_cra_660004669
REGISTRE ENTIER type_erreur_660004669
REGISTRE ENTIER pseudo_DPV_660004669
REGISTRE ENTIER ZBPrefixVal_660004669
REGISTRE ENTIER ZBPrefixLong_660004669
REGISTRE ENTIER ZBPrefixDigitD_660004669
REGISTRE ENTIER ZBPrefixDigitO_660004669
REGISTRE ENTIER ZBPrefixDigitT_660004669
REGISTRE ENTIER RoutingNumberVal_660004669
REGISTRE ENTIER RoutingNumberError_660004669
REGISTRE ENTIER RoutingNumberLong_660004669
REGISTRE ENTIER RoutingNumberTON_660004669
REGISTRE ENTIER RoutingNumberNPI_660004669
REGISTRE ENTIER RoutingNumberCC1_660004669
REGISTRE ENTIER RoutingNumberCC2_660004669
REGISTRE ENTIER RoutingNumberTmpVal_660004669
REGISTRE ENTIER ic_660004669
REGISTRE ENTIER is_roamers_660004669
REGISTRE ENTIER L3t2_660004669
REGISTRE ENTIER pseudo_idpart_410_660004669
REGISTRE ENTIER indice_duptab_660004669
REGISTRE ENTIER origLocNum_present_660004669
REGISTRE ENTIER TON_origLocNum_660004669
REGISTRE ENTIER NPI_origLocNum_660004669
REGISTRE ENTIER tailleChpTrans_660004669
REGISTRE ENTIER calledNumber_present_660004669
REGISTRE ENTIER taille_660004669
REGISTRE ENTIER res_660004669
REGISTRE ENTIER date_660004669
REGISTRE ENTIER date_fin_660004669
REGISTRE ENTIER code_rejet_660004669
REGISTRE ENTIER EFFICACE_660004669
REGISTRE ENTIER MODULE_660004669
REGISTRE ENTIER ERREUR_660004669
REGISTRE ENTIER redirectNB_present_660004669
REGISTRE ENTIER Taille_redirectNb_660004669
REGISTRE ENTIER flag_410_660004669
REGISTRE ENTIER flag_present_660004669
REGISTRE ENTIER PREFIXJoig_660004669
REGISTRE ENTIER Length_calledNumber_660004669
REGISTRE ENTIER Prexf1_660004669
REGISTRE ENTIER Prexf2_660004669
REGISTRE ENTIER Prexf3_660004669
REGISTRE ENTIER Prexf4_660004669
REGISTRE ENTIER FlagInter_660004669
REGISTRE ENTIER FlagNat_660004669
REGISTRE ENTIER indice_660004669
REGISTRE ENTIER long_660004669
REGISTRE POINTEUR pt_PrefixJoing_660004669
REGISTRE POINTEUR pt_calledNumber_660004669
REGISTRE POINTEUR pt_portjoing_660004669
REGISTRE POINTEUR pt_PrefixJoingDCB_660004669
REGISTRE POINTEUR pt_CleRoutingNumberSAC_660004669
REGISTRE POINTEUR pt_CalledNb_660004669
REGISTRE ENTIER position_660004669
REGISTRE ENTIER longueur_660004669
REGISTRE POINTEUR str_exchasciident_660004669
REGISTRE POINTEUR str_exchDCBdent_660004669
REGISTRE ENTIER IMSI_OrangeCo_660004669
REGISTRE POINTEUR pt_conteneur_660004669
REGISTRE POINTEUR pt_IMSI_660004669
REGISTRE POINTEUR pt_MCCMNC_660004669
REGISTRE POINTEUR pt_portabilite_660004669
REGISTRE ENTIER date_cra_660004669
REGISTRE ENTIER date_table_660004669
REGISTRE ENTIER bT3T8ITX_660004669
REGISTRE POINTEUR ptr_valeurDATE_660004669
REGISTRE POINTEUR ptr_date_res_660004669
######################################################################################
# Pcode distribution TcFwd_nss9
#
# Historique :
# 22/01/2008 - PSA - G1R6 - modification du traitement du prefixe Routing Number
# 24/08/2009 - PKH - G2R3 - Correction QC396
# 21/01/2010 - JLG - G2R6 lot3 - 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)
# 13/01/2011 - PSA - G3R2 : ajout champ T3t99
# 10/03/2011 - JLG - G3R2C4 fusion G3R1C600 avec G3R2C3 (ajout champ T3t99)
# 17/03/2011 - PKH - G3R3 lot2 Mapping ABC ajout des champs V3t63 et  V3t64
# 26/04/2011 - PKH - G3R3 lot3 Curling Free
# 03/05/2011 - PKH - QC860 Correction alimentation des champs T3t63 et T3t64 pour le pseudo Ddpvgsm
# 06/09/2011 - JLG - G3R4 QC925 evol champs V3t63, V3t64 suppression des envois vers errones si echec de normalisation
# 16/09/2011 - JLG - G3R4 QC925 pb avec verbe i_retrait_tlv
# 29/02/2012 - JLG - G3R6 QC1005 modif alarme retour aiguillage
# 09/05/2012 - PKH - G3R7 Gestion des codes MNC pour les MVNOs lights
# 26/10/2012 - PKH - G3R8 lot2 Prefix de joignabilite
# 22/11/2012 - PKH - G3R8 lot3  QC1142 Correction enrichir le champ DPV V4t38.1 avec le contenu T3t5/calledNumber sans retirer le prefix de joignabilite
# 17/07/2013 - JLG - G3R10 lot3 QC1232 : DPV FREE V3t9, MSC E// mapping donnee disconnectingParty - Correction V3t1.14/DPV4.0
# 11/02/2014 - JLG - G5R1 QC1331, Built 3 : Changement Marque Audit
# 03/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
# 06/08/2014 - JLG - G5R2 lot2 : Item IntercoIP PrefixeZoneBlanche Modification du prefixe Zone Blanche
# 20/08/2014 - JLG - G5R2 lot2 : Corrections suite  a VerifPcode (pointeurs et entiers)
# 09/10/2014 - JLG - QC1444 correction supplementaire de la QC1292
# 27/10/2014 - JLG - report correction G5R1C8 suite NonReg G5R1C6 (oubli du pseudo pour l evolution idemet) QC1292 correction
######################################################################################
#
#G5R2 lot2
#

#
# Compteurs par ECC
#


#
# Declarations des variables
#











#G3R3 LOT2

#G3R8 Lot2



#QC396
# /QC396

#G3R7 MVNOs lights

#G3R3 Lot3 Curling Free

#G5R1
ptr_valeurDATE_660004669 ="ptr_valeurDATE0123456789"
ptr_date_res_660004669 ="ptr_date_res0123456789"
i_strcpy (ptr_valeurDATE_660004669,"")
i_strcpy (ptr_date_res_660004669,"")

# g_iartin et redistribution
# ==================================
# copie du CRA original dans le g_iartout12
erreur_660004669 = i_dup_art_id(g_iartin, g_iartout12)
#

#
# initialisation des variables
#
redirectNB_present_660004669 = 0
Taille_redirectNb_660004669 = 0
flag_410_660004669 = 0
flag_present_660004669 = 0
PREFIXJoig_660004669 = 0
Length_calledNumber_660004669 = 0
Prexf1_660004669 = 0
Prexf2_660004669 = 0
Prexf3_660004669 = 0
Prexf4_660004669 = 0
FlagInter_660004669 = 0
FlagNat_660004669 = 0
indice_660004669 = 0
long_660004669 = 0

#G5R2 lot2
pt_champ_660004669="pt_champ_1111111111111111111111"
i_strcpy(pt_champ_660004669,"")
pt_prefixe_ZB_660004669=   "pt_prefixe_ZB11111111111111111111"
i_strcpy(pt_prefixe_ZB_660004669, "")

pt_CleRoutingNumberSAC_660004669 = "pt_CleRoutingNumberSAC"
EFFICACE_660004669 = 1
MODULE_660004669 = MODULE_DISTR_660004669
ERREUR_660004669 = 0
code_rejet_660004669 = 0

IMSI_OrangeCo_660004669 = 0
pt_IMSI_660004669 = "pt_IMSI876587658765876587658765876587658765876587658765876587658765"
i_strcpy(pt_IMSI_660004669,"")
pt_MCCMNC_660004669 = "pt_MCCMNC9765976569678987696879675695875657569587565756958756598767"
pt_conteneur_660004669 = "pt_conteneur956795679567956795679567956795679567956795679567956795"
#QC396
str_exchasciident_660004669 = "str_exchasciident19191919191919191919191911991919191919191919"
str_exchDCBdent_660004669 = "str_exchDCBdent2323232323232323232323232323232323232332232332333233"
pt_portabilite_660004669 = "pt_portabilite757575757577557575775755775757577575577557577575757557"

pt_PrefixJoing_660004669 = "pt_PrefixJoing94569456954569599695966"
pt_calledNumber_660004669 = "pt_calledNumber717177171771771771716716767676676676767676767676767676767676"
pt_portjoing_660004669 = "pt_portjoing6364634634664366436463466436643"
pt_PrefixJoingDCB_660004669 = "pt_PrefixJoingDCB945694569456945694569456"
pt_CalledNb_660004669 = "pt_CalledNb737377373737373733773373737373737373737373737373773737373"

position_660004669 = 0
longueur_660004669 = 0

i_strcpy(pt_conteneur_660004669,"")
i_strcpy(pt_CleRoutingNumberSAC_660004669,"")

i_strcpy(pt_PrefixJoing_660004669,"")
i_strcpy(pt_calledNumber_660004669,"")
i_strcpy(pt_portjoing_660004669,"")
i_strcpy(pt_CalledNb_660004669,"")

trace("**** TcFwd_nss9  Module de distribution - debut ****")


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

SI (flag_rdt_660004669 == 0)
ALORS
  erreur_660004669 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004669 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

# /QC396
#  comptabilisation des CRAs issus de la redistribution
date_fin_660004669=i_get_art_field(g_iartin,$TcFwd_nss9::dfin)
erreur_660004669= i_incr_redist_dist_660004265(date_fin_660004669)

erreur_660004669 = i_cree_art("Conv_URS",g_iartout9)

#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_660004669 = i_get_art_field(g_iartin,$TcFwd_nss9::ddebut)

bT3T8ITX_660004669 = 0
date_table_660004669 = 0
SI(i_get_tab_field("VariableContexte",date_cra_660004669,"DATEFIN_ITX") == g_inull)
ALORS
  trace("DATEFIN_ITX Absent de la table VariableContexte -> msgITX present")
  bT3T8ITX_660004669 = 1
SINON
  i_strcpy(ptr_valeurDATE_660004669, i_get_tab_field("VariableContexte", date_cra_660004669, "DATEFIN_ITX"))
  i_get_sub_str(ptr_valeurDATE_660004669,2,-1,ptr_date_res_660004669)
  erreur_660004669 = i_cree_art("Conv_URS", g_iartout7)
  erreur_660004669 = i_set_art_str (g_iartout7,$Conv_URS::DATE,ptr_date_res_660004669)
  date_table_660004669 = i_get_art_field(g_iartout7, $Conv_URS::DATEN)
  trace1(" date_cra   = %d", date_cra_660004669)
  trace1(" date_table = %d", date_table_660004669)
  SI (date_cra_660004669 < date_table_660004669)
  ALORS
    trace("date_cra < date_table -> msgITX present")
    bT3T8ITX_660004669 = 1
  FINSI
FINSI

#
# Creation de l article dans le format pivot
#

# Determination du type de DPV :
# Si le champ Mobile Station Roaming Number est present
#    type = 02 (renvoye par VMSC)
# Sinon
#    type = 06 (renvoye par GMSC)
#

#================================================================#
# Determibation du booleen  IMSI_OrangeCo pour les MVNO ligths   #
#================================================================#
#G3R7 Gestion du code MNC pour les MVNOs Lights

SI (i_valid_field_n(g_iartin, $TcFwd_nss9::IMSI))
ALORS
  erreur_660004669 = i_get_art_str(g_iartin, $TcFwd_nss9::IMSI, pt_IMSI_660004669)
  SI (i_strplcmp (pt_IMSI_660004669,"20801",0,5) == 0)
  ALORS
    IMSI_OrangeCo_660004669 = 1
  SINON
    SI (i_strplcmp(pt_IMSI_660004669,"208",0,3) == 0)
    ALORS
      i_get_sub_str(pt_IMSI_660004669,0,4,pt_MCCMNC_660004669)
      erreur_660004669 = i_format_str2( pt_conteneur_660004669, "%s%s", "L_", pt_MCCMNC_660004669)
      SI (i_get_tab_field("MVNO", date_fin_660004669, pt_conteneur_660004669)) != g_inull
      ALORS
        IMSI_OrangeCo_660004669 = 1
      FINSI
    FINSI
  FINSI
SINON
  IMSI_OrangeCo_660004669 = 0
FINSI

#/G3R7
SI (i_valid_field_n(g_iartin, $TcFwd_nss9::mblStatRnb))
ALORS
  type_cra_660004669 = TYPE_RENVOIM_660004669
# G2R6 lot3 QC534 : IMSI <> 20801 au lieu de <> 208
# Si IMSI  non Orange France ( <> 20801 ), on generera un pseudo DPV
#G3R7 gestion des MVNOs lights
  SI (IMSI_OrangeCo_660004669 == 0)
  ALORS
    pseudo_DPV_660004669 = 1
  FINSI
SINON
  type_cra_660004669 = TYPE_RENVOIG_660004669
FINSI
# /G2R6 lot3


######################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ called Party Number xx 600xxx ZABPQMCDU
# G5R2 lot2 : Item IntercoIP PrefixeZoneBlanche (TON+NPI)[33]<ZBprefix>
# Format de ZBprefix : 600DOT
# Avec :
#   D : le PLMN de destination (OF = 8, SFR = 7, Bytel = 9 )
#   O : le PLMN dorigine (OF = 8, SFR = 7, Bytel = 9 )
#   T : Type of number (National = 4 , International = 1 , Inconnu = 2 ; msrn = 9)
# G5R2 lot2
######################################################################################

Prefix_index_660004669 = -1
erreur_660004669 = 0
ZBPrefixVal_660004669=-1

erreur_660004669 = i_get_art_str(g_iartin, $TcFwd_nss9::calledNumber, pt_champ_660004669)
longueur_660004669=i_strlen(pt_champ_660004669)
SI (longueur_660004669 >= 8)
ALORS
  SI( (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,0)<12)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,1)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,2)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,3)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,4)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,5)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,6)<10)
    && (i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,7)<10) )
  ALORS
    Flag_ZB_660004669 = 0
    SI (i_strplcmp(pt_champ_660004669,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitD_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,7)
      ZBPrefixDigitO_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,8)
      ZBPrefixDigitT_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,9)
      Flag_ZB_660004669 = C_ZB_1133600DOT_660004669
    SINON
      SI (i_strplcmp(pt_champ_660004669,"11",0,2) != 0 && i_strplcmp(pt_champ_660004669,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitD_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,5)
        ZBPrefixDigitO_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,6)
        ZBPrefixDigitT_660004669=i_get_art_fieldtab(g_iartin,$TcFwd_nss9::calledNumber,7)
        Flag_ZB_660004669 = C_ZB_XX600DOT_660004669
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004669 == C_ZB_1133600DOT_660004669 || Flag_ZB_660004669 == C_ZB_XX600DOT_660004669) &&
      ZBPrefixDigitD_660004669 >= 7 && ZBPrefixDigitD_660004669 <= 9 &&
      ZBPrefixDigitO_660004669 >= 7 && ZBPrefixDigitO_660004669 <= 9 &&
      (ZBPrefixDigitT_660004669 == 1 || ZBPrefixDigitT_660004669 == 2 || ZBPrefixDigitT_660004669 == 4 || ZBPrefixDigitT_660004669 == 9) )
    ALORS

      SI (ZBPrefixVal_660004669 == -1)
      ALORS
        ZBPrefixVal_660004669=600*1000 + ZBPrefixDigitD_660004669*100 + ZBPrefixDigitO_660004669*10 + ZBPrefixDigitT_660004669
      FINSI

      SI (Flag_ZB_660004669 == C_ZB_XX600DOT_660004669)
      ALORS
        i_get_sub_str(pt_champ_660004669, 2, 7, pt_prefixe_ZB_660004669)
        ZBPrefixLong_660004669 = i_strlen(pt_prefixe_ZB_660004669)
      SINON
        i_get_sub_str(pt_champ_660004669, 4, 9, pt_prefixe_ZB_660004669)
        ZBPrefixLong_660004669 = i_strlen(pt_prefixe_ZB_660004669) + 2
      FINSI

      Prefix_index_660004669 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP1
      erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, Prefix_index_660004669, 0x0f)
      erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::calledNumber)
      ZBPrefixLong_660004669 = ZBPrefixLong_660004669 - 1
      SI (ZBPrefixLong_660004669 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP1
      FINSI

      # Si T = 4 ou 9 alors forcage du TON+NPI a 41 avant normalisation
      SI (ZBPrefixDigitT_660004669 == 4 || ZBPrefixDigitT_660004669 == 9)
      ALORS
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,0,0x4)
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,1,0x1)
      FINSI
      # Si T = 1 alors forcage du TON+NPI a 11 avant normalisation
      SI (ZBPrefixDigitT_660004669 == 1)
      ALORS
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,0,0x1)
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,1,0x1)
      FINSI
      # Si T = 2 alors forcage du TON+NPI a 21 avant normalisation
      SI (ZBPrefixDigitT_660004669 == 2)
      ALORS
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,0,0x2)
        erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber,1,0x1)
      FINSI
    FINSI

  FINSI
FINSI


#####################################################################
# Traitement d un eventuel prefixe de portabilite
# dans le champ redirecting Number
#####################################################################

RoutingNumberVal_660004669=-1
RoutingNumberError_660004669 = 0
RoutingNumberLong_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::redirectNumber - 1 )
SI (RoutingNumberLong_660004669 >= 8)
ALORS
  RoutingNumberTON_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 0)
  RoutingNumberNPI_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 1)
  SI ((RoutingNumberTON_660004669 == 1) && (RoutingNumberNPI_660004669 == 1))
  ALORS
    RoutingNumberCC1_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2)
    RoutingNumberCC2_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 3)
    SI ((RoutingNumberCC1_660004669 == 3) && (RoutingNumberCC2_660004669 == 3))
    ALORS
      RoutingNumberTmpVal_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4)*1000
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 5)*100
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 6)*10
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004669 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004669)
      erreur_660004669 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004669)
      #G3R3 Lot3 Curling_Free
      i_strcpy(pt_portabilite_660004669,i_get_tab_field(RNSAC_660004669, date_fin_660004669, pt_CleRoutingNumberSAC_660004669))
      SI (i_strcmp(pt_portabilite_660004669,"porta") == 0)
      ALORS
        SI ( RoutingNumberVal_660004669 != -1 )
        ALORS
          RoutingNumberError_660004669 = 1
        SINON
# --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberVal_660004669=RoutingNumberTmpVal_660004669
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004669 == 4) && (RoutingNumberNPI_660004669 == 1))
    ALORS
      RoutingNumberTmpVal_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2)*1000
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 3)*100
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4)*10
      RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004669 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004669)
      erreur_660004669 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004669)
      #G3R3 Lot3 Curling_Free
      i_strcpy(pt_portabilite_660004669,i_get_tab_field(RNSAC_660004669, date_fin_660004669, pt_CleRoutingNumberSAC_660004669))
      SI (i_strcmp(pt_portabilite_660004669,"porta") == 0)
      ALORS
        SI ( RoutingNumberVal_660004669 != -1 )
        ALORS
          RoutingNumberError_660004669 = 1
        SINON
# --- Suppression du prefixe pour 41 RN *
          RoutingNumberVal_660004669=RoutingNumberTmpVal_660004669
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
          erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

# Si IMSI non itineris
#G3R7 Gestion du code MNC pour les MVNOs Lights
SI (IMSI_OrangeCo_660004669 == 0)
ALORS
  is_roamers_660004669 = 1
FINSI

#----------------------------------------------------#
# G3R8Lot2  Traitement du prefix de Joignabilite
# type cra = 0x06 (RENVOIG)   du champ T3t5/calledNumber
#----------------------------------------------------#

SI (type_cra_660004669 == TYPE_RENVOIG_660004669)
ALORS
  Length_calledNumber_660004669  = i_get_art_field(g_iartin, $TcFwd_nss9::calledNumber - 1 )
  erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::calledNumber,pt_calledNumber_660004669)
  Prexf1_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, 0)
  Prexf2_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, 1)
  Prexf3_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, 2)
  Prexf4_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, 3)

  # numero national
  SI ((Prexf1_660004669 == 4 && Prexf2_660004669 == 1) && Length_calledNumber_660004669 > 6)
  ALORS
    FlagNat_660004669 = 1
    i_get_sub_str(pt_calledNumber_660004669, 2, -1, pt_calledNumber_660004669)
    i_get_sub_str(pt_calledNumber_660004669, 0, -10, pt_PrefixJoing_660004669)

  SINON
    SI ((Prexf1_660004669 == 1 && Prexf2_660004669 == 1 && Prexf3_660004669 == 3 && Prexf4_660004669 == 3) && Length_calledNumber_660004669 > 7)
    ALORS
      FlagInter_660004669 = 1
      i_get_sub_str(pt_calledNumber_660004669, 4, -1, pt_calledNumber_660004669)
      i_get_sub_str(pt_calledNumber_660004669, 0, -10, pt_PrefixJoing_660004669)

    FINSI
  FINSI
  i_strcpy(pt_portjoing_660004669,i_get_tab_field(RNSAC_660004669, date_fin_660004669, pt_PrefixJoing_660004669))
  SI (i_strcmp(pt_portjoing_660004669,"joig") == 0)
  ALORS
    PREFIXJoig_660004669 = 1
  FINSI
FINSI

trace1 ("<<__LINE__>> =====================PREFIXjoig= %d =======================",PREFIXJoig_660004669)
trace2 ("<<__LINE__>> ====================pt_PrefixJoing = %s====================",pt_PrefixJoing_660004669,"")

#############################################################
# suppression du prefix de joignabilite avant normalisation
##############################################################

SI (PREFIXJoig_660004669)
ALORS

  erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::calledNumber,pt_CalledNb_660004669)
  SI (FlagInter_660004669)
  ALORS
    #Cas Inter
    long_660004669 = i_strlen(pt_PrefixJoing_660004669)
    indice_660004669 = long_660004669
    trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004669)
    POINT BOUCLE5
    SI (indice_660004669 > 0)
    ALORS
      indice_660004669=indice_660004669 - 1
      erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber, 4, 0x0f)
      erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::calledNumber)
      SAUT BOUCLE5
    FINSI
    erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::calledNumber,pt_calledNumber_660004669)
    trace2 ("<<__LINE__>>=============pt_calledNumber=%s====================", pt_calledNumber_660004669,"")
  FINSI
  SI (FlagNat_660004669)
  ALORS
    #Cas National
    long_660004669 = i_strlen(pt_PrefixJoing_660004669)
    indice_660004669 = long_660004669
    trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004669)
    POINT BOUCLE6
    SI (indice_660004669 > 0)
    ALORS
      indice_660004669=indice_660004669 - 1
      erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::calledNumber:0, 2, 0x0f)
      erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::calledNumber)
      SAUT BOUCLE6
    FINSI
    erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::calledNumber,pt_calledNumber_660004669)
    trace2 ("<<__LINE__>>=============pt_calledNumber=%s====================", pt_calledNumber_660004669,"")
  FINSI
FINSI

#####################################################################
# Creation DPV
# Duplication vers le format pivot
#####################################################################

#
# La taille du champ callingNumber
#

L3t2_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::L3t4)
SI (L3t2_660004669 == 2)
ALORS
  SI ( (i_get_art_fieldtab(g_iartin, $TcFwd_nss9::callingNumber, 0) == 4) &&
    (i_get_art_fieldtab(g_iartin, $TcFwd_nss9::callingNumber, 1) == 1) &&
    (i_get_art_fieldtab(g_iartin, $TcFwd_nss9::callingNumber, 2) == 0) &&
    (i_get_art_fieldtab(g_iartin, $TcFwd_nss9::callingNumber, 3) == 0x0f) )
  ALORS
# Cas Appelant = 0 (on utilise la table de duplication alternative)
    pseudo_idpart_410_660004669 = 1

    SI (is_roamers_660004669)
    ALORS
      ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",5)
      indice_duptab_660004669 = 5
      #G5R1
      # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
      SI (bT3T8ITX_660004669 == 1)
      ALORS
        SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
        ALORS
          erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
          erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
          trace ("Ajout du champ msgITX")
        FINSI
      FINSI
    SINON
      ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",1)
      indice_duptab_660004669 = 1
      #G5R1
      # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
      SI (bT3T8ITX_660004669 == 1)
      ALORS
        SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
        ALORS
          erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
          erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
          trace ("Ajout du champ msgITX")
        FINSI
      FINSI
    FINSI
  SINON
# Cas Normal (on utilise la table de duplication de base)
    SI (is_roamers_660004669)
    ALORS
      ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",4)
      indice_duptab_660004669 = 4
      #G5R1
      # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
      SI (bT3T8ITX_660004669 == 1)
      ALORS
        SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
        ALORS
          erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
          erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
          trace ("Ajout du champ msgITX")
        FINSI
      FINSI
    SINON
      ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",0)
      indice_duptab_660004669 = 0
      #G5R1
      # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
      SI (bT3T8ITX_660004669 == 1)
      ALORS
        SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
        ALORS
          erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
          erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
          trace ("Ajout du champ msgITX")
        FINSI
      FINSI
    FINSI
  FINSI
SINON
  SI (is_roamers_660004669)
  ALORS
# Cas Roamers
    ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",4)
    indice_duptab_660004669 = 4
    #G5R1
    # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
    SI (bT3T8ITX_660004669 == 1)
    ALORS
      SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
      ALORS
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
        erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
        trace ("Ajout du champ msgITX")
      FINSI
    FINSI
  SINON
# Cas Normal (on utilise la table de duplication de base)
    ic_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",0)
    indice_duptab_660004669 = 0
    #G5R1
    # Ajout de T3t8/msgITX si (bT3T8ITX == 1)
    SI (bT3T8ITX_660004669 == 1)
    ALORS
      SI (i_valid_field_n(g_iartin,$TcFwd_nss9::numberOfMrPulse))
      ALORS
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t8","")
        erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $TcFwd_nss9::numberOfMrPulse))
        trace ("Ajout du champ msgITX")
      FINSI
    FINSI
  FINSI
FINSI

trace1("table de duplication : %d", indice_duptab_660004669)
SI (ic_660004669 != 0)
ALORS
  trace("TcFwd_nss9 : Creation DPV impossible => Errone")
  ERREUR_660004669 = ERR_DUPL_660004669
  code_rejet_660004669 = MODULE_660004669 + ERREUR_660004669 + EFFICACE_660004669
  erreur_660004669 = i_PlvMessEmettre(8455,2,g_iartout12,"",2, code_rejet_660004669,"creation DPV",0)
  SAUT STOCKE_ERRONE
FINSI

#
# Mise a jour des champs de l article en format pivot
#

#####################################################################
# Affectation du champ  T3t1.1 (type)
#####################################################################
erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::type, type_cra_660004669)

#####################################################################
# QC1232 evolution champ tterm pour FREE
# Mise a jour du champ T3t1.14 (tterm)
# avec TrCFwd_nss9/disconnectParty
#####################################################################
SI (i_valid_field_n(g_iartin,$TrCFwd_nss9::disconnectParty))
ALORS
  res_660004669 = i_get_art_field(g_iartin, $TrCFwd_nss9::disconnectParty)
  SI (res_660004669 == 0 || res_660004669 == 1)
  ALORS
    erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004669 == 2)
    ALORS
      erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI

#####################################################################
#  champ T3t1.2 (tentite),
#  Type entite emettrice: si type de DPV = 02 (renv reach MSC) => 00
#                        si type de DPV = 06 (renv reach GMSC) => 01
#####################################################################

SI (type_cra_660004669 == TYPE_RENVOIM_660004669)
ALORS
  erreur_660004669 = i_set_art_field(g_iartout,$Tdpvgsm::tentite,00)
SINON
  erreur_660004669 = i_set_art_field(g_iartout,$Tdpvgsm::tentite,01)
FINSI

#####################################################################
#  champ T3t1.12 (origine)
#
#####################################################################

SI (i_valid_field_n(g_iartin,$TcFwd_nss9::intIncomingCall))
ALORS
  SI (i_get_art_field(g_iartin,$TcFwd_nss9::intIncomingCall) == 1)
  ALORS
    erreur_660004669 = i_set_art_field(g_iartout,$Tdpvgsm::origine,1)
  FINSI
FINSI

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciident_660004669,"")
i_strcpy(str_exchDCBdent_660004669,"")
erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::exchasciident,str_exchasciident_660004669)
trace2("################# str_exchasciident = %s ################",str_exchasciident_660004669,"")
position_660004669 = RECHERCHE_CARACTERE_660004265(str_exchasciident_660004669," ")
trace1("############ position= %d ###########",position_660004669)
SI ( position_660004669 > -1)
ALORS
  i_get_sub_str (str_exchasciident_660004669, 0, position_660004669 - 1 ,str_exchasciident_660004669)
  trace2("################# str_exchasciident = %s ################",str_exchasciident_660004669,"")
FINSI
longueur_660004669 = i_conv_ascii_dcb (str_exchasciident_660004669,str_exchDCBdent_660004669 )
SI (longueur_660004669 > 9)
ALORS
	longueur_660004669 = 9
FINSI
erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBdent_660004669, longueur_660004669)

# Fin QC396
#####################################################################
#  champ T3t6 (portOrigNet)
#
#####################################################################

# --- On verifie que le champ origLocNumber est present
origLocNum_present_660004669 = i_valid_field_n(g_iartin, $TcFwd_nss9::origLocNumber)
SI (origLocNum_present_660004669)
ALORS
  SI (i_get_art_field(g_iartin, $TcFwd_nss9::origLocNumber-1) == 0)
  ALORS
    origLocNum_present_660004669 = 0
  FINSI
FINSI

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004669)
ALORS
#
# on prend la taille du champ que l on divise par 8 car la taille de "origLocNumber" est donnee en "bit"
#
  taille_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::origLocNumber-1)
  SI (taille_660004669 >= 2)
  ALORS
    TON_origLocNum_660004669 = i_get_art_fieldtab(g_iartin, $TcFwd_nss9::origLocNumber, 0)
    NPI_origLocNum_660004669 = i_get_art_fieldtab(g_iartin, $TcFwd_nss9::origLocNumber, 1)

# --- portOrigNet sera absent du DPV si en entree le champ
# --- origLocNumber a un TON NPI different de 41 (E///) ou A1 (alcatel)
    SI ( (TON_origLocNum_660004669 == 4) && (NPI_origLocNum_660004669 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004669 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::origLocNumber,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004669 != 0 )
      ALORS
        trace("Erreur duplication champ portOrigNet")
        type_erreur_660004669 = CODE_ERREUR_DUPLICATION
        ERREUR_660004669 = ERR_DUPL_660004669
        code_rejet_660004669 = MODULE_660004669 + ERREUR_660004669 + EFFICACE_660004669
        erreur_660004669 = i_PlvMessEmettre(8456,2,g_iartout12,"",2, code_rejet_660004669,"portOrigNet",0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement des champs transporteurs sortant et entrants
#  champs T3t16 (TrSortant) et T3t17 (TrEntrant)
#####################################################################

#
# ---- Duplication du champ transporteur Sortant
#

tailleChpTrans_660004669=i_get_art_field(g_iartin,($TcFwd_nss9::outgoingRoute-1))

SI    ((tailleChpTrans_660004669 <= 7 )
  && (i_valid_field_n(g_iartin,$TcFwd_nss9::outgoingRoute)))
ALORS
  erreur_660004669 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004669 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004669)
  erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, g_iartin.outgoingRoute[], tailleChpTrans_660004669)
SINON
  SI (i_valid_field_n(g_iartin,$TcFwd_nss9::incomingRoute))
  ALORS
    erreur_660004669 = i_ajout_tlv(g_iartout, "T3t16", "")
    erreur_660004669 = i_resize_tlv(g_iartout,"T3t16","TrSortant",7)
    erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, g_iartin.incomingRoute[], 7)
  FINSI
FINSI

#
# ---- Duplication du champ transporteur Entrant
#

tailleChpTrans_660004669 = i_get_art_field(g_iartin,($TcFwd_nss9::incomingRoute-1))

SI    ((tailleChpTrans_660004669 <= 7 )
  && (i_valid_field_n(g_iartin,$TcFwd_nss9::incomingRoute)))
ALORS
  erreur_660004669 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004669 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004669)
  erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoute[], tailleChpTrans_660004669)
SINON
  SI (i_valid_field_n(g_iartin,$TcFwd_nss9::incomingRoute))
  ALORS
    erreur_660004669 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004669 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",7)
    erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoute[], 7)
  FINSI
FINSI

#####################################################################
# Mise a jour  date d entree dans le CE  +  EEC
# champs T4t30.1 (timeInCE) et  T4t30.2 (eec)
#####################################################################
# QC1331
#erreur=set_timeInCE_EEC(0)
########### Date_Audit
erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#####################################################################
# calcul prevalorisation et affectation des valeurs nbum et nbut au DPV
#  champs T3t1.16 (nbUT) et T3t1.15 (indtax)
#####################################################################
erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0x01)

#############################
# appel preval TcFwd_nss9
#############################

res_660004669 = preval_ut_660004265(g_iartout)

SI (res_660004669 == -1 )
ALORS
  ERREUR_660004669 = ERR_VALO_660004669
  code_rejet_660004669 = MODULE_660004669 + ERREUR_660004669 + EFFICACE_660004669
  erreur_660004669 = i_PlvMessEmettre(8458,0 , g_iartout12, "" , 1, code_rejet_660004669, 0, 0 )
  trace("Fin traitement: erreur prevalorisation")
  SAUT STOCKE_ERRONE
SINON
  SI (res_660004669 == -2 )
  ALORS
    trace("pas de prevalorisation : retour preval == -2")
  SINON
    trace1("Prevalorisation OK avec valeur : %d", res_660004669)
    erreur_660004669 = i_set_art_field(g_iartout,$Tdpvgsm::nbUT, res_660004669)
  FINSI
FINSI
#################
# /appel preval
#################

# Maj de la valeur du champ indtax a 0xff apres le calcul
# de prevalorisation
#
erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0xff)

#####################################################################
# Mise a jour du T3 portability prefix
#####################################################################

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

#####################################################################
# Traitement d un eventuel prefixe Zone Blanche
# dans le champ called Party Number
#####################################################################

# ########################################
#   CAS TLV 3.3 : Ajout du champs T3t34
# ########################################
SI (ZBPrefixVal_660004669 != -1)
ALORS
  erreur_660004669 = i_ajout_tlv(g_iartout,"T3t34","")
  erreur_660004669 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitD_660004669)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitO_660004669)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitT_660004669)
FINSI

###################################################################
# Ajout du champ T4t38.1 origCallpartId
###################################################################

calledNumber_present_660004669 = i_valid_field_n(g_iartin,$TcFwd_nss9::calledNumber)
SI ((calledNumber_present_660004669) && PREFIXJoig_660004669 == 0)
ALORS
  erreur_660004669 = i_cree_art("TnormalHAscii", g_iartout4)
  erreur_660004669 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
  erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout4, $TcFwd_nss9::calledNumber, $TnormalHAscii::buf, -$NORM:IDENT2,0)

  res_660004669 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
  erreur_660004669 = i_ajout_tlv(g_iartout,"T4t38.1","")
  erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004669)
  erreur_660004669 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004669)
SINON
#G3R8 lot2 cas ou le prefix de joignabilite est present
  SI ((calledNumber_present_660004669) && (PREFIXJoig_660004669 == 1))
  ALORS
    trace ("<<__LINE__>>=========== 2======================")
    res_660004669 = i_strlen(pt_CalledNb_660004669)
    erreur_660004669 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, pt_CalledNb_660004669, res_660004669)
    erreur_660004669 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004669)
  FINSI
FINSI

###################################################################
# Ajout du champ V4t38.3 equipmentType
###################################################################

# deplacer dans la table de duplication : fait
erreur_660004669 = i_ajout_tlv(g_iartout,"T4t38.3","")
erreur_660004669 = i_resize_tlv(g_iartout,"T4t38.3","equipmentType",1)
erreur_660004669 = i_set_art_field(g_iartout,$Tdpvgsm::equipmentType,0x00)

###################################################################
# calcul temporaire du champ DATE a cause du 2VAL inoperant
###################################################################
date_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::ddebut)
erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004669)

#######################################################
#G3R3 LOT2 mapping ABC ajout du champ T3t63 LastCallingNb
#######################################################

redirectNB_present_660004669 = i_valid_field_n(g_iartin,$TcFwd_nss9::redirectNumber)
Taille_redirectNb_660004669 = i_get_art_field(g_iartin,($TcFwd_nss9::redirectNumber-1))
SI (redirectNB_present_660004669 && Taille_redirectNb_660004669 != 0)
ALORS
  erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
  SI (is_roamers_660004669)
  ALORS
    erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
    #QC925
    SI ( erreur_660004669 != 0)
    ALORS
      trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
    FINSI
  SINON
    erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW,0)
    #QC925
    SI ( erreur_660004669 != 0)
    ALORS
      trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
    FINSI

  FINSI
SINON
  SI (i_valid_field_n(g_iartin,$TcFwd_nss9::callingNumber))
  ALORS
    erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
    SI (pseudo_idpart_410_660004669)
    ALORS
      erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_410,0)
      #QC925
      SI ( erreur_660004669 != 0)
      ALORS
        trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      FINSI
    SINON
      SI (is_roamers_660004669)
      ALORS
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
        #QC925
        SI ( erreur_660004669 != 0)
        ALORS
          trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI
      SINON
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW_2242,0)
        #QC925
        SI ( erreur_660004669 != 0)
        ALORS
          trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI

      FINSI
    FINSI
  FINSI
FINSI

######################################################
#G3R3 LOT2 mapping ABC ajout du  champ T3t64  tab_dup 0 et 4> : QC925
#######################################################

#/G3R3 LOT2 ajout du champ T3t63

#####################################################################
# Stockage
#####################################################################
#
# Distribution proprement dite (aiguillage2 et mise au format)
#

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

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

#G3R8 lot2 prefix de joignabilite ajout champ T3t70
SI (PREFIXJoig_660004669)
ALORS
  trace2 ("<<__LINE__>> ============ pt_PrefixJoing = %s cra 06 prefix de joignabilite detecte =====", pt_PrefixJoing_660004669,"")
  erreur_660004669 = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004669 = i_conv_ascii_dcb (pt_PrefixJoing_660004669, pt_PrefixJoingDCB_660004669)
  erreur_660004669 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004669, longueur_660004669)
  trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur_660004669)
  erreur_660004669 = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004669 * 8)
FINSI

#/G3R8lot2

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

erreur_660004669 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004669, Multidistribution_Non_660004669)

# QC1005
SI (erreur_660004669 == TRAI_KO_660004669)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
  SAUT STOCKE_ERRONE
FINSI

#####################################################################
# Creation du pseudo DPV
#####################################################################
SI pseudo_DPV_660004669
ALORS

#           ####################################################################
#             Traitement d un eventuel prefixe de portabilite
#             dans le champ CF.redirectingNumber
#           ####################################################################

  RoutingNumberError_660004669 = 0
  RoutingNumberLong_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::redirectNumber - 1 )
  SI (RoutingNumberLong_660004669 >= 8)
  ALORS
    RoutingNumberTON_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 0)
    RoutingNumberNPI_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 1)
    SI ((RoutingNumberTON_660004669 == 1) && (RoutingNumberNPI_660004669 == 1))
    ALORS
      RoutingNumberCC1_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2)
      RoutingNumberCC2_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 3)
      SI ((RoutingNumberCC1_660004669 == 3) && (RoutingNumberCC2_660004669 == 3))
      ALORS
        RoutingNumberTmpVal_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4)*1000
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 5)*100
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 6)*10
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 7)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004669 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004669)
        erreur_660004669 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004669)
        # Fin G1R6
        SI (i_get_tab_field(RNSAC_660004669, date_fin_660004669, pt_CleRoutingNumberSAC_660004669)!= g_inull)
        ALORS
          SI ( RoutingNumberVal_660004669 != -1 )
          ALORS
            RoutingNumberError_660004669 = 1
          SINON
# --- Suppression du prefixe pour 11 33 RN *
            RoutingNumberVal_660004669=RoutingNumberTmpVal_660004669
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          FINSI
        FINSI
      FINSI
    SINON
      SI ((RoutingNumberTON_660004669 == 4) && (RoutingNumberNPI_660004669 == 1))
      ALORS
        RoutingNumberTmpVal_660004669=i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2)*1000
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 3)*100
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 4)*10
        RoutingNumberTmpVal_660004669=RoutingNumberTmpVal_660004669+i_get_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 5)
        # Debut G1R6 : appel table externe pour determiner le RN
        erreur_660004669 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004669)
        erreur_660004669 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004669)
        # Fin G1R6
        SI (i_get_tab_field(RNSAC_660004669, date_fin_660004669, pt_CleRoutingNumberSAC_660004669)!= g_inull)
        ALORS
          SI ( RoutingNumberVal_660004669 != -1 )
          ALORS
            RoutingNumberError_660004669 = 1
          SINON
# --- Suppression du prefixe pour 41 RN *
            RoutingNumberVal_660004669=RoutingNumberTmpVal_660004669
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
            erreur_660004669 = i_set_art_fieldtab(g_iartin, $TcFwd_nss9::redirectNumber, 2, 0x0f)
            erreur_660004669 = i_skip_f_in_field_n(g_iartin, $TcFwd_nss9::redirectNumber)
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI

  SI (pseudo_idpart_410_660004669 == 1)
  ALORS
#   Duplication en pseudo DPV en utilisant la table de duplication d indice 3
    erreur_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 3)
    indice_duptab_660004669 = 3
    #G5R1
    # Pas d'ajout de T3t8/msgITX
  SINON
#   Duplication en pseudo DPV en utilisant la table de duplication d indice 2
    erreur_660004669 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 2)
    indice_duptab_660004669 = 2
    #G5R1
    # Pas d'ajout de T3t8/msgITX
  FINSI

  SI (erreur_660004669 != 0)
  ALORS
    type_erreur_660004669 = CODE_ERREUR_DUPLICATION
    trace("TcFwd_nss9 : Creation Pseudo_DPV impossible => rejet Errone")
    ERREUR_660004669 = ERR_DUPL_660004669
    code_rejet_660004669 = MODULE_660004669 + ERREUR_660004669 + EFFICACE_660004669
    erreur_660004669 = i_PlvMessEmettre(8455,2,g_iartout12,"",2, code_rejet_660004669,"pseudo_DPV",0)
    SAUT STOCKE_ERRONE
  FINSI

# tterm toujours = 0xFF

#####################################################################
#
#              Mise a jour des champs du pseudo DPV
#
#####################################################################

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

#####################################################################
#             Mise a jour du T3 portability prefix (T3t12)
#####################################################################

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

#####################################################################
# Traitement du champ portOrigNet (T3t6)
#
#####################################################################

# --- On verifie que le champ origLocNumber est present
  origLocNum_present_660004669 = i_valid_field_n(g_iartin, $TcFwd_nss9::origLocNumber)
  SI (origLocNum_present_660004669)
  ALORS
    SI (i_get_art_field(g_iartin, $TcFwd_nss9::origLocNumber-1) == 0)
    ALORS
      origLocNum_present_660004669 = 0
    FINSI
  FINSI

# --- Si le champ est absent le T3t6 du DPV sera absent
  SI (origLocNum_present_660004669)
  ALORS
#
# on prend la taille du champ que l on divise par 8 car la taille de "origLocNumber" est donnee en "bit"
#
    taille_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::origLocNumber-1)
    SI (taille_660004669 >= 2)
    ALORS
      TON_origLocNum_660004669 = i_get_art_fieldtab(g_iartin, $TcFwd_nss9::origLocNumber, 0)
      NPI_origLocNum_660004669 = i_get_art_fieldtab(g_iartin, $TcFwd_nss9::origLocNumber, 1)

# --- portOrigNet sera absent du DPV si en entree le champ
# --- origLocNumber a un TON NPI different de 41 (E///) ou A1 (alcatel)
      SI ( (TON_origLocNum_660004669 == 4) && (NPI_origLocNum_660004669 == 1) )
      ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t6","")
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::origLocNumber,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
        SI ( erreur_660004669 != 0 )
        ALORS
          trace("Erreur duplication champ portOrigNet")
          type_erreur_660004669 = CODE_ERREUR_DUPLICATION
          ERREUR_660004669 = ERR_NORM_660004669
          code_rejet_660004669 = MODULE_660004669 + ERREUR_660004669 + EFFICACE_660004669
          erreur_660004669 = i_PlvMessEmettre(8456,2,g_iartout12,"",2, code_rejet_660004669,"portOrigNet",0)
          SAUT STOCKE_ERRONE
        FINSI
      FINSI
    FINSI
  FINSI

#####################################################################
#         Mise a jour champ localisation
#         On renseigne <local> a 2080100000000f en validant tout a zero
#         et en renseignant les quartets non nuls (2,8,1 et f)
#####################################################################

  erreur_660004669 = i_memset_field_n(g_iartout,$Tdpvgsm::local,0x00)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 0,0x02)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 2,0x08)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 4,0x01)
  erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,13,0x0f)

#####################################################################
#            Traitement du champ transporteur entrant
#####################################################################

#
# ---- Duplication du champ transporteur Entrant
#

  tailleChpTrans_660004669 = i_get_art_field(g_iartin,($TcFwd_nss9::incomingRoute-1))

  SI    ((tailleChpTrans_660004669 <= 7 )
    && (i_valid_field_n(g_iartin,$TcFwd_nss9::incomingRoute)))
  ALORS
    erreur_660004669 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004669 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004669)
    erreur_660004669 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::TrEntrant,g_iartin.incomingRoute[],tailleChpTrans_660004669)
  SINON
    SI (i_valid_field_n(g_iartin,$TcFwd_nss9::incomingRoute))
    ALORS
      erreur_660004669 = i_ajout_tlv(g_iartout, "T3t17", "")
      erreur_660004669 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",7)
      erreur_660004669 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::TrEntrant,g_iartin.incomingRoute[],7)
    FINSI
  FINSI

#####################################################################
# Traitement d un eventuel prefixe Zone Blanche
# dans le champ called Party Number
#####################################################################

# ########################################
#   CAS DPV 3.2 : Ajout du champs T3t34
# ########################################
  SI (ZBPrefixVal_660004669 != -1)
  ALORS
    erreur_660004669 = i_ajout_tlv(g_iartout,"T3t34","")
    erreur_660004669 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitD_660004669)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitO_660004669)
    erreur_660004669 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitT_660004669)
  FINSI

###################################################################
# Ajout du champ T4t38.1 origCallpartId
###################################################################

  calledNumber_present_660004669 = i_valid_field_n(g_iartin,$TcFwd_nss9::calledNumber)
  SI (calledNumber_present_660004669)
  ALORS
    erreur_660004669 = i_cree_art("TnormalHAscii", g_iartout5)
    erreur_660004669 = i_ajout_tlv(g_iartout5, "T3t1", "buf")
    erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout5, $TcFwd_nss9::calledNumber, $TnormalHAscii::buf, -$NORM:IDENT2,0)

    res_660004669 = i_get_art_field(g_iartout5, $TnormalHAscii::buf -1)
    erreur_660004669 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout5.buf[], res_660004669)
    erreur_660004669 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004669)
  FINSI

###################################################################
# Ajout du champ V4t38.3 equipmentType
###################################################################

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

###################################################################
# calcul temporaire du champ DATE a cause du 2VAL inoperant
###################################################################
  date_660004669 = i_get_art_field(g_iartin, $TcFwd_nss9::ddebut)
  erreur_660004669 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004669)

################
# distribution :

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

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

#*******************************************
#G3R3 LOT2 ajout des champs T3t63 et T3t64 dans le pseudo DPV
#*******************************************

#QC860 deplacement de la partie ajout des champs T3t63 et T3t64 dans le pseudo DPV
#avant appel de la fct aiguillage2

  redirectNB_present_660004669 = i_valid_field_n(g_iartin,$TcFwd_nss9::redirectNumber)
  Taille_redirectNb_660004669 = i_get_art_field(g_iartin,($TcFwd_nss9::redirectNumber-1))
  SI (redirectNB_present_660004669 && Taille_redirectNb_660004669 != 0)
  ALORS
    flag_present_660004669 = 1
  FINSI

#T3t63
  SI (flag_present_660004669)
  ALORS
    SI (is_roamers_660004669)
    ALORS
      erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
      erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
      #QC925
      SI ( erreur_660004669 != 0)
      ALORS
        trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      FINSI
    SINON

      #G3R7 gestion des MVNOs light normalisation V3T63 avec MET_ASN1_NEW
      SI (IMSI_OrangeCo_660004669 == 1)
      ALORS
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW,0)
        #QC925
        SI ( erreur_660004669 != 0)
        ALORS
          trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI
      FINSI
    FINSI
  SINON

# controle sur la longueur du champ T3t4 callingNumber calcule plus haut
    SI (L3t2_660004669 == 2 && flag_410_660004669 == 1)
    ALORS
      erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
      erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_410,0)
      #QC925
      SI ( erreur_660004669 != 0)
      ALORS
        trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      FINSI
    SINON
      SI (is_roamers_660004669)
      ALORS
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
        #QC925
        SI ( erreur_660004669 != 0)
        ALORS
          trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI
      SINON
        #G3R7 Gestion des MVNOs Light normalisation V3t63 avec MET_ASN1_NEW_2242
        SI (IMSI_OrangeCo_660004669 == 1)
        ALORS
          erreur_660004669 = i_ajout_tlv(g_iartout,"T3t63","")
          erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::callingNumber, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW_2242,0)
          #QC925
          SI ( erreur_660004669 != 0)
          ALORS
            trace("TcFwd_nss9: Erreur de duplication du champ callingNumber")
            #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
#T3t64
  SI (flag_present_660004669)
  ALORS
    SI (is_roamers_660004669)
    ALORS
      erreur_660004669 = i_ajout_tlv(g_iartout,"T3t64","")
      erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::RedirectingNb, -$NORM:ROAMERS2,0)
      #QC925
      SI ( erreur_660004669 != 0)
      ALORS
        trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
        #erreur = i_retrait_tlv(g_iartout, "T3t64", "")
      FINSI
    SINON
      #G3R7 gestion des MVNOs light normalisation V3T63 avec MET_ASN1_NEW
      SI (IMSI_OrangeCo_660004669 == 1)
      ALORS
        erreur_660004669 = i_ajout_tlv(g_iartout,"T3t64","")
        erreur_660004669 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TcFwd_nss9::redirectNumber, $Tdpvgsm::RedirectingNb, -$NORM:MET_ASN1_NEW,0)
        #QC925
        SI ( erreur_660004669 != 0)
        ALORS
          trace("TcFwd_nss9: Erreur de duplication du champ redirectNumber")
          #erreur = i_retrait_tlv(g_iartout, "T3t64", "")
        FINSI
      FINSI
    FINSI
  FINSI

#/G3R3 LOT2 ajout des champs T3t63 et T3t64 dans le pseudo DPV

  ##################################################################
  # QC396, QC1292 NonReg G5R1C6
  # T3t1.3 idemet du pseudo
  ##################################################################
  # QC1292
  i_strcpy(str_exchasciident_660004669,"")
  i_strcpy(str_exchDCBdent_660004669,"")
  erreur_660004669 = i_get_art_str(g_iartin,$TcFwd_nss9::exchasciident,str_exchasciident_660004669)
  trace2("################# str_exchasciident = %s ################",str_exchasciident_660004669,"")
  position_660004669 = RECHERCHE_CARACTERE_660004265(str_exchasciident_660004669," ")
  trace1("############ position= %d ###########",position_660004669)
  SI ( position_660004669 > -1)
  ALORS
    i_get_sub_str (str_exchasciident_660004669, 0, position_660004669 - 1 ,str_exchasciident_660004669)
    trace2("################# str_exchasciident = %s ################",str_exchasciident_660004669,"")
  FINSI
  longueur_660004669 = i_conv_ascii_dcb (str_exchasciident_660004669,str_exchDCBdent_660004669 )
  SI (longueur_660004669 > 9)
  ALORS
  	longueur_660004669 = 9
  FINSI
  erreur_660004669 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBdent_660004669, longueur_660004669)
  ############## idemet du pseudo ###########################

  erreur_660004669 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004669, Multidistribution_Oui_660004669)
# QC1005
  SI (erreur_660004669 == TRAI_KO_660004669)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
    SAUT STOCKE_ERRONE
  FINSI

FINSI
# ======== FIN DU TRAITEMENT PSEUDO DPV =======================================

trace("[Dist]**** TcFwd_nss9 : Fin creation article dans le format pivot OK")
RETOUR TRAIT_OK

#
# stockage des errones
#
POINT STOCKE_ERRONE
erreur_660004669 = i_make_art_rej(g_iartout12, g_iartout11, code_rejet_660004669)
erreur_660004669 = i_stocke_art(g_iartout11,0,PT_ERRONE,0)
RETOUR TRAIT_OK
#--------------------------------------------------- TcFwd_nss9_dis.src ---------------------------------------------------
