DEFINITION C_ZB_1133600DOT_660004665 1
DEFINITION C_ZB_XX600DOT_660004665 2
DEFINITION PREFIX_ZB_660004665 1
DEFINITION PREFIX_ITIN_660004665 2
DEFINITION PREFIX_PORTA_660004665 3
DEFINITION PREFIX_SVA_660004665 4
DEFINITION PREFIX_ITI_660004665 5
DEFINITION PREFIX_OMOF_660004665 6
DEFINITION PREFIX_JOIG_660004665 7
DEFINITION C_DUP_TAB_NORMITINERIS_660004665 0
DEFINITION C_DUP_TAB_NORMROAMERS_660004665 1
DEFINITION Multidistribution_Non_660004665 0
DEFINITION DISTRIBUTION_INCONNU_660004665 1
DEFINITION TRAI_KO_660004665 -1
DEFINITION MODULE_DISTR_660004665 0xA000
DEFINITION ERR_NORM_660004665 0x010
DEFINITION ERR_VALO_660004665 0x020
DEFINITION ERR_DUPL_660004665 0x0D0
DEFINITION ERR_DISTR_660004665 0x110
DEFINITION RNSAC_660004665 "RoutinNumberSac"
REGISTRE ENTIER Flag_ZB_660004665
REGISTRE ENTIER erreur_660004665
REGISTRE ENTIER flag_rdt_660004665
REGISTRE ENTIER tailleChpTrans_660004665
REGISTRE ENTIER tailleOrigLocNumber_660004665
REGISTRE ENTIER ic_660004665
REGISTRE ENTIER indice_duptab_660004665
REGISTRE ENTIER TON_660004665
REGISTRE ENTIER NPI_660004665
REGISTRE ENTIER calledNumber_present_660004665
REGISTRE ENTIER digit1_IMSI_660004665
REGISTRE ENTIER digit2_IMSI_660004665
REGISTRE ENTIER digit3_IMSI_660004665
REGISTRE ENTIER digit4_IMSI_660004665
REGISTRE ENTIER digit5_IMSI_660004665
REGISTRE ENTIER origCalledNum_present_660004665
REGISTRE ENTIER redirectNumber_present_660004665
REGISTRE ENTIER indice_champ_valo_660004665
REGISTRE ENTIER TON_origLocNum_660004665
REGISTRE ENTIER NPI_origLocNum_660004665
REGISTRE ENTIER origLocNum_present_660004665
REGISTRE ENTIER ZBPrefixDigitD_660004665
REGISTRE ENTIER ZBPrefixDigitO_660004665
REGISTRE ENTIER ZBPrefixDigitT_660004665
REGISTRE ENTIER date_pivot_660004665
REGISTRE ENTIER date_fin_660004665
REGISTRE POINTEUR pt_valo3_660004665
REGISTRE ENTIER res_660004665
REGISTRE ENTIER date_660004665
REGISTRE ENTIER code_rejet_660004665
REGISTRE ENTIER EFFICACE_660004665
REGISTRE ENTIER MODULE_660004665
REGISTRE ENTIER ERREUR_660004665
REGISTRE ENTIER IMSI_OrangeCo_660004665
REGISTRE ENTIER position_660004665
REGISTRE ENTIER longueur_660004665
REGISTRE POINTEUR str_exchasciident_660004665
REGISTRE POINTEUR str_exchDCBdent_660004665
REGISTRE POINTEUR str_IMSI_660004665
REGISTRE POINTEUR str_MNC_660004665
REGISTRE POINTEUR str_conteneur_660004665
REGISTRE ENTIER indice_champ_660004665
REGISTRE ENTIER flag_pref_660004665
REGISTRE ENTIER Prefix_calledNumber_660004665
REGISTRE POINTEUR pt_champ_660004665
REGISTRE POINTEUR pt_prefixe_ZB_660004665
REGISTRE POINTEUR pt_prefixe_PORTA_660004665
REGISTRE POINTEUR pt_prefixe_SVA_660004665
REGISTRE POINTEUR pt_prefixe_DCB_660004665
REGISTRE ENTIER Prefix_index_660004665
REGISTRE POINTEUR pt_cle_660004665
REGISTRE POINTEUR pt_RetourTable_660004665
REGISTRE POINTEUR pt_ZB_DCB_660004665
REGISTRE ENTIER TypePrefixe_660004665
######################################################################################
# Pcode distribution TrCFwd_nss9
#
# Historique :
# 22/01/2008 - PSA - G1R6 - modification du traitement du prefixe Routing Number
# 02/04/2008 - PKH - G1R6 lot4 - Alimentation du champ GDCB (Zone blanche sortante)
# 24/04/2008 - PKH - G1R4 lot4 - FO 671 pointeur mal declare
# 22/04/2009 - DRE - G2R2 Correctif fiab. CRA ZB E/// spec : CRA_TrCFwd_nss9_A11.1.doc et IntroMobile_A26.2.doc
# 11/05/2009 - DRE - G2R2 QC 387 Correctif fiab. CRA ZB E
# 24/08/2009 - PKH - G2R3 Correction QC396
# 22/02/2010 - JLG - QC564 : Evolution pour les types 04 pour la crise 18
# 11/06/2010 - JLG - G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2,
#                                     ajout champ T3t55 (GFlag2) et T3t56 (GValue)
# 25/08/2010 - JLG - G3R1 lot3 item : Modification alimentation Zb_sortant V3t57 avec evolution de table RoutinNumberSac
# 06/12/2010 - BEA - G3R1 lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 14/03/2011 - JLG - G3R2C4 fusion G3R2C3 avec G3R1C600 (ajout champ T3t99)
# 25/03/2011 - PKH - G3R3 : G3R3 lot2 mapping ABC ajout champ T3t63 et T3t64 au Dpvgsm
# 26/04/2011 - PKH - G3R3 lot3 Curling Free
# 08/07/2011 - PKH - G3R4 lot1 Prefixe pour cra 0x04
# 10/08/2011 - PKH - G3R4 QC910 libelle V3t70 PrefixeSVA au lieu de PrefixeSAV
# 02/09/2011 - JLG - G3R4 QC925 evol champs V3t63, V3t64 suppression des envois vers errones si echec de normalisation
# 06/09/2011 - JLG - G3R4 QC927 evol champs V3t70
# 16/09/2011 - JLG - G3R4 QC925 pb avec verbe i_retrait_tlv
# 28/09/2011 - JLG - G3R4 QC946 retrait systematique du prefixe SVA ou Porta des numeros
# 02/11/2011 - JLG - G3R4 QC957 [ V3t63 TrCFWD ] modification du mapping du champ V3t63
# 29/02/2012 - JLG - G3R6 QC1005 modif alarme retour aiguillage
# 16/05/2012 - PKH - G3R7  item Gestion du code MNC pour les MVNOs Lights
# 24/05/2013 - JLG - G3R10 lot2 : Modification prefixe RNSAC, ZB
# 15/07/2013 - JLG - G3R10 QC1244 V3t57 variable a initialiser
# 17/07/2013 - JLG - G3R10 lot3 QC1232 : DPV FREE V3t9, MSC E// mapping donnee disconnectingParty - Correction V3t1.14/DPV4.0
# 21/08/2013 - JLG - G3R10 lot3 QC1266
# 11/02/2014 - JLG - G5R1 QC1331, Built 3 : Changement Marque Audit
# 02/07/2014 - JLG - G5R1 QC1405, champ eec du DPV si g_ieec > 500
# 06/08/2014 - JLG - G5R2 lot2 : Item IntercoIP PrefixeZoneBlanche Modification du prefixe Zone Blanche
# 18/09/2014 - RHE - G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242 
# 09/10/2014 - JLG - QC1444 correction supplementaire de la QC1292
######################################################################################

