DEFINITION Multidistribution_Non_660004667 0
DEFINITION DISTRIBUTION_INCONNU_660004667 1
DEFINITION TRAI_KO_660004667 -1
DEFINITION MODULE_DISTR_660004667 0xA000
DEFINITION ERR_NORM_660004667 0x010
DEFINITION ERR_DUPL_660004667 0x0D0
DEFINITION ERR_DISTR_660004667 0x110
DEFINITION RNSAC_660004667 "RoutinNumberSac"
REGISTRE ENTIER erreur_660004667
REGISTRE ENTIER flag_rdt_660004667
REGISTRE ENTIER tlserv_660004667
REGISTRE ENTIER ic_660004667
REGISTRE ENTIER is_roamers_660004667
REGISTRE ENTIER userRate_660004667
REGISTRE ENTIER userProtocol_660004667
REGISTRE ENTIER tranInd_660004667
REGISTRE ENTIER transIndicator_present_660004667
REGISTRE ENTIER CSDaddValue_660004667
REGISTRE ENTIER tailleChpTrans_660004667
REGISTRE ENTIER origCalledNum_present_660004667
REGISTRE ENTIER redirectNumber_present_660004667
REGISTRE ENTIER indice_champ_valo_660004667
REGISTRE ENTIER RoutingNumberVal_660004667
REGISTRE ENTIER RoutingNumberError_660004667
REGISTRE ENTIER RoutingNumberTmpVal_660004667
REGISTRE ENTIER RoutingNumberLong_660004667
REGISTRE ENTIER RoutingNumberTON_660004667
REGISTRE ENTIER RoutingNumberNPI_660004667
REGISTRE ENTIER RoutingNumberCC1_660004667
REGISTRE ENTIER RoutingNumberCC2_660004667
REGISTRE ENTIER tlserv_mod_660004667
REGISTRE ENTIER gsmTlSrv_660004667
REGISTRE ENTIER svcsup_660004667
REGISTRE ENTIER Q1_660004667
REGISTRE ENTIER Q2_660004667
REGISTRE ENTIER vsvcsup_660004667
REGISTRE ENTIER TON_origLocNum_660004667
REGISTRE ENTIER NPI_origLocNum_660004667
REGISTRE ENTIER origLocNum_present_660004667
REGISTRE ENTIER IMSI_OrangeCo_660004667
REGISTRE ENTIER date_stocke_660004667
REGISTRE POINTEUR pt_valeur_660004667
REGISTRE ENTIER res_660004667
REGISTRE ENTIER date_660004667
REGISTRE ENTIER date_fin_660004667
REGISTRE ENTIER timeForTccall_660004667
REGISTRE ENTIER code_rejet_660004667
REGISTRE ENTIER EFFICACE_660004667
REGISTRE ENTIER MODULE_660004667
REGISTRE ENTIER ERREUR_660004667
REGISTRE POINTEUR pt_CleRoutingNumberSAC_660004667
REGISTRE ENTIER position_660004667
REGISTRE ENTIER longueur_660004667
REGISTRE POINTEUR str_exchasciident_660004667
REGISTRE POINTEUR str_exchDCBdent_660004667
REGISTRE POINTEUR str_portabilite_660004667
REGISTRE POINTEUR str_IMSI_660004667
REGISTRE POINTEUR str_MNC_660004667
REGISTRE POINTEUR str_conteneur_660004667
####################################################################
# Tterm_nss9_dis.src      Appel Entrant MET NSS9
####################################################################
#       article CRA MET ASN1 => type DPV TLV = 01
#
# GF 16/10/02 Creation
# 22/01/2008 - PSA - G1R6 - modification du traitement du prefixe Routing Number
# 08/02/2008 - PSA - G1R6 - FO 640
# 26/08/2009 - PKH - G2R3 - QC396
# 11/06/2010 - JLG - G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2,
#                               ajout champ T3t55 (GFlag2) et T3t56 (GValue)
# 08/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 lot2 mapping ABC
# 26/04/2011 - PKH - G3R3 Lot3 Curling Free
# 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
# 23/05/2012 - PKH -G3R7  Item Gestion du code MNC pour les MVNOs Lights
# 12/11/2012 - PKH -G3R8 lot3 Correctif Mapping ABC
# 17/07/2013   G3R10 lot3 QC1232 : DPV FREE V3t9, MSC E// mapping donnee disconnectingParty - Correction V3t1.14/DPV4.0
# 07/08/2013 - PKH - G3R10 lot3 QC1232 : reprise pour correction mauvaise interpretation de la valeur retour de i_valid_field_n
# 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
# 09/10/2014 - JLG - QC1444 correction supplementaire de la QC1292
####################################################################





#QC396
# /QC396
#G3R3 Lot3
#/G3R3 Lot3
#G3R7

is_roamers_660004667 = 0
IMSI_OrangeCo_660004667 = 0
redirectNumber_present_660004667 = 0
origCalledNum_present_660004667 = 0

str_IMSI_660004667 = "str_IMSI13313113131313131313131313131313133113133131133131131313131313331313133"
str_MNC_660004667 = "str_MNC6565566556565656565656565656565665656565656565656565656565656565656565565"
str_conteneur_660004667 = "str_conteneur9779799779797979797979797979797979797979797979797979797979797"

i_strcpy(str_conteneur_660004667,"")
i_strcpy(str_IMSI_660004667,"")
i_strcpy(str_MNC_660004667,"")

trace("Tterm_nss9 : Debut distribution")

#  g_iartin et redistribution
# ==================================
# copie du CRA original dans le g_iartout12
erreur_660004667 = i_dup_art_id(g_iartin, g_iartout12)
#
#  comptabilisation des CRAs issus de la redistribution
date_fin_660004667=i_get_art_field(g_iartin,$Tterm_nss9::dfin)
erreur_660004667= i_incr_redist_dist_660004265(date_fin_660004667)
erreur_660004667 = i_cree_art("Conv_URS",g_iartout9)

# Initialisations
EFFICACE_660004667 = 1
MODULE_660004667 = MODULE_DISTR_660004667
ERREUR_660004667 = 0
code_rejet_660004667 = 0
pt_valeur_660004667="1234567891234567890"
pt_CleRoutingNumberSAC_660004667 = "pt_CleRoutingNumberSAC"
i_strcpy(pt_CleRoutingNumberSAC_660004667,"")
#pt_audit ="123456789123456789"

#QC396
str_exchasciident_660004667 = "str_exchasciident19191919191919191919191911991919191919191919"
str_exchDCBdent_660004667 = "str_exchDCBdent2323232323232323232323232323232323232332232332323"
str_portabilite_660004667 = "str_portabilite45454545454545454545454545454545455454545454545454"
position_660004667 = 0
longueur_660004667 = 0
# /QC396

i_strcpy(str_portabilite_660004667,"")

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

SI (flag_rdt_660004667 == 0)
ALORS
  erreur_660004667 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004667 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)

RoutingNumberVal_660004667=-1
RoutingNumberError_660004667 = 0
RoutingNumberLong_660004667 = i_get_art_field(g_iartin, $Tterm_nss9::calledNumber - 1 )
SI (RoutingNumberLong_660004667 >= 8)
ALORS
  RoutingNumberTON_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 0)
  RoutingNumberNPI_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 1)
  SI ((RoutingNumberTON_660004667 == 1) && (RoutingNumberNPI_660004667 == 1))
  ALORS
    RoutingNumberCC1_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2)
    RoutingNumberCC2_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 3)
    SI ((RoutingNumberCC1_660004667 == 3) && (RoutingNumberCC2_660004667 == 3))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 5)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 6)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
        SI ( RoutingNumberVal_660004667 != -1 )
        ALORS
          RoutingNumberError_660004667 = 1
        SINON
# --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberVal_660004667=RoutingNumberTmpVal_660004667
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004667 == 4) && (RoutingNumberNPI_660004667 == 1))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 3)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 4)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
        SI ( RoutingNumberVal_660004667 != -1 )
        ALORS
          RoutingNumberError_660004667 = 1
        SINON