#G5R2 lot2


#G3R10
#\G3R10





#declaration des variables locales


#QC396
# /QC396

#G3R7

#G3R10
#
#/G3R10

#----------------------------------------------------------------
#                    MODULE DE DISTRIBUTION
# Appel Entrant Reachemines MET NSS9: Roaming Call Forwarding
#-----------------------------------------------------------------

#-- initialisation
pt_cle_660004665 = "pt_cle_0000000000000000"
pt_valo3_660004665="01"
pt_RetourTable_660004665 = "pt_cleZBsortanteRES676767676567676767676767676ZBsortant_"
pt_ZB_DCB_660004665 = "pt_ZBbuffer6666666666666666666666666666666666666666"
#QC396
str_exchasciident_660004665 = "str_exchasciident19191919191919191919191911991919191919191919"
str_exchDCBdent_660004665 = "str_exchasciident232323232323232323232323232323232323233223233"
position_660004665 = 0
longueur_660004665 = 0
# /QC396

#G3R7
str_conteneur_660004665 = "str_conteneur47747474474747474747474747474744747474747474747474744747"
str_IMSI_660004665 = "str_IMSI3636363636633636363636363636363636636363633636363636363636363636363"
str_MNC_660004665 = "str_MNC186186186186186718671818178161861816181618116811681161816181671816181"

# G3R10
pt_champ_660004665="pt_champ_1111111111111111111111"
pt_prefixe_ZB_660004665=   "pt_prefixe_ZB11111111111111111111"
pt_prefixe_PORTA_660004665="pt_prefixe_PORTA11111111111111111"
pt_prefixe_SVA_660004665=  "pt_prefixe_SVA1111111111111111111"
i_strcpy(pt_prefixe_ZB_660004665, "")
i_strcpy(pt_prefixe_PORTA_660004665, "")
i_strcpy(pt_prefixe_SVA_660004665, "")
pt_prefixe_DCB_660004665 = "pt_RNSAC_DCB_111111111"

i_strcpy(pt_RetourTable_660004665,"")
i_strcpy(pt_valo3_660004665,"")
i_strcpy(pt_cle_660004665,"")
i_strcpy(pt_ZB_DCB_660004665,"")

i_strcpy(str_conteneur_660004665,"")
i_strcpy(str_IMSI_660004665,"")
i_strcpy(str_MNC_660004665,"")

#G3R10
i_strcpy(pt_champ_660004665,"")

EFFICACE_660004665 = 1
MODULE_660004665 = MODULE_DISTR_660004665
ERREUR_660004665 = 0
code_rejet_660004665 = 0
IMSI_OrangeCo_660004665 = 0

#G3R10
#flag_pref = 0
Prefix_calledNumber_660004665 = 0
indice_champ_660004665 = -1

TypePrefixe_660004665=0

#---------------- Debut des traitements TrCFwd_nss9 --------------
trace("")
trace("**** [ DISTR ]TrCFwd_nss9 : Debut traitement ****")

# OGA 230 g_iartin et redistribution
# ==================================
# copie du CRA original dans le g_iartout12
erreur_660004665 = i_dup_art_id(g_iartin, g_iartout12)
# /OGA 230