# --- Suppression du prefixe pour 41 RN *
          RoutingNumberVal_660004667=RoutingNumberTmpVal_660004667
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
          erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::calledNumber, 2, 0x0f)
          erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::calledNumber)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans les champs redirectingNumber et originalCalledNumber
# Attention, ces prefixes ne se memorisent pas pour T3t12
#####################################################################

RoutingNumberError_660004667 = 0
RoutingNumberLong_660004667 = i_get_art_field(g_iartin, $Tterm_nss9::redirectNumber - 1 )
SI (RoutingNumberLong_660004667 >= 8)
ALORS
  RoutingNumberTON_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 0)
  RoutingNumberNPI_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 1)
  SI ((RoutingNumberTON_660004667 == 1) && (RoutingNumberNPI_660004667 == 1))
  ALORS
    RoutingNumberCC1_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2)
    RoutingNumberCC2_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 3)
    SI ((RoutingNumberCC1_660004667 == 3) && (RoutingNumberCC2_660004667 == 3))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 5)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 6)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
# --- Suppression du prefixe pour 11 33 RN *
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004667 == 4) && (RoutingNumberNPI_660004667 == 1))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 3)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 4)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
# --- Suppression du prefixe pour 41 RN *
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::redirectNumber)
      FINSI
    FINSI
  FINSI
FINSI

RoutingNumberError_660004667 = 0
RoutingNumberLong_660004667 = i_get_art_field(g_iartin, $Tterm_nss9::origCalledNum - 1 )
SI (RoutingNumberLong_660004667 >= 8)
ALORS
  RoutingNumberTON_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 0)
  RoutingNumberNPI_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 1)
  SI ((RoutingNumberTON_660004667 == 1) && (RoutingNumberNPI_660004667 == 1))
  ALORS
    RoutingNumberCC1_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2)
    RoutingNumberCC2_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 3)
    SI ((RoutingNumberCC1_660004667 == 3) && (RoutingNumberCC2_660004667 == 3))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 5)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 6)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
# --- Suppression du prefixe pour 11 33 RN *
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004667 == 4) && (RoutingNumberNPI_660004667 == 1))
    ALORS
      RoutingNumberTmpVal_660004667=i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2)*1000
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 3)*100
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 4)*10
      RoutingNumberTmpVal_660004667=RoutingNumberTmpVal_660004667+i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      erreur_660004667 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004667)
      erreur_660004667 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004667)
      #G3R3 Lot3 Curling Free
      i_strcpy(str_portabilite_660004667,i_get_tab_field(RNSAC_660004667, date_fin_660004667, pt_CleRoutingNumberSAC_660004667))
      SI (i_strcmp(str_portabilite_660004667,"porta") == 0)
      ALORS
# --- Suppression du prefixe pour 41 RN *
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
        erreur_660004667 = i_set_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2, 0x0f)
        erreur_660004667 = i_skip_f_in_field_n(g_iartin, $Tterm_nss9::origCalledNum)
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Creation DPV
# Duplication en DPV fixe ou TLV
#####################################################################
#G3R7 Item Gestion du code MNC pour les MVNOs Lights
# Si IMSI  itineris ( 20801)
SI ( ((i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 4) == 1 ) &&
  (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 3) == 0 ) &&
  (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 2) == 8 ) &&
  (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 1) == 0 ) &&
  (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 0) == 2 ))
  )
ALORS
  IMSI_OrangeCo_660004667 = 1
SINON
  SI  ((i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 2) == 8 ) &&
    (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 1) == 0 ) &&
    (i_get_art_fieldtab(g_iartin, $Tterm_nss9::IMSI, 0) == 2 ))
  ALORS
    erreur_660004667 = i_get_art_str(g_iartin, $Tterm_nss9::IMSI,str_IMSI_660004667)
    i_get_sub_str (str_IMSI_660004667, 0, 4, str_MNC_660004667)
    erreur_660004667=i_format_str2( str_conteneur_660004667, "%s%s", "L_", str_MNC_660004667)
    SI (i_get_tab_field("MVNO", date_fin_660004667, str_conteneur_660004667)) != g_inull
    ALORS
      IMSI_OrangeCo_660004667 = 1
    SINON
      IMSI_OrangeCo_660004667 = 0
    FINSI
  FINSI