erreur_660004665 = 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_660004665 = -1
flag_rdt_660004665 = i_LireRedistCpt()

SI (flag_rdt_660004665 == 0)
ALORS
  erreur_660004665 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004665 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004665=i_get_art_field(g_iartin,$TrCFwd_nss9::dfin)
erreur_660004665= i_incr_redist_dist_660004265(date_fin_660004665)


######################################################################################
#   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_660004665 = -1
erreur_660004665 = 0

erreur_660004665 = i_get_art_str(g_iartin, $TrCFwd_nss9::calledNumber, pt_champ_660004665)
longueur_660004665=i_strlen(pt_champ_660004665)
SI (longueur_660004665 >= 8)
ALORS
  Flag_ZB_660004665 = 0
  SI (i_strplcmp(pt_champ_660004665,"1133600",0,7) == 0)
  ALORS
    ZBPrefixDigitD_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,7)
    ZBPrefixDigitO_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,8)
    ZBPrefixDigitT_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,9)
    Flag_ZB_660004665 = C_ZB_1133600DOT_660004665
  SINON
    SI (i_strplcmp(pt_champ_660004665,"11",0,2) != 0 && i_strplcmp(pt_champ_660004665,"600",2,3) == 0)
    ALORS
      ZBPrefixDigitD_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,5)
      ZBPrefixDigitO_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,6)
      ZBPrefixDigitT_660004665=i_get_art_fieldtab(g_iartin,$TrCFwd_nss9::calledNumber,7)
      Flag_ZB_660004665 = C_ZB_XX600DOT_660004665
    FINSI
  FINSI

  # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
  SI (  (Flag_ZB_660004665 == C_ZB_1133600DOT_660004665 || Flag_ZB_660004665 == C_ZB_XX600DOT_660004665) &&
    ZBPrefixDigitD_660004665 >= 7 && ZBPrefixDigitD_660004665 <= 9 &&
    ZBPrefixDigitO_660004665 >= 7 && ZBPrefixDigitO_660004665 <= 9 &&
    (ZBPrefixDigitT_660004665 == 1 || ZBPrefixDigitT_660004665 == 2 || ZBPrefixDigitT_660004665 == 4 || ZBPrefixDigitT_660004665 == 9) )
  ALORS
    TypePrefixe_660004665 = PREFIX_ZB_660004665
    Prefix_calledNumber_660004665 = 1

    SI (Flag_ZB_660004665 == C_ZB_XX600DOT_660004665)
    ALORS
      i_get_sub_str(pt_champ_660004665, 2, 7, pt_prefixe_ZB_660004665)
      longueur_660004665 = i_strlen(pt_prefixe_ZB_660004665)
    SINON
      i_get_sub_str(pt_champ_660004665, 4, 9, pt_prefixe_ZB_660004665)
      longueur_660004665 = i_strlen(pt_prefixe_ZB_660004665) + 2
    FINSI

    Prefix_index_660004665 = 2

    # Suppression de [33] eventuel et du prefixe ZB avant normalisation
    POINT BOUCLE_ZBSKIP1
    erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber, Prefix_index_660004665, 0x0f)
    erreur_660004665 = i_skip_f_in_field_n(g_iartin, $TrCFwd_nss9::calledNumber)
    longueur_660004665 = longueur_660004665 - 1
    SI (longueur_660004665 != 0)
    ALORS
      SAUT BOUCLE_ZBSKIP1
    FINSI
    # Si T = 4 ou 9 alors forcage du TON+NPI a 41 avant normalisation
    SI (ZBPrefixDigitT_660004665 == 4 || ZBPrefixDigitT_660004665 == 9)
    ALORS
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,0,0x4)
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,1,0x1)
    FINSI
    # Si T = 1 alors forcage du TON+NPI a 11 avant normalisation
    SI (ZBPrefixDigitT_660004665 == 1)
    ALORS
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,0,0x1)
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,1,0x1)
    FINSI
    # Si T = 2 alors forcage du TON+NPI a 21 avant normalisation
    SI (ZBPrefixDigitT_660004665 == 2)
    ALORS
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,0,0x2)
      erreur_660004665 = i_set_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber,1,0x1)
    FINSI
  FINSI
FINSI


# Traitement d'un eventuel prefixe de portabilite RoutingNumberSAC a 4 chiffres 41XXXXZABPQMCDU => 15 digits ou 1133XXXXZABPQMCDU => 17 digits
# dans le champ mblStatRNb (mobileStationRoamingNumber)
# dans le champ calledNumber (called Party Number)
# dans les champs redirectingNumber et originalCalledNumber, Attention, ces prefixes ne se memorisent pas pour T3t12 ni pour T3t70
#G3R10
trace("<<<__LINE__<<<__FILE__<<< debut traitement d'un eventuel prefixe RNSAC sur mblStatRNb, calledNumber (redirectingNumber,originalCalledNumber)")
ic_660004665 = 0
POINT DEB_BOUCLE_RNA

ic_660004665 = ic_660004665 + 1
flag_pref_660004665 = 0
SI (ic_660004665 == 1)
ALORS
  indice_champ_660004665 = $TrCFwd_nss9::mblStatRNb
SINON
  SI (ic_660004665 == 2)
  ALORS
    indice_champ_660004665 = $TrCFwd_nss9::calledNumber
    flag_pref_660004665 = Prefix_calledNumber_660004665
  SINON
    SI (ic_660004665 == 3)
    ALORS
      indice_champ_660004665 = $TrCFwd_nss9::redirectNumber
    SINON
      SI (ic_660004665 == 4)
      ALORS
        indice_champ_660004665 = $TrCFwd_nss9::origCalledNum
      FINSI
    FINSI
  FINSI