FINSI

SI (IMSI_OrangeCo_660004667 == 0)
ALORS
  is_roamers_660004667 = 1
  ic_660004667 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 1)
SINON
  ic_660004667 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 0)
FINSI

SI (ic_660004667 != 0)
ALORS
  trace("Tterm_nss9 :Erreur duplication")
  ERREUR_660004667 = ERR_DUPL_660004667
  code_rejet_660004667 = MODULE_660004667 + ERREUR_660004667 + EFFICACE_660004667
  erreur_660004667 = i_PlvMessEmettre(8395,2,g_iartout12,"",1,code_rejet_660004667,0,0)
  SAUT STOCKE_ERRONE
FINSI

#le 2Val ne marche pas correctement alors

date_660004667 =  i_get_art_field(g_iartin,$Tterm_nss9::ddebut)
erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::DATE, date_660004667)
date_660004667 = i_get_art_field(g_iartin,$Tterm_nss9::DATE)
timeForTccall_660004667 = i_get_art_field(g_iartin,$Tterm_nss9::timeForTCCall)
res_660004667 = date_660004667 + timeForTccall_660004667
erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::estalloc, res_660004667)

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciident_660004667,"")
i_strcpy(str_exchDCBdent_660004667,"")
erreur_660004667 = i_get_art_str(g_iartin,$Tterm_nss9::exchasciident,str_exchasciident_660004667)
trace2("################# str_exchasciident = %s ################",str_exchasciident_660004667,"")
position_660004667 = RECHERCHE_CARACTERE_660004265(str_exchasciident_660004667," ")
trace1("############ position= %d ###########",position_660004667)
SI ( position_660004667 > -1)
ALORS
  i_get_sub_str (str_exchasciident_660004667, 0, position_660004667 - 1 ,str_exchasciident_660004667)
  trace2("################# str_exchasciident = %s ################",str_exchasciident_660004667,"")
FINSI
longueur_660004667 = i_conv_ascii_dcb (str_exchasciident_660004667,str_exchDCBdent_660004667 )
SI (longueur_660004667 > 9)
ALORS
	longueur_660004667 = 9
FINSI
erreur_660004667 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBdent_660004667, longueur_660004667)
#Fin QC396

#####################################################################
# Mise a jour du champ idpart avec
# possible valorisation a 3 niveaux du champ
#####################################################################

# --- Recherche du champ a utiliser pour valoriser idpart
indice_champ_valo_660004667 = 0
# --- Si valorisation a trois niveaux du champ idpart
#SI (i_getv_ctxt("VALO_IDPART_3N"))

date_stocke_660004667 = i_get_art_date(g_iartin)
i_strcpy(pt_valeur_660004667, i_get_tab_field("VariableContexte", date_stocke_660004667, "VALO_IDPART_3N"))

SI(i_strcmp(pt_valeur_660004667, g_inull) != 0 )
ALORS
  redirectNumber_present_660004667 = i_valid_field_n(g_iartin,$Tterm_nss9::redirectNumber)
  SI (redirectNumber_present_660004667)
  ALORS
    SI (i_get_art_field(g_iartin,$Tterm_nss9::redirectNumber-1) == 0)
    ALORS
      redirectNumber_present_660004667=0
    FINSI
  FINSI
  SI (redirectNumber_present_660004667)
  ALORS
# --- Valorisation avec le champ redirectNumber
    indice_champ_valo_660004667 = $Tterm_nss9::redirectNumber
  SINON
    origCalledNum_present_660004667 = i_valid_field_n(g_iartin,$Tterm_nss9::origCalledNum)
    SI (origCalledNum_present_660004667)
    ALORS
      SI (i_get_art_field(g_iartin,$Tterm_nss9::origCalledNum-1) == 0)
      ALORS
        origCalledNum_present_660004667=0
      FINSI
    FINSI
    SI (origCalledNum_present_660004667)
    ALORS