FINSI

SI (!flag_pref_660004665)
ALORS
  SI (i_valid_field_n(g_iartin,indice_champ_660004665))
  ALORS
    Prefix_index_660004665 = -1
    i_strcpy(pt_champ_660004665, "")
    erreur_660004665 = i_get_art_str(g_iartin, indice_champ_660004665, pt_champ_660004665)
    longueur_660004665=i_strlen(pt_champ_660004665)

    SI ((i_strplcmp(pt_champ_660004665,"41",0,2) == 0  && longueur_660004665 > 14) || (i_strplcmp(pt_champ_660004665,"1133",0,4) == 0 && longueur_660004665 > 16))
    ALORS
      i_strcpy(pt_cle_660004665, "")
      SI (i_strplcmp(pt_champ_660004665,"41",0,2) == 0)
      ALORS
        # Prendre les 4 chiffres suivant le TON/NPI
        i_get_sub_str(pt_champ_660004665, 2, 5, pt_cle_660004665)
        i_strcpy(pt_RetourTable_660004665,i_get_tab_field(RNSAC_660004665, date_fin_660004665, pt_cle_660004665))
        SI (i_strcmp(pt_RetourTable_660004665,"porta") == 0)
        ALORS
          Prefix_index_660004665 = 2
          longueur_660004665 = i_strlen(pt_cle_660004665)
          SI ( i_strcmp(pt_prefixe_PORTA_660004665, "") == 0 && (indice_champ_660004665 == $TrCFwd_nss9::calledNumber || indice_champ_660004665 == $TrCFwd_nss9::mblStatRNb) )
          ALORS
            TypePrefixe_660004665 = PREFIX_PORTA_660004665
            i_strcpy(pt_prefixe_PORTA_660004665, pt_cle_660004665)
          FINSI
        SINON
          SI (i_strcmp(pt_RetourTable_660004665,"sva") == 0)
          ALORS
            Prefix_index_660004665 = 2
            longueur_660004665 = i_strlen(pt_cle_660004665)
            SI ( i_strcmp(pt_prefixe_SVA_660004665, "") == 0 && (indice_champ_660004665 == $TrCFwd_nss9::calledNumber || indice_champ_660004665 == $TrCFwd_nss9::mblStatRNb) )
            ALORS
              TypePrefixe_660004665 = PREFIX_SVA_660004665
              i_strcpy(pt_prefixe_SVA_660004665, pt_cle_660004665)
            FINSI
          FINSI
        FINSI
      SINON
        SI (i_strplcmp(pt_champ_660004665,"1133",0,4) == 0)
        ALORS
          # Prendre les 4 chiffres suivant le TON/NPI
          i_get_sub_str(pt_champ_660004665, 4, 7, pt_cle_660004665)
          i_strcpy(pt_RetourTable_660004665,i_get_tab_field(RNSAC_660004665, date_fin_660004665, pt_cle_660004665))
          SI (i_strcmp(pt_RetourTable_660004665,"porta") == 0)
          ALORS
            Prefix_index_660004665 = 4
            longueur_660004665 = i_strlen(pt_cle_660004665)
            SI ( i_strcmp(pt_prefixe_PORTA_660004665, "") == 0 && (indice_champ_660004665 == $TrCFwd_nss9::calledNumber || indice_champ_660004665 == $TrCFwd_nss9::mblStatRNb) )
            ALORS
              TypePrefixe_660004665 = PREFIX_PORTA_660004665
              i_strcpy(pt_prefixe_PORTA_660004665, pt_cle_660004665)
            FINSI
          SINON
            SI (i_strcmp(pt_RetourTable_660004665,"sva") == 0)
            ALORS
              Prefix_index_660004665 = 4
              longueur_660004665 = i_strlen(pt_cle_660004665)
              SI ( i_strcmp(pt_prefixe_SVA_660004665, "") == 0 && (indice_champ_660004665 == $TrCFwd_nss9::calledNumber || indice_champ_660004665 == $TrCFwd_nss9::mblStatRNb) )
              ALORS
                TypePrefixe_660004665 = PREFIX_SVA_660004665
                i_strcpy(pt_prefixe_SVA_660004665, pt_cle_660004665)
              FINSI
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI

    SI (Prefix_index_660004665 != -1)
    ALORS
      SI (indice_champ_660004665 == $TrCFwd_nss9::calledNumber)
      ALORS
        Prefix_calledNumber_660004665 = 1
      FINSI

      trace2 ("<<__LINE__ >> ---------------- pt_cle = %s ----------",pt_cle_660004665,"")
      # Suppression du prefixe RNA du champ d origine : TON+NPI [33] RNA ZABPQMCDU
      POINT BOUCLE_RNASKIP
      # Dx
      erreur_660004665 = i_set_art_fieldtab(g_iartin, indice_champ_660004665, Prefix_index_660004665, 0x0f)
      erreur_660004665 = i_skip_f_in_field_n(g_iartin, indice_champ_660004665)
      longueur_660004665 = longueur_660004665 - 1
      SI (longueur_660004665 != 0)
      ALORS
        SAUT BOUCLE_RNASKIP
      FINSI
    FINSI
  FINSI
FINSI