# --- Valorisation avec le champ origCalledNum
      indice_champ_valo_660004667 = $Tterm_nss9::origCalledNum
    SINON
# --- Valorisation avec le champ callingNumber
      indice_champ_valo_660004667 = $Tterm_nss9::callingNumber
    FINSI
  FINSI
SINON
# --- Valorisation classique avec le champ callingNumber
  indice_champ_valo_660004667 = $Tterm_nss9::callingNumber
FINSI

SI (i_valid_field_n(g_iartin,indice_champ_valo_660004667))
ALORS
  erreur_660004667 = i_ajout_tlv(g_iartout,"T3t2","")
# --- Valorisation du champ idpart
  SI ( i_get_art_field(g_iartin, indice_champ_valo_660004667-1) == 2)
  ALORS
    SI ( (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004667, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004667, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004667, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, indice_champ_valo_660004667, 3) == 0x0f) )
    ALORS
# Cas Appelant = 0 (on utilise l'automate specifique pour la normalisation)
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004667,$Tdpvgsm::idpart,-$NORM:MET_ASN1_410,0)

    SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
      SI (is_roamers_660004667)
      ALORS
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004667,$Tdpvgsm::idpart,-$NORM:ROAMERS_IDPART,0)

      SINON
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004667,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242, 0)

      FINSI
    FINSI
  SINON
# Cas Normal (on utilise l'automate de base pour la normalisation)
    SI (is_roamers_660004667)
    ALORS
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004667,$Tdpvgsm::idpart,-$NORM:ROAMERS_IDPART,0)
    SINON
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,indice_champ_valo_660004667,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242, 0)
    FINSI
  FINSI
  SI ( erreur_660004667 != 0)
  ALORS
    trace("Erreur duplication champ idpart")
    ERREUR_660004667 = ERR_NORM_660004667
    code_rejet_660004667 = MODULE_660004667 + ERREUR_660004667 + EFFICACE_660004667
    erreur_660004667 = i_PlvMessEmettre(8396,2,g_iartout12,"",2, code_rejet_660004667,"idpart",0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

#####################################################################
# 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_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#####################################################################
# Traitement du champ origine
#
#####################################################################
SI (i_valid_field_n(g_iartin,$Tterm_nss9::intIncomingCall))
ALORS
  SI (i_get_art_field(g_iartin,$Tterm_nss9::intIncomingCall) == 1)
  ALORS
    erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::origine,1)
  FINSI
FINSI

#####################################################################
# Traitement du system type
#
#####################################################################
SI (i_valid_field_n(g_iartin,$Tterm_nss9::rNCidOf1stRNC))
ALORS
  erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::systype,0x01)
FINSI

###################################################################
# MAJ du V3t1.9
###################################################################
SI (i_valid_field_n(g_iartin,$Tterm_nss9::1stRdioChnlUsed) == 0)
ALORS
  erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::support1, 0x00)
FINSI

#################################################################
# MAJ du V3t1.14 QC1232
################################################################
SI (i_valid_field_n(g_iartin,$Tterm_nss9::disconnectParty))
ALORS
  res_660004667 = i_get_art_field(g_iartin,$Tterm_nss9::disconnectParty)
  SI (res_660004667 == 0 || res_660004667 == 1)
  ALORS
    erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x00)
  SINON
    SI (res_660004667 == 2)
    ALORS
      erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0x01)
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement du champ portOrigNet (T3t6)
#
#####################################################################
# --- On verifie que le champ origLocNumber est present
origLocNum_present_660004667 = i_valid_field_n(g_iartin, $Tterm_nss9::origLocNumber)
SI (origLocNum_present_660004667)
ALORS
  SI (i_get_art_field(g_iartin, $Tterm_nss9::origLocNumber-1) == 0)
  ALORS
    origLocNum_present_660004667 = 0
  FINSI
FINSI

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004667)
ALORS
#        SI (i_get_field_osize(g_iartin, $Tterm_nss9::origLocNumber) >= 2)
  SI (i_get_art_field(g_iartin, $Tterm_nss9::origLocNumber -1) >= 2)
  ALORS
    TON_origLocNum_660004667 = i_get_art_fieldtab(g_iartin, $Tterm_nss9::origLocNumber, 0)
    NPI_origLocNum_660004667 = i_get_art_fieldtab(g_iartin, $Tterm_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_660004667 == 4) && (NPI_origLocNum_660004667 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004667 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tterm_nss9::origLocNumber,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004667 != 0 )
      ALORS
        trace("Erreur duplication champ portOrigNet")
        ERREUR_660004667 = ERR_DUPL_660004667
        code_rejet_660004667 = MODULE_660004667 + ERREUR_660004667 + EFFICACE_660004667
        erreur_660004667 = i_PlvMessEmettre(8396,2,g_iartout12,"",2, code_rejet_660004667,"portOrigNet",0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement du champ transporteur entrant
#
#####################################################################
#
# ---- Duplication du champ transporteur Entrant
#
tailleChpTrans_660004667 = i_get_art_field(g_iartin,($Tterm_nss9::incomingRoute-1))

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

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

#####################################################################
# Prise en compte du champ "service support":
# Si teleservice == 0xff et service support renseigne
#   -> on renseigne teleservice pour la valorisation et le CTDC
#####################################################################
tlserv_mod_660004667 = 0
gsmTlSrv_660004667 = i_get_art_field(g_iartin,$Tterm_nss9::teleServiceCode)

SI ((gsmTlSrv_660004667 & 0xff) == 0xff)
ALORS
  tlserv_mod_660004667 = 1
  svcsup_660004667 = i_get_art_field(g_iartout,$Tdpvgsm::svcsup)
  Q1_660004667 = svcsup_660004667 & 0xf0
  Q2_660004667 = svcsup_660004667 & 0x0f

  SI ((Q1_660004667 != 0x10) && (Q1_660004667 != 0x90))
  ALORS
    SAUT ERR_SVCSUP
  FINSI
  SI (Q2_660004667 && (Q2_660004667 < 0x07))
  ALORS
    vsvcsup_660004667 = 0x16
    SAUT OK_SVCSUP
  FINSI
  SI ((Q2_660004667 > 0x09) && (Q2_660004667 < 0x0f) && (Q2_660004667 != 0x0b))
  ALORS
    vsvcsup_660004667 = 0x1e
    SAUT OK_SVCSUP
  FINSI
  SI (Q2_660004667 == 0x07)
  ALORS
    vsvcsup_660004667 = 0x17
    SAUT OK_SVCSUP
  FINSI
  SI (Q2_660004667 == 0x0F)
  ALORS
    vsvcsup_660004667 = 0x1f
    SAUT OK_SVCSUP
  FINSI

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

  POINT   OK_SVCSUP
  erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,vsvcsup_660004667)
  erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::tlserv,vsvcsup_660004667)

FINSI

POINT   FIN_SVCSUP
#
# Remise a 0xff de tlserv dans le DPV
#
SI (tlserv_mod_660004667 == 1)
ALORS
  erreur_660004667 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0xff)
FINSI

###################################################################
# Ajout du champ T4t35.4 presenceInd
###################################################################
SI ( ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode1 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode2 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode3 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode4 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode5 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode6 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode7 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode8 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode9 ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tterm_nss9::sSCode10) == 0x51 ) )
ALORS
  erreur_660004667 = i_ajout_tlv(g_iartout,"T4t35.4","")
  erreur_660004667 = i_resize_tlv(g_iartout,"T4t35.4","presenceInd",1)
  erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::presenceInd,0x01)
FINSI

###################################################################
# Ajout du champ T3t37 CSDaddInfo
###################################################################
SI ( (i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x17 )
  ||(i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x1F) )
ALORS
  userRate_660004667     = 0x08
  userProtocol_660004667 = 0x04
SINON
  userRate_660004667     = 0xFF
  userProtocol_660004667 = 0xFF
FINSI

transIndicator_present_660004667 = i_valid_field_n(g_iartin,$Tterm_nss9::transIndicator)