SI (ic_660004665 < 4)
ALORS
  SAUT DEB_BOUCLE_RNA
FINSI
trace2("<<<__LINE__<<<__FILE__<< pt_prefixe_PORTA=<%s>, pt_prefixe_SVA=<%s>",pt_prefixe_PORTA_660004665,pt_prefixe_SVA_660004665)

#########################################################################
# Duplication vers le format Pivot Tdpvgsm3.3
#########################################################################

# Choix de la table de duplication

#
# (si le champ est present car il est optionnel)
#

calledNumber_present_660004665 = i_get_art_field(g_iartin, $TrCFwd_nss9::calledNumber -1)

#G3R7 item Gestion du code MNC pour les MVNOs Lights
digit1_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::IMSI, 0)
digit2_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::IMSI, 1)
digit3_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::IMSI, 2)
digit4_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::IMSI, 3)
digit5_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::IMSI, 4)

SI ( (digit1_IMSI_660004665 ==2 ) && (digit2_IMSI_660004665 ==0 ) && (digit3_IMSI_660004665 ==8 ) && (digit4_IMSI_660004665 ==0 ) && (digit5_IMSI_660004665 ==1 ) )
ALORS
# Cas des abonnes ITINERIS
  IMSI_OrangeCo_660004665 = 1
SINON
  SI ((digit1_IMSI_660004665 ==2) && (digit2_IMSI_660004665 ==0) && (digit3_IMSI_660004665 ==8))
  ALORS
    erreur_660004665 = i_get_art_str(g_iartin, $TrCFwd_nss9::IMSI,str_IMSI_660004665)
    i_get_sub_str (str_IMSI_660004665, 0, 4, str_MNC_660004665)
    erreur_660004665=i_format_str2( str_conteneur_660004665, "%s%s", "L_", str_MNC_660004665)
    SI (i_get_tab_field("MVNO", date_fin_660004665, str_conteneur_660004665)) != g_inull
    ALORS
      IMSI_OrangeCo_660004665 = 1
    SINON
      IMSI_OrangeCo_660004665 = 0
    FINSI
  FINSI
FINSI
#/G3R7 item Gestion du code MNC pour les MVNOs Lights

SI IMSI_OrangeCo_660004665
ALORS
  SI (calledNumber_present_660004665 > 0 )
  ALORS
    erreur_660004665 = rm_escape_char_end_660004265(g_iartin, $TrCFwd_nss9::calledNumber)
  FINSI
  indice_duptab_660004665 = C_DUP_TAB_NORMITINERIS_660004665
SINON
# Cas des ROAMERS
  indice_duptab_660004665 = C_DUP_TAB_NORMROAMERS_660004665
  SI (calledNumber_present_660004665 > 0 )
  ALORS
    TON_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber, 0)
    NPI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber, 1)

    SI ( (TON_660004665 == 2) && ((NPI_660004665 == 0)||(NPI_660004665 == 1)) )
    ALORS
      digit3_IMSI_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::calledNumber, 2)
      SI (digit3_IMSI_660004665==0)
      ALORS
        erreur_660004665 = rm_escape_char_end_660004265(g_iartin,$TrCFwd_nss9::calledNumber)
      FINSI
    SINON
      erreur_660004665 = rm_escape_char_end_660004265(g_iartin, $TrCFwd_nss9::calledNumber)

    FINSI

  FINSI
FINSI

trace1("Indice de la table de duplication: %d", indice_duptab_660004665)

#####################################################################
# Creation DPV
# Duplication en DPV fixe ou TLV
#####################################################################

# Duplication en DPVTLV
ic_660004665 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm",indice_duptab_660004665)

SI (ic_660004665 != 0)
ALORS
  trace("TrCFwd_nss9: Appel a la table de duplication -> erreur dup ")
  ERREUR_660004665 = ERR_DUPL_660004665
  code_rejet_660004665 = MODULE_660004665 + ERREUR_660004665 + EFFICACE_660004665
  erreur_660004665 = i_PlvMessEmettre(8484,2,g_iartout12,"",1,code_rejet_660004665,0,0)
  SAUT STOCKE_ERRONE
FINSI

#####################################################################
# 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_660004665 = i_get_art_field(g_iartin, $TrCFwd_nss9::disconnectParty)
  SI (res_660004665 == 0 || res_660004665 == 1)
  ALORS
    erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004665 == 2)
    ALORS
      erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI

#le 2Val ne marche pas correctement alors

date_660004665 =  i_get_art_field(g_iartin,$TrCFwd_nss9::ddebut)
erreur_660004665 = i_set_art_field(g_iartout,$Tdpvgsm::DATE, date_660004665)


# --- Recherche du champ a utiliser pour valoriser idpart

indice_champ_valo_660004665 = 0
#QC564 : VALO_IDPART_3N_T04 a la place de VALO_IDPART_3N
# --- Si valorisation a trois niveaux du champ idpart
date_pivot_660004665=i_get_art_field(g_iartin,$TrCFwd_nss9::DATE)+i_get_art_field(g_iartin,$TrCFwd_nss9::Heure)
pt_valo3_660004665=i_get_tab_field("VariableContexte",date_pivot_660004665,"VALO_IDPART_3N_T04")
SI (i_strcmp(pt_valo3_660004665,g_inull))
ALORS
  redirectNumber_present_660004665 = i_valid_field_n(g_iartin,$TrCFwd_nss9::redirectNumber)
  SI (redirectNumber_present_660004665)
  ALORS
    SI (i_get_art_field(g_iartin,$TrCFwd_nss9::redirectNumber-1) == 0)
    ALORS
      redirectNumber_present_660004665=0
    FINSI
  FINSI
  SI (redirectNumber_present_660004665)
  ALORS