SI ( transIndicator_present_660004667 )
ALORS
  tranInd_660004667 = i_get_art_field(g_iartin,$Tterm_nss9::transIndicator)
# correction FO 426 : transInd si pr?sent
SINON
  SI ( (i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x17 )
    ||(i_get_art_field(g_iartout, $Tdpvgsm::svcsup) == 0x1F) )
  ALORS
    tranInd_660004667 = 0x00
  SINON
    tranInd_660004667 = 0xFF
  FINSI

FINSI

SI ( (userRate_660004667 != 0xFF) || (userProtocol_660004667 != 0xFF) || (tranInd_660004667 != 0xFF) )
ALORS
  erreur_660004667 = i_ajout_tlv(g_iartout,"T3t37","")
  erreur_660004667 = i_resize_tlv(g_iartout,"T3t37","CSDaddInfo",3)
  CSDaddValue_660004667 = userRate_660004667*0x10000 + userProtocol_660004667*0x100 + tranInd_660004667
  erreur_660004667 = i_set_art_field(g_iartout,$Tdpvgsm::CSDaddInfo,CSDaddValue_660004667)
FINSI

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

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

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

##########################################################
#G3R3 lot2 mapping ABC ajout du T3T63 (LastCallingNb)
##########################################################
redirectNumber_present_660004667 = i_valid_field_n(g_iartin,$Tterm_nss9::redirectNumber)
SI (redirectNumber_present_660004667)
ALORS
  SI (i_get_art_field(g_iartin,$Tterm_nss9::redirectNumber-1) == 0)
  ALORS
    redirectNumber_present_660004667=0
  FINSI
FINSI

SI (redirectNumber_present_660004667)
ALORS
  erreur_660004667 = i_ajout_tlv(g_iartout,"T3t63","")
  SI (i_get_art_field(g_iartin, $Tterm_nss9::redirectNumber-1) == 2)
  ALORS
    SI ((i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 3) == 0x0f) )
    ALORS
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)

      #QC925
      SI ( erreur_660004667 != 0)
      ALORS
        trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
        SAUT Normal1
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      FINSI

    SINON
      SI (is_roamers_660004667)
      ALORS
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
      SINON
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

      #QC925
      SI ( erreur_660004667 != 0)
      ALORS

        trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        SAUT Normal1
      FINSI

    FINSI
  SINON
    SI (is_roamers_660004667)
    ALORS
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
    SINON
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI

    #QC925
    SI ( erreur_660004667 != 0)
    ALORS

      trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      SAUT Normal1
    FINSI

  FINSI