# --- Valorisation avec le champ redirectNumber
    indice_champ_valo_660004665 = $TrCFwd_nss9::redirectNumber
  SINON
    origCalledNum_present_660004665 = i_valid_field_n(g_iartin,$TrCFwd_nss9::origCalledNum)
    SI (origCalledNum_present_660004665)
    ALORS
      SI (i_get_art_field(g_iartin,$TrCFwd_nss9::origCalledNum-1) == 0)
      ALORS
        origCalledNum_present_660004665=0
      FINSI
    FINSI
    SI (origCalledNum_present_660004665)
    ALORS
# --- Valorisation avec le champ origCalledNum
      indice_champ_valo_660004665 = $TrCFwd_nss9::origCalledNum
    SINON
# --- Valorisation avec le champ callingNumber
      indice_champ_valo_660004665 = $TrCFwd_nss9::callingNumber
    FINSI
  FINSI
SINON
# --- Valorisation classique avec le champ callingNumber
  indice_champ_valo_660004665 = $TrCFwd_nss9::callingNumber
FINSI

SI (i_valid_field_n(g_iartin,indice_champ_valo_660004665))
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout,"T3t2","")

# --- Valorisation du champ idpart
  SI ( i_get_art_field(g_iartin, indice_champ_valo_660004665-1) == 2)
  ALORS
    SI (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 0) == 4 && i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 1) == 1 && i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 2) == 0 && i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 3) == 0x0f)
    ALORS
# Cas Appelant = 0 (on utilise l'automate specifique pour la normalisation)

      # auto 22 NORM_MET_ANS1_410

      erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::idpart,-$NORM:MET_ASN1_410,0)
    SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
      # auto 13 MET_ASN1_NEW_IDPART
      #G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242
    	#erreur = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_IDPART,0)
    	erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI
  SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
    # auto 13 MET_ASN1_NEW_IDPART
    #G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242
    #erreur = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_IDPART,0)
    erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242,0)
  FINSI

  SI ( erreur_660004665 != 0)
  ALORS
    trace("TrCFwd_nss9: Erreur de duplication du champ idpart ")
    ERREUR_660004665 = ERR_NORM_660004665
    code_rejet_660004665 = MODULE_660004665 + ERREUR_660004665 + EFFICACE_660004665
    erreur_660004665 = i_PlvMessEmettre(8485,2,g_iartout12,"",2, code_rejet_660004665,"idpart",0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

#####################################################################
# Traitement du champ origine
#
#####################################################################

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


##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciident_660004665,"")
i_strcpy(str_exchDCBdent_660004665,"")
erreur_660004665 = i_get_art_str(g_iartin,$TrCFwd_nss9::exchasciident,str_exchasciident_660004665)
trace2("################# str_exchasciident = %s ################",str_exchasciident_660004665,"")
position_660004665 = RECHERCHE_CARACTERE_660004265(str_exchasciident_660004665," ")
trace1("############ position= %d ###########",position_660004665)
SI ( position_660004665 > -1)
ALORS
  i_get_sub_str (str_exchasciident_660004665, 0, position_660004665 - 1 ,str_exchasciident_660004665)
  trace2("################# str_exchasciident = %s ################",str_exchasciident_660004665,"")
FINSI
longueur_660004665 = i_conv_ascii_dcb (str_exchasciident_660004665,str_exchDCBdent_660004665 )
SI (longueur_660004665 > 9)
ALORS
	longueur_660004665 = 9
FINSI
erreur_660004665 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBdent_660004665, longueur_660004665)

#Fin QC396


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

SI (i_strcmp(pt_prefixe_PORTA_660004665,"") != 0)
ALORS
# --- Si un prefixe RNSA porta a ete trouve
  erreur_660004665 = i_ajout_tlv(g_iartout, "T3t12", "")
  longueur_660004665 = i_conv_ascii_dcb(pt_prefixe_PORTA_660004665, pt_prefixe_DCB_660004665)
  erreur_660004665 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::portpref, pt_prefixe_DCB_660004665, longueur_660004665)
  erreur_660004665 = i_resize_tlv( g_iartout, "T3t12", "portpref", longueur_660004665 * 8 )
FINSI


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

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004665)
ALORS
  tailleOrigLocNumber_660004665 =i_get_art_field(g_iartin, $TrCFwd_nss9::origLocNumber-1)
#        tailleOrigLocNumber =tailleOrigLocNumber / 8
  SI ( tailleOrigLocNumber_660004665 >= 2)
  ALORS
    TON_origLocNum_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::origLocNumber, 0)
    NPI_origLocNum_660004665 = i_get_art_fieldtab(g_iartin, $TrCFwd_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_660004665 == 4) && (NPI_origLocNum_660004665 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004665 = i_ajout_tlv(g_iartout,"T3t6","")
      #auto 4 NORM_CIT_IDENT
      erreur_660004665 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $TrCFwd_nss9::origLocNumber,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004665 != 0 )
      ALORS
        trace(" Erreur duplication champ portOrigNet ")
        ERREUR_660004665 = ERR_NORM_660004665
        code_rejet_660004665 = MODULE_660004665 + ERREUR_660004665 + EFFICACE_660004665
        erreur_660004665 = i_PlvMessEmettre(8485,2,g_iartout12,"",2, code_rejet_660004665,"portOrigNet",0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement des champs transporteurs sortant et entrants
#
#####################################################################

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

tailleChpTrans_660004665=i_get_art_field(g_iartin,($TrCFwd_nss9::outgoingRoute-1))

SI    ((tailleChpTrans_660004665 <= 7 )
  && (i_valid_field_n(g_iartin,$TrCFwd_nss9::outgoingRoute)))
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004665 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004665)
  erreur_660004665 = i_memcpy_art_field_n(g_iartout,
  $Tdpvgsm::TrSortant,
  g_iartin.outgoingRoute[],
  tailleChpTrans_660004665)
FINSI

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

tailleChpTrans_660004665 = i_get_art_field(g_iartin,($TrCFwd_nss9::incomingRoute-1))

SI    ((tailleChpTrans_660004665 <= 7 )
  && (i_valid_field_n(g_iartin,$TrCFwd_nss9::incomingRoute)))
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004665 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004665)
  erreur_660004665 = i_memcpy_art_field_n(g_iartout,
  $Tdpvgsm::TrEntrant,
  g_iartin.incomingRoute[],
  tailleChpTrans_660004665)
SINON
  SI (i_valid_field_n(g_iartin,$TrCFwd_nss9::incomingRoute))
  ALORS
    erreur_660004665 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004665 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",7)
    erreur_660004665 = 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'
# #####################################################################
# QC1331
#erreur=set_timeInCE_EEC(0)
########### Date_Audit
erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
#   Ajout du champs T3t34
#####################################################################
SI (i_strcmp(pt_prefixe_ZB_660004665,"") != 0)
ALORS
# --- Si un prefixe ZB sur calledNumber a ete trouve
  erreur_660004665 = i_ajout_tlv(g_iartout,"T3t34","")
  longueur_660004665 = i_conv_ascii_dcb(pt_prefixe_ZB_660004665, pt_prefixe_DCB_660004665)
  erreur_660004665 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::ZBprefix, pt_prefixe_DCB_660004665, longueur_660004665)
  erreur_660004665 = i_resize_tlv( g_iartout, "T3t34", "ZBprefix", longueur_660004665 * 8 )
FINSI

##################################################################
# OGA-120 V3t37 est absent dans le DPV
###################################################################
# Ajout du champ V4t38.3 equipmentType
###################################################################

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


###########################################
# Ajout champ T3t57 V3t57
# G3R1 lot3 (sur 4 digits au lieu de 3) et prefixe "ZBsortant_"
###########################################
#QC1244
i_strcpy(pt_champ_660004665, "")
erreur_660004665 = i_get_art_str(g_iartout, $Tdpvgsm::local, pt_champ_660004665)
SI (i_strplcmp ( pt_champ_660004665, "33", 0, 2) == 0)
ALORS
  i_get_sub_str (pt_champ_660004665, 2, 5, pt_champ_660004665)
  erreur_660004665 = i_format_str2(pt_cle_660004665, "%s%s", "ZBsortant_", pt_champ_660004665)
  i_strcpy(pt_RetourTable_660004665,i_get_tab_field(RNSAC_660004665, date_fin_660004665, pt_cle_660004665))
  SI (i_strcmp(pt_RetourTable_660004665, "") != 0)
  ALORS
    erreur_660004665 = i_ajout_tlv(g_iartout, "T3t57","")
    longueur_660004665 = i_conv_ascii_dcb(pt_RetourTable_660004665, pt_ZB_DCB_660004665)
    erreur_660004665 = i_resize_tlv(g_iartout, "T3t57", "GDCB", longueur_660004665 * 8)
    erreur_660004665 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::GDCB, pt_ZB_DCB_660004665, longueur_660004665)
  FINSI
FINSI


#######################################################################
# OGA-120  Mise a jour de V3t3, valorise toujours par T3t14/mblStatRnb
#######################################################################

#####################################################################
# calcul prevalorisation et affectation des valeurs nbum et nbut au DPV
#####################################################################
# Maj de la valeur du champ indtax a 0x01 avant le calcul de prevalorisation
#
erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0x01)

##########
# appel preval TrCFwd
##########

res_660004665 = preval_ut_660004265(g_iartout)

SI (res_660004665 == -1 )
ALORS
  ERREUR_660004665 = ERR_VALO_660004665
  code_rejet_660004665 = MODULE_660004665 + ERREUR_660004665 + EFFICACE_660004665
  erreur_660004665 = i_PlvMessEmettre(8487,0 , g_iartout12, "" , 1, code_rejet_660004665, 0, 0 )
  trace("Fin traitement: erreur prevalorisation")
  SAUT STOCKE_ERRONE
SINON
  SI (res_660004665 == -2 )
  ALORS
    trace("pas de prevalorisation : retour preval == -2")
  SINON
    trace1("Prevalorisation OK avec valeur : %d", res_660004665)
    erreur_660004665 = i_set_art_field(g_iartout,$Tdpvgsm::nbUT, res_660004665)
  FINSI
FINSI
##########
# /appel preval
##########
# Maj de la valeur du champ indtax a 0x01 avant le calcul de prevalorisation
#
erreur_660004665 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0xff)

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

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

##################################################
#G3R3 lot2 mapping ABC ajout du T3t63 (LastCallingNb)
#####################################################

# QC957 (idem idpart moins interrogation table externe)