SINON

  POINT Normal1
  origCalledNum_present_660004667 = i_valid_field_n(g_iartin,$Tterm_nss9::origCalledNum)
  SI (origCalledNum_present_660004667)
  ALORS
    SI (i_get_art_field(g_iartin,$Tterm_nss9::origCalledNum-1) == 0)
    ALORS
      origCalledNum_present_660004667 = 0
    FINSI
  FINSI

  SI (origCalledNum_present_660004667)
  ALORS
    SI (!i_valid_field_n(g_iartout,$Tdpvgsm::LastCallingNb))
    ALORS
      erreur_660004667 = i_ajout_tlv(g_iartout,"T3t63","")
    FINSI

    SI (i_get_art_field(g_iartin, $Tterm_nss9::origCalledNum-1) == 2)
    ALORS
      SI ((i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, $Tterm_nss9::origCalledNum, 3) == 0x0f) )
      ALORS
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::origCalledNum,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
        SI ( erreur_660004667 != 0)
        ALORS

          trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          SAUT Normal2
        FINSI

      SINON
        SI (is_roamers_660004667)
        ALORS
          erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::origCalledNum,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
        SINON
          erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::origCalledNum,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        FINSI

        #QC925
        SI ( erreur_660004667 != 0)
        ALORS

          trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          SAUT Normal2
        FINSI
      FINSI
    SINON
      SI (is_roamers_660004667)
      ALORS
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::origCalledNum,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
      SINON
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::origCalledNum,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

      #QC925
      SI ( erreur_660004667 != 0)
      ALORS

        trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        SAUT Normal2
      FINSI

    FINSI
  SINON
    POINT Normal2
    SI (i_valid_field_n(g_iartin,$Tterm_nss9::callingNumber))
    ALORS
      SI (!i_valid_field_n(g_iartout,$Tdpvgsm::LastCallingNb))
      ALORS
        erreur_660004667 = i_ajout_tlv(g_iartout,"T3t63","")
      FINSI

      SI (i_get_art_field(g_iartin, $Tterm_nss9::callingNumber-1) == 2)
      ALORS
        SI((i_get_art_fieldtab(g_iartin, $Tterm_nss9::callingNumber, 0) == 4) &&
          (i_get_art_fieldtab(g_iartin, $Tterm_nss9::callingNumber, 1) == 1) &&
          (i_get_art_fieldtab(g_iartin, $Tterm_nss9::callingNumber, 2) == 0) &&
          (i_get_art_fieldtab(g_iartin, $Tterm_nss9::callingNumber, 3) == 0x0f) )
        ALORS
          erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::callingNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
          #QC925
          SI ( erreur_660004667 != 0)
          ALORS
            trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
            #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          FINSI

        SINON
          SI (is_roamers_660004667)

          ALORS
            erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::callingNumber,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
          SINON
            erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::callingNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
          FINSI

          #QC925
          SI ( erreur_660004667 != 0)
          ALORS
            trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
            #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          FINSI

        FINSI
      SINON
        SI (is_roamers_660004667)
        ALORS
          erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::callingNumber,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS_IDPART,0)
        SINON
          erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::callingNumber,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        FINSI

        #QC925
        SI ( erreur_660004667 != 0)
        ALORS
          trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI

      FINSI
    FINSI
  FINSI
FINSI

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

SI (redirectNumber_present_660004667)
ALORS
  erreur_660004667 = i_ajout_tlv(g_iartout,"T3t64","")
  SI ( i_get_art_field(g_iartin, $Tterm_nss9::redirectNumber-1) == 2)
  ALORS
    SI ((i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, $Tterm_nss9::redirectNumber, 3) == 0x0f) )
    ALORS
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_410,0)

      #QC925
      SI ( erreur_660004667 != 0)
      ALORS
        trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t64 RedirectingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t64", "")
      FINSI

    SINON
      SI (is_roamers_660004667)
      ALORS
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:ROAMERS_IDPART,0)
      SINON
        erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

      #QC925
      SI ( erreur_660004667 != 0)
      ALORS
        trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t64 RedirectingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t64", "")
      FINSI

    FINSI
  SINON

    SI (is_roamers_660004667)
    ALORS
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:ROAMERS_IDPART,0)
    SINON
      erreur_660004667 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tterm_nss9::redirectNumber,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI

    #QC925
    SI ( erreur_660004667 != 0)
    ALORS
      trace("Tterm_nss9: Erreur de duplication + normalisation  du champ T3t64 RedirectingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t64", "")
    FINSI

  FINSI
FINSI

#/G3R3 lot2 mapping ABC

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

erreur_660004667 = aiguillage2_660004590 (g_iartout12, g_iartout,DISTRIBUTION_INCONNU_660004667, Multidistribution_Non_660004667)
SI (erreur_660004667 == TRAI_KO_660004667)
ALORS
# QC1005
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur = i_PlvMessEmettre(8397,2,g_iartout12,"",1,code_rejet,0,0)
  SAUT STOCKE_ERRONE
FINSI

trace("Tterm_nss9 : Fin traitement OK")
RETOUR TRAIT_OK

POINT STOCKE_ERRONE
trace("Tterm_nss9 : Fin distribution, stockage en ERRONE")
erreur_660004667 = i_make_art_rej(g_iartout12, g_iartout11, code_rejet_660004667)
erreur_660004667 = i_stocke_art(g_iartout11,0,PT_ERRONE, 0)
RETOUR TRAIT_OK
#------------------------------Fin Tterm_nss9_dis.src -------------------------------