indice_champ_valo_660004665 = 0
redirectNumber_present_660004665 = i_valid_field_n(g_iartin,$TrCFwd_nss9::redirectNumber)
SI (redirectNumber_present_660004665)
ALORS
  SI (i_get_art_field(g_iartin,$TrCFwd_nss9::redirectNumber-1) == 0)
  ALORS
    redirectNumber_present_660004665=0
  FINSI
FINSI

SI (redirectNumber_present_660004665)
ALORS
# --- Valorisation avec le champ redirectNumber
  indice_champ_valo_660004665 = $TrCFwd_nss9::redirectNumber
SINON

  origCalledNum_present_660004665 = i_valid_field_n(g_iartin,$TrCFwd_nss9::origCalledNum)
  SI (origCalledNum_present_660004665)
  ALORS
    SI (i_get_art_field(g_iartin,$TrCFwd_nss9::origCalledNum-1) == 0)
    ALORS
      origCalledNum_present_660004665=0
    FINSI
  FINSI

  SI (origCalledNum_present_660004665)
  ALORS
# --- Valorisation avec le champ origCalledNum
    indice_champ_valo_660004665 = $TrCFwd_nss9::origCalledNum
  SINON
# --- Valorisation avec le champ callingNumber
    indice_champ_valo_660004665 = $TrCFwd_nss9::callingNumber
  FINSI
FINSI

SI (i_valid_field_n(g_iartin,indice_champ_valo_660004665))
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout,"T3t63","")

# --- Valorisation du champ LastCallingNb
  SI ( i_get_art_field(g_iartin, indice_champ_valo_660004665-1) == 2)
  ALORS
    SI ( (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004665, 3) == 0x0f) )
    ALORS
# Cas Appelant = 0 (on utilise l'automate specifique pour la normalisation)
      erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
    SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
      #G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242
    	#erreur = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_IDPART,0)
    	erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI
  SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
    #G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242
    #erreur = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_IDPART,0)
    erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004665,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
  FINSI

  SI ( erreur_660004665 != 0)
  ALORS
    trace("TrCFwd_nss9: Erreur de duplication du champ LastCallingNb")
  FINSI
FINSI

####################################################
# G3R3 lot2 mapping ABC ajout du T3t64 (RedirectingNb)
###################################################
redirectNumber_present_660004665 = i_valid_field_n(g_iartin,$TrCFwd_nss9::redirectNumber)
SI (redirectNumber_present_660004665)
ALORS
  SI (i_get_art_field(g_iartin,$TrCFwd_nss9::redirectNumber-1) == 0)
  ALORS
    redirectNumber_present_660004665=0
  FINSI
FINSI

SI (redirectNumber_present_660004665)
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout,"T3t64","")

  SI ( (i_get_art_field(g_iartin, $TrCFwd_nss9::redirectNumber-1) == 2) &&
    (i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::redirectNumber, 0) == 4) &&
    (i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::redirectNumber, 1) == 1) &&
    (i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::redirectNumber, 2) == 0) &&
    (i_get_art_fieldtab(g_iartin, $TrCFwd_nss9::redirectNumber, 3) == 0x0f) )
  ALORS
    erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TrCFwd_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_410,0)
    SI ( erreur_660004665 != 0)
    ALORS
      trace("TrCFwd_nss9: Erreur de duplication du champ RedirectingNb")
    FINSI

  SINON
    #G5R2 QC1433 champ RedirectNumber : normaliser avec automate MET_ASN1_NEW_2242
    #erreur = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TrCFwd_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_IDPART,0)
    erreur_660004665 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$TrCFwd_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
    SI ( erreur_660004665 != 0)
    ALORS
      trace("TrCFwd_nss9: Erreur de duplication du champ RedirectingNb")
    FINSI


  FINSI
FINSI
#/G3R3 lot2

#-----------------------------------------------------------------------#
# champ T3t70 PrefixeSVA
# Prefixe de routage SVA si present en T3t14/mblStatRnb, Sinon absent
#-----------------------------------------------------------------------#
#QC927
SI (i_strcmp(pt_prefixe_SVA_660004665,"") != 0)
ALORS
# --- Si un prefixe RNSAC sva a ete trouve
  erreur_660004665 = i_ajout_tlv(g_iartout, "T3t70", "")
  longueur_660004665 = i_conv_ascii_dcb(pt_prefixe_SVA_660004665, pt_prefixe_DCB_660004665)
  erreur_660004665 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::PrefixeSVA, pt_prefixe_DCB_660004665, longueur_660004665)
  erreur_660004665 = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004665 * 8 )
FINSI

#----------------------------------------------#
# champ T3t99 GretaTag
#----------------------------------------------#
SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GretaTag))
ALORS
  erreur_660004665 = i_ajout_tlv(g_iartout,"T3t99","")
FINSI

# Aiguillage
erreur_660004665 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004665, Multidistribution_Non_660004665)
SI (erreur_660004665 == TRAI_KO_660004665)
ALORS
# QC1005
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
  SAUT STOCKE_ERRONE
FINSI

RETOUR TRAIT_OK


# ------------------ Point de branchement :Stockage en errone -------
POINT STOCKE_ERRONE
trace("Article stocke en errone")
erreur_660004665 = i_make_art_rej(g_iartout12, g_iartout11, code_rejet_660004665)
erreur_660004665 = i_stocke_art(g_iartout11, 0, PT_ERRONE, 0)

trace( "Fin traitement Article TrCFwd_nss9 ERRONE " )
RETOUR TRAIT_OK

#-------------------- fin TrCFwd_nss9_dis.src --------------------------------
