DEFINITION C_ZB_1133600DOT_660004671 1
DEFINITION C_ZB_XX600DOT_660004671 2
DEFINITION DUP_TAB_NORMITINERIS_660004671 0
DEFINITION DUP_TAB_NORMROAMERS_660004671 1
DEFINITION DUP_TAB_NORMTGROUPE_660004671 3
DEFINITION DUP_TAB_ECHECNORM_660004671 4
DEFINITION DUP_TAB_NORMITINERIS_VPN_660004671 15
DEFINITION DUP_TAB_NORMROAMERS_VPN_660004671 16
DEFINITION DUP_TAB_NORMITINERIS_SDETR_VPN_660004671 17
DEFINITION DUP_TAB_NORMROAMERS_SDETR_VPN_660004671 18
DEFINITION DUP_TAB_NORMITINERIS_SDETR_660004671 9
DEFINITION DUP_TAB_NORMROAMERS_SDETR_660004671 10
DEFINITION DUP_TAB_NORMTGROUPE_SDETR_660004671 12
DEFINITION DUP_TAB_ECHECNORM_SDETR_660004671 13
DEFINITION DUP_TAB_NORM_TR_660004671 19
DEFINITION DUP_TAB_NORM_TR08_660004671 20
DEFINITION Type02_660004671 02
DEFINITION Type06_660004671 06
DEFINITION Multidistribution_Non_660004671 0
DEFINITION Multidistribution_Oui_660004671 1
DEFINITION DISTRIBUTION_INCONNU_660004671 1
DEFINITION TRAI_KO_660004671 -1
DEFINITION MODULE_DISTR_660004671 0xA000
DEFINITION ERR_NORM_660004671 0x010
DEFINITION ERR_VALO_660004671 0x020
DEFINITION ERR_DUPL_660004671 0x0D0
DEFINITION ERR_CROISE_660004671 0x0F0
DEFINITION ERR_DISTR_660004671 0x110
DEFINITION RNSAC_660004671 "RoutinNumberSac"
REGISTRE ENTIER Flag_ZB_660004671
REGISTRE POINTEUR pt_champ_660004671
REGISTRE ENTIER Prefix_index_660004671
REGISTRE ENTIER Type_TcompCFWD_660004671
REGISTRE ENTIER flag_rdt_660004671
REGISTRE POINTEUR pt_outgoingRouteTR_660004671
REGISTRE POINTEUR pt_TYPE_COMPOSITE_660004671
REGISTRE ENTIER valPositionMO1_660004671
REGISTRE ENTIER valPositionMO2_660004671
REGISTRE ENTIER valPositionCF1_660004671
REGISTRE ENTIER valPositionCF2_660004671
REGISTRE ENTIER valPositionIC1_660004671
REGISTRE ENTIER valPositionIC2_660004671
REGISTRE ENTIER valPositionIC3_660004671
REGISTRE ENTIER valPositionIC4_660004671
REGISTRE ENTIER valPositionIC5_660004671
REGISTRE ENTIER valPositionOC1_660004671
REGISTRE ENTIER valPositionOC2_660004671
REGISTRE ENTIER valPositionOC3_660004671
REGISTRE ENTIER valPositionOC4_660004671
REGISTRE ENTIER valPositionOC5_660004671
REGISTRE ENTIER valPositionTR1_660004671
REGISTRE ENTIER valPositionTR2_660004671
REGISTRE ENTIER valPositionTR3_660004671
REGISTRE ENTIER valPositionTR4_660004671
REGISTRE ENTIER valPositionTR5_660004671
REGISTRE ENTIER valPositionRCF1_660004671
REGISTRE ENTIER valPositionRCF2_660004671
REGISTRE ENTIER valPositionMST1_660004671
REGISTRE ENTIER valPositionMST2_660004671
REGISTRE ENTIER valPositionSMO1_660004671
REGISTRE ENTIER valPositionSMO2_660004671
REGISTRE ENTIER valPositionSMT1_660004671
REGISTRE ENTIER valPositionSMT2_660004671
REGISTRE ENTIER valPositionSSP1_660004671
REGISTRE ENTIER valPositionSSP2_660004671
REGISTRE ENTIER valPositionISO1_660004671
REGISTRE ENTIER valPositionISO2_660004671
REGISTRE ENTIER valPositionISC1_660004671
REGISTRE ENTIER valPositionISC2_660004671
REGISTRE ENTIER erreur_660004671
REGISTRE ENTIER is_roamers_660004671
REGISTRE ENTIER indice_duptab_660004671
REGISTRE ENTIER TON_660004671
REGISTRE ENTIER NPI_660004671
REGISTRE ENTIER pseudo_DPV_660004671
REGISTRE ENTIER RoutingNumberVal_660004671
REGISTRE ENTIER RoutingNumberVal_0_660004671
REGISTRE ENTIER RoutingNumberValCF_660004671
REGISTRE ENTIER RoutingNumberValSDETR_660004671
REGISTRE ENTIER RoutingNumberRedirectVal_660004671
REGISTRE ENTIER RoutingNumberError_660004671
REGISTRE ENTIER RoutingNumberTmpVal_660004671
REGISTRE ENTIER RoutingNumberLong_660004671
REGISTRE ENTIER RoutingNumberTON_660004671
REGISTRE ENTIER RoutingNumberNPI_660004671
REGISTRE ENTIER RoutingNumberCC1_660004671
REGISTRE ENTIER RoutingNumberCC2_660004671
REGISTRE ENTIER tlserv_mod_660004671
REGISTRE ENTIER gsmTlSrv_660004671
REGISTRE ENTIER svcsup_660004671
REGISTRE ENTIER Q1_660004671
REGISTRE ENTIER Q2_660004671
REGISTRE ENTIER vsvcsup_660004671
REGISTRE ENTIER ZBPrefixVal_660004671
REGISTRE ENTIER ZBPrefixValCF_660004671
REGISTRE ENTIER ZBPrefixValSDETR_660004671
REGISTRE ENTIER ZBPrefixLong_660004671
REGISTRE ENTIER ZBPrefixDigitD_660004671
REGISTRE ENTIER ZBPrefixDigitO_660004671
REGISTRE ENTIER ZBPrefixDigitT_660004671
REGISTRE ENTIER ZBPrefixDigitSDETRD_660004671
REGISTRE ENTIER ZBPrefixDigitSDETRO_660004671
REGISTRE ENTIER ZBPrefixDigitSDETRT_660004671
REGISTRE ENTIER ZBPrefixDigitCFD_660004671
REGISTRE ENTIER ZBPrefixDigitCFO_660004671
REGISTRE ENTIER ZBPrefixDigitCFT_660004671
REGISTRE ENTIER ZBPrefixTransD_660004671
REGISTRE ENTIER ZBPrefixTransO_660004671
REGISTRE ENTIER ZBPrefixTransT_660004671
REGISTRE ENTIER ZBPrefixTrans_660004671
REGISTRE ENTIER TON_origLocNum_660004671
REGISTRE ENTIER NPI_origLocNum_660004671
REGISTRE ENTIER origLocNum_present_660004671
REGISTRE ENTIER origLocatNum_present_660004671
REGISTRE ENTIER serviceKey_present_660004671
REGISTRE ENTIER OICK_present_660004671
REGISTRE ENTIER digit1_660004671
REGISTRE ENTIER digit2_660004671
REGISTRE ENTIER digit3_660004671
REGISTRE ENTIER digit4_660004671
REGISTRE ENTIER digit5_660004671
REGISTRE ENTIER dig3_660004671
REGISTRE ENTIER val_OICK_660004671
REGISTRE ENTIER flag_rm_escape_char_660004671
REGISTRE ENTIER calledNumber_present_660004671
REGISTRE ENTIER calledNumber_TR1_present_660004671
REGISTRE ENTIER calledNumber_TR2_present_660004671
REGISTRE ENTIER gSMCallRefNum_present_660004671
REGISTRE ENTIER mSCaddress_present_660004671
REGISTRE ENTIER CAMEL_SCFAdr_present_660004671
REGISTRE ENTIER CAMEL_servkey_present_660004671
REGISTRE ENTIER CAMEL_initCF_present_660004671
REGISTRE ENTIER taille_660004671
REGISTRE ENTIER indice_660004671
REGISTRE ENTIER indice_idpart_660004671
REGISTRE ENTIER indice_called_660004671
REGISTRE ENTIER Digit_660004671
REGISTRE ENTIER val_660004671
REGISTRE ENTIER ic_660004671
REGISTRE ENTIER taille_idpart_660004671
REGISTRE ENTIER tailleChpTrans_660004671
REGISTRE ENTIER taillegSMCallRefNum_660004671
REGISTRE ENTIER nbum_660004671
REGISTRE ENTIER nbut_660004671
REGISTRE ENTIER userRate_660004671
REGISTRE ENTIER userProtocol_660004671
REGISTRE ENTIER transIndicator_present_660004671
REGISTRE ENTIER tranInd_660004671
REGISTRE ENTIER CSDaddValue_660004671
REGISTRE ENTIER calltype_660004671
REGISTRE ENTIER lg_calledNumber_660004671
REGISTRE ENTIER coLocated_IC_present_660004671
REGISTRE ENTIER pointCSSNum_IC_present_660004671
REGISTRE ENTIER globalTitle_IC_present_660004671
REGISTRE ENTIER globalTSSNum_IC_present_660004671
REGISTRE ENTIER indice_chp_origLocNb_660004671
REGISTRE ENTIER res_660004671
REGISTRE ENTIER taille_chp_660004671
REGISTRE ENTIER date_660004671
REGISTRE ENTIER date_audit_660004671
REGISTRE ENTIER VALO_IDPART_3N_660004671
REGISTRE ENTIER date_audit_gmt_660004671
REGISTRE ENTIER ic_idpartTransit_660004671
REGISTRE ENTIER Prexf1_660004671
REGISTRE ENTIER Prexf2_660004671
REGISTRE ENTIER Prexf3_660004671
REGISTRE ENTIER Prexf4_660004671
REGISTRE ENTIER PREFIXJoig_660004671
REGISTRE ENTIER Length_calledNumberCF_660004671
REGISTRE ENTIER Length_calledNumberTR_660004671
REGISTRE ENTIER FlagNat_660004671
REGISTRE ENTIER FlagInter_660004671
REGISTRE ENTIER long_660004671
REGISTRE ENTIER PREFIXJoigTR0_660004671
REGISTRE ENTIER Length_calledNumberTR0_660004671
REGISTRE ENTIER OrigCalledNumTR_Present_660004671
REGISTRE ENTIER OrigCalledNumTRLong_660004671
REGISTRE POINTEUR pt_calledNumberCF_660004671
REGISTRE POINTEUR pt_PrefixJoing_660004671
REGISTRE POINTEUR pt_portjoing_660004671
REGISTRE POINTEUR pt_PrefixJoingDCB_660004671
REGISTRE POINTEUR pt_calledNumberTR_660004671
REGISTRE POINTEUR pt_calledNumberTR0_660004671
REGISTRE POINTEUR pt_PrefixJoingTR0_660004671
REGISTRE POINTEUR pt_portjoingTR0_660004671
REGISTRE POINTEUR pt_porta_660004671
REGISTRE POINTEUR pt_temp1_660004671
REGISTRE POINTEUR pt_temp2_660004671
REGISTRE POINTEUR pt_CellID_OF_660004671
REGISTRE ENTIER flag_freeFormatData_660004671
REGISTRE ENTIER val_Key_660004671
REGISTRE ENTIER typeCRA_660004671
REGISTRE ENTIER ZBPrefixTR1_8_660004671
REGISTRE ENTIER redirectNumCF_present_660004671
REGISTRE ENTIER redirectNumTR_present_660004671
REGISTRE ENTIER ITInerant_660004671
REGISTRE ENTIER Prefix_SVA_660004671
REGISTRE ENTIER position_660004671
REGISTRE ENTIER longueur_660004671
REGISTRE POINTEUR str_exchasciiTR_660004671
REGISTRE POINTEUR str_exchasciiMO_660004671
REGISTRE POINTEUR str_exchasciiCF_660004671
REGISTRE POINTEUR str_exchDCBTR_660004671
REGISTRE POINTEUR str_exchDCBMO_660004671
REGISTRE POINTEUR str_exchDCBCF_660004671
REGISTRE ENTIER IMSI_OrangeCo_660004671
REGISTRE POINTEUR str_MNC_660004671
REGISTRE POINTEUR str_IMSIMO_660004671
REGISTRE POINTEUR str_IMSICF_660004671
REGISTRE POINTEUR str_conteneur_660004671
REGISTRE POINTEUR pt_TN1_660004671
REGISTRE POINTEUR pt_TN2_660004671
REGISTRE POINTEUR str_Camel_660004671
REGISTRE ENTIER date_cra_660004671
REGISTRE ENTIER val_Camel_660004671
REGISTRE POINTEUR str_calledNumberTR_660004671
REGISTRE POINTEUR str_calledNumberTRtmp_660004671
REGISTRE POINTEUR str_calledNumberTR2_660004671
REGISTRE POINTEUR str_calledNumberTRtmp2_660004671
REGISTRE ENTIER isVPN_660004671
REGISTRE ENTIER date_fin_660004671
REGISTRE POINTEUR pt_cleVPN_660004671
REGISTRE ENTIER code_rejet_660004671
REGISTRE ENTIER EFFICACE_660004671
REGISTRE ENTIER MODULE_660004671
REGISTRE ENTIER ERREUR_660004671
REGISTRE POINTEUR pt_CleRoutingNumberSAC_660004671
REGISTRE ENTIER b_IMSIMO1_ORANGE_660004671
REGISTRE ENTIER b_IMSICF1_ORANGE_660004671
REGISTRE ENTIER b_RechTableCellID_OF1_660004671
REGISTRE ENTIER ZBPrefixDigitTRTRD_660004671
REGISTRE ENTIER ZBPrefixDigitTRTRO_660004671
REGISTRE ENTIER ZBPrefixDigitTRTRT_660004671
REGISTRE ENTIER ZBPrefixValTRTR_660004671
REGISTRE POINTEUR pt_portabilite_660004671
REGISTRE POINTEUR pt_ITInerant_660004671
REGISTRE POINTEUR pt_ITInerantDCB_660004671
REGISTRE POINTEUR pt_PrefixeSVA_660004671
REGISTRE POINTEUR pt_PrefixesvaDCB_660004671
REGISTRE ENTIER Service_SDETR_660004671
REGISTRE ENTIER Service_CFWD_660004671
REGISTRE ENTIER MARQUE_TN_660004671
REGISTRE ENTIER RoutingNumberVal_N_660004671
REGISTRE ENTIER ic_calledNumberTR_660004671
REGISTRE ENTIER ic_outgoingRouteTR_660004671
REGISTRE ENTIER ZBPrefixVal_N_660004671
REGISTRE ENTIER Flag_ZBTR2_660004671
REGISTRE ENTIER Flag_ZBTR1_660004671
REGISTRE ENTIER Flag_ZBTR3_660004671
REGISTRE ENTIER Flag_itin2_660004671
REGISTRE ENTIER Flag_itin1_660004671
REGISTRE ENTIER Flag_ZBCFWD_CF1_660004671
REGISTRE ENTIER valTerm_660004671
REGISTRE ENTIER ZBPrefixDigitN_D_660004671
REGISTRE ENTIER ZBPrefixDigitN_O_660004671
REGISTRE ENTIER ZBPrefixDigitN_T_660004671
REGISTRE ENTIER calledNumber_TR3_present_660004671
REGISTRE ENTIER calledNumber_TR4_present_660004671
REGISTRE ENTIER calledNumber_TR5_present_660004671
REGISTRE POINTEUR str_calledNumberTR3_660004671
REGISTRE POINTEUR str_calledNumberTR4_660004671
REGISTRE POINTEUR str_calledNumberTR5_660004671
REGISTRE POINTEUR str_calledNumberTRtmp3_660004671
REGISTRE POINTEUR str_calledNumberTRtmp4_660004671
REGISTRE POINTEUR str_calledNumberTRtmp5_660004671
REGISTRE POINTEUR pt_TN3_660004671
REGISTRE POINTEUR pt_TN4_660004671
REGISTRE POINTEUR pt_TN5_660004671
REGISTRE POINTEUR pt_Prefixitin_660004671
REGISTRE ENTIER date_table_660004671
REGISTRE ENTIER bT3T8ITX_660004671
REGISTRE POINTEUR ptr_valeurDATE_660004671
REGISTRE POINTEUR ptr_date_res_660004671
####################################################################
#       pcode : Tcomp_nss9_dis.src
#
# AE 24/08/05 Creation
# 22/01/2008 - PSA - G1R6 - modification du traitement du prefixe Routing Number
#       emission des composites transit
# 07/02/2008 - PSA - G1R6 - FO 638 generation de tterm a partir de disconnpartyTR pour le Transit
#     FO 637 bourrage a F du dernier digit de IMSI pour le Transit
# 18/02/2008 - PSA - G1R6 - FO 643, 644, 645, 646, 647 et 648 generation du T3t3 pour le TRANSIT
# 20/02/2008 - PKH - G1R6 lot3 generation cra 0x08 type TRANSIT
# 22/02/2008 - PSA - G1R6 - modif T3t2 pour TRANSIT type 06
# 27/02/2008 - PKH - G1R6 FO 653 Correction de la sortie V3t12 dans le cas type TR 0x08
# 27/02/2008 - PKH - G1R6 FO 654 Correction de la sortie V3T1.14 dans le cas type TR 0x08
# 21/03/2008 - PKH - G1R6 lot4 Alimentation de champ GDCB (V3t57)du tdpvgsm par la valeur ZB sortante
# alimenter le champ V3t12 par T3t5TR2 et non TR1 et modification de l'alimentation du champ V3t34 pour la ZB entrante
# 23/05/2008 - FAL - G1R8 Appel urgence 112
# 13/08/2008 - THE - Param ME-G1R9
# 15/09/2008 - JLG - G1R8 QC196
# 19/09/2008 - THE - G1R8 QC187,200,201,208
# 24/10/2008 - JLG - G2R1 Item : CRAs composite en roaming IN
# 20/11/2008 - JLG - report correction G2R1 lot1 : QC253
# 24/12/2008 - PKJLG- QC288 enrichissement alarme 8518
# 02/04/2009 -DRE/PSA -  G2R2 : Offre kiosque visio
# 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
# 24/08/2009 - PKH - G2R3 - Correction QC396
# 11/01/2010 THEJLG G2R6 lot2 : ajout composites MSOTR et TRTR
# 21/01/2010 - JLG - G2R6 - evol, QC534 : IMSI <> 20801 comme au GSMCE au lieu de <> 208
# 26/01/2010 - JLG - G2R6 QC540, 541, 544 (evolution spec), 549
# 18/02/2010 - JLG - G2R6 QC561 MSOTR champ V3t2 idpart mal alimente
# 18/05/2010 - JLG - G3R1 QC567
# 17/06/2010 - JLG - G3R1 integration G2R6C800 : appel fonction aiguillage2, creation enveloppe E_Redistri2, ajout champ T3t55 (GFlag2) et T3t56 (GValue)
# 10/09/2010 - JLG - G3R1 QC664 composite TR type 6, idpart=CallingNumTR si present sinon absent
# 22/11/2010 - JLG - G3R1lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 10/03/2011 - JLG - G3R2C4 fusion G3R1C600 avec G3R2C3 ( modification alimentation champ T3t99  DPV 4.0)
# 25/03/2011 - PKH - G3R3 lot2 Mapping ABC ajout champs T3t63 et T3t64 dpvgsm
# 29/04/2011 - PKH - QC834 ajout test sur la presence effective d une ZB  avant ajout du champ T3t57
# 02/02/2011 - PKH - QC859 correction Composite CFWD type 02 et type 06 mauvaise alimentation du V3t63 pour Mapping ABC
# 02/05/2011 - PKH - QC860 correction Pseudo Ddpvgsm composite CFWD absence de valorisation des informations T3t63 et T3t64 sur l'enregistrement de type 01.
# 02/05/2011 - PKH - QC861 correction  Composite TRTR type 06 genere avec V3t64 a zero pour mapping ABC
# 06/06/2011 - PKH - QC879 G3R3 Lot3 Curling_Free
# 07/07/2011 - PKH - G3R4 lot1  Prefixe de routage SVA pour CRA 0x08
# 10/08/2011 - PKH - G3R4 QC910 libelle V3t70 PrefixeSVA au lieu de PrefixeSAV
# 11/08/2011 - PKH - G3R4 QC906 DC Ericsson TcompTR et MSOTR : ne pas restituer V3t70 ou V3t12 si T3t5TR2/T4t5.3/calledNumberTR n'a pas le prefixe sva
# 06/09/2011 - JLG - G3R4 QC925 evol champs V3t63, V3t64 suppression des envois vers errones si echec de normal.
# 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 du code MNC pour les MVNOs Lights
# 29/10/2012 - PKH - G3R8 lot2 Prefix de joignabilite
# 12/11/2012 - PKH - G3R8 lot3 Correction Mapping ABC Reiterer la normalisation avec les champs candidats
# 21/11/2012 - PKH - G3R8 lot3 QC1142 pour Composite CFWD ajout champ V3t70 si prefix joignabilite present
# 22/11/2012 - PKH - G3R8 lot3 QC1142 pour composite TR type 08 traitement du prefixe de joignabilite pour calledNumber_TR1
# 22/11/2012 - PKH - G3R8 lot3 QC1142  pour composite TRTR modifier le retour de l'interogation de RNSAC pour le prefix de portabilite
# 30/11/2012 - PKH - G3R8 lot3 QC1148 prenormalisation avant enrichissement du champ V3t63 avec OrigCalledNumTR
# 10/01/2013 - JLG - G3R9 lot1 QC1160 Permettre l'envoi d'un CRA TRANSIT type 8 quand champ entree absent pour  V3t2
# 10/01/2013 - JLG - G3R9 lot1 composite 6 elements TRTR et MSOTR
# 25/04/2013 - JLGPK G3R10 lot1
# 27/05/2013 - PKH G3R10 lot2 Prise en compte dun nouveau format de prefixe ditinerance
# 12/05/2013 - PKH QC1229 suppressions des f de bourrages pour le champ Tdpvgsm::lstSVCIN
# 03/07/2013 - JLG QC1234 evolution V4t11.2 lstSVCIN
# 15/07/2013 - PKH QC1245 Corrections sur les prefix de portabilite controle de longueur
# 17/07/2013 - G3R10 lot3 QC1232 : DPV FREE V3t9, MSC E// mapping donnee disconnectingParty - Correction V3t1.14/DPV4.0
# 26/07/2013 - G3R10 lot3 QC1252 (point 1,2 et 3 de la QC) Evol flux SDETR et CFWD DPV T3t11 + V4t11.1 li?s aux services
# 11/02/2014 - JLG - G5R1 QC1331, Built 3 : Changement Marque Audit
# 28/02/2014 - JLG - G5R1 QC1292, idemet
# 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)
# 05/09/2014 - JLG - G5R2 lot2 : QC1429  Composite Ericsson CFWD type 02, la recherche ZB pour calledNumberTR se fait, a tort,  apres le prefixe iti
# 10/09/2014 - JLG - G5R2 lot2 : QC1432 Composite TR, alimentation de V3t34 (ZBprefix), positionnement du booleen ZBPrefixTR1_8
# 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
# 28/10/2014 - JLG - correction prefixe porta suite NonReg G5R1/G5R2 (indice du champ longueur du calledNumberTR1 => calledNumberTR1 - 2 au lieu de calledNumberTR1 - 1)
# 10/11/2014 - JLG - G5R2C8 QC1455 : G5R2 : Correction QC1444/1292 cra TcompCFW02_nss9 Item ZB
# 22/12/2014 - JLG - QC1460 (contournement pcode, pb V3t64 valeurs residuelles)
###########################################################################################################

#
#G5R2 lot2
#






#
# Compteurs par ECC
#


#
# Declarations des variables
#

#Debut FE_0009





























#G3R8 lot2






#QC1142





#G3R3 lot2

#G3R3 Curling Free
#G3R4 lot1 Prefix sva






#G3R7 gestion des MVNOs lights






#G2R6
# /G2R6

#G3R3 Curling Free
#
#G3R4 lot1 prefix sva

# G3R10

#G3R10 lot2






#QC1455 G5R2C8 correction 
RoutingNumberVal_N_660004671 = -1

# /G3R10

# initialisations
#
pt_outgoingRouteTR_660004671 = "11223344556677"
pt_TYPE_COMPOSITE_660004671 = "0123456789"
pt_TN1_660004671 = "123123123123123"
pt_TN2_660004671 = "231231231231231"
str_calledNumberTR_660004671 ="11223344445555"
str_calledNumberTR2_660004671 ="11223344445566"
str_calledNumberTRtmp_660004671 ="11223344445557"
str_calledNumberTRtmp2_660004671 ="11223344445568"
str_Camel_660004671 = "-1111223344"
pt_cleVPN_660004671 ="2222233456567895678675"
pt_temp1_660004671 = "pt_temp10123456789012345678901234567890123456789012345678901234567890123456789"
pt_temp2_660004671 = "pt_temp201234567890pt_temp20123456789012"
pt_CleRoutingNumberSAC_660004671 = "pt_CleRoutingNumberSAC"

pt_CellID_OF_660004671 = "pt_CellID_OF01234567890123456789012345"
i_strcpy(pt_CellID_OF_660004671, "")

str_exchasciiTR_660004671 = "str_exchasciiTR87678767876787678767867876987788987987987987987987987987987"
str_exchDCBTR_660004671 = "str_exchDCBTR34543435434354345534345344355343435434534534534534534534534534"
str_exchDCBMO_660004671 = "str_exchDCBMO780037333999999999999999999999999999999999999999999999999999999"
str_exchasciiMO_660004671 = "str_exchasciiMO78003733388888888888888888888888888888888888888888888888888"
str_exchDCBCF_660004671   = "str_exchDCBCF7676767676767676767676767767676767676767676767676767676766767"
str_exchasciiCF_660004671 = "str_exchasciiCF191919191919191919191919191919191919191919191191919191919191"

pt_portabilite_660004671 = "pt_portabilite72727272277171717171717171711717171717711717171711717171717171"
pt_ITInerant_660004671   =   "pt_ITInerant92929293939393949494944994949494944949599595959595995959955959"
pt_ITInerantDCB_660004671 =  "pt_ITInerantDCB723723727372737277372377237273737723737237337373737273737333"
pt_PrefixeSVA_660004671 = "pt_PrefixSVA9595959595959595959595959595959595959595959595959595995595959595995"
pt_PrefixesvaDCB_660004671 = "pt_PrefixsvaDCB735735735735735735735735735735735735753735735735735735735735735"

str_MNC_660004671 = "str_MNC9123912391239123912391239123912391239123912391239123"
str_conteneur_660004671 = "str_conteneur73457347347347347374734737477374737473477374734773747337473743347"
str_IMSIMO_660004671 ="str_IMSIMO94569456945694569456945694569456945694569456945694569456945694569456945694569456"
str_IMSICF_660004671 ="str_IMSICF71234712347123471234712347123471234712347123471234712347123471234712347123471234"

pt_calledNumberCF_660004671 = "pt_calledNumberCF1234556677889998765544321123454566778890987654"
pt_PrefixJoing_660004671 = "pt_PrefixJoing55555555555555555555555"
pt_portjoing_660004671 = "pt_portjoing999999999999999999999999999"
pt_PrefixJoingDCB_660004671 = "pt_PrefixJoingDCB3893893893893893839383938938938938"
pt_calledNumberTR_660004671 = "pt_calledNumberTR79797979797979797979797979797977979979797979779"

pt_calledNumberTR0_660004671 = "pt_calledNumberTR0333333333333333333333333333333333333333333333"
pt_PrefixJoingTR0_660004671 = "pt_PrefixJoingTR05555555555555555555555555"
pt_portjoingTR0_660004671 = "pt_portjoingTR011111111111111111"
pt_porta_660004671 = "pt_porta876876876876876876876876876"

pt_TN3_660004671 = "454545454545454"
pt_TN4_660004671 = "565656565656565"
pt_TN5_660004671 = "787878787878787"
str_calledNumberTR3_660004671 = "4563736554373"
str_calledNumberTR4_660004671 = "0873245653098"
str_calledNumberTR5_660004671 = "9123287656742"
str_calledNumberTRtmp3_660004671 = "1787658767657"
str_calledNumberTRtmp4_660004671 = "1769870348474"
str_calledNumberTRtmp5_660004671 = "9871234544327"

pt_Prefixitin_660004671 = "pt_Prefixitin123456789"



Prexf1_660004671 = 0
Prexf2_660004671 = 0
Prexf3_660004671 = 0
Prexf4_660004671 = 0
PREFIXJoig_660004671 = 0
Length_calledNumberCF_660004671 = 0
Length_calledNumberTR_660004671 = 0
FlagNat_660004671 = 0
FlagInter_660004671 = 0
long_660004671 = 0

OrigCalledNumTR_Present_660004671 = 0
OrigCalledNumTRLong_660004671 = 0


#G3R10 lot2
Flag_ZBTR1_660004671 = 0
Flag_ZBTR2_660004671 = 0
Flag_ZBTR3_660004671 = 0
Flag_itin2_660004671 = 0
Flag_itin1_660004671 = 0
Flag_ZBCFWD_CF1_660004671 = 0
valTerm_660004671 = 0
ZBPrefixVal_N_660004671 = -1

is_roamers_660004671=0
b_IMSIMO1_ORANGE_660004671=0
b_IMSICF1_ORANGE_660004671=0
b_RechTableCellID_OF1_660004671=0

indice_duptab_660004671 = -1
isVPN_660004671=-1
EFFICACE_660004671 = 1
MODULE_660004671 = MODULE_DISTR_660004671
ERREUR_660004671 = 0
code_rejet_660004671 = 0
typeCRA_660004671 = 0
ZBPrefixTrans_660004671 = 0
ZBPrefixTR1_8_660004671 = 0
redirectNumCF_present_660004671 = 0
redirectNumTR_present_660004671 = 0
Prefix_SVA_660004671 = 0
IMSI_OrangeCo_660004671 = 0

Length_calledNumberTR0_660004671 = 0
PREFIXJoigTR0_660004671 = 0

#PKH ajout initialisation
RoutingNumberVal_660004671 = -1
RoutingNumberVal_0_660004671 = -1

#i_strcpy(pt_outgoingRouteTR,"")
i_strcpy(pt_TYPE_COMPOSITE_660004671,"")
i_strcpy(pt_temp1_660004671,"")
i_strcpy(pt_TN1_660004671,"")
i_strcpy(pt_TN2_660004671,"")
i_strcpy(str_Camel_660004671,"")
#i_strcpy(str_calledNumberTR,"")
i_strcpy(str_calledNumberTRtmp_660004671,"")
#i_strcpy(str_calledNumberTR2,"")
i_strcpy(str_calledNumberTRtmp2_660004671,"")
i_strcpy(pt_cleVPN_660004671,"")
i_strcpy(pt_CleRoutingNumberSAC_660004671,"")

i_strcpy (pt_portabilite_660004671,"")
i_strcpy (pt_ITInerant_660004671,"")
i_strcpy (pt_ITInerantDCB_660004671,"")

i_strcpy (pt_PrefixeSVA_660004671,"")
i_strcpy (pt_PrefixesvaDCB_660004671,"")

i_strcpy (str_MNC_660004671,"")
i_strcpy (str_IMSIMO_660004671,"")
i_strcpy (str_IMSICF_660004671,"")
i_strcpy (str_conteneur_660004671,"")


i_strcpy (pt_calledNumberCF_660004671,"")
i_strcpy (pt_PrefixJoing_660004671,"")
i_strcpy (pt_portjoing_660004671,"")
i_strcpy (pt_PrefixJoingDCB_660004671,"")
i_strcpy (pt_calledNumberTR_660004671,"")

i_strcpy(pt_calledNumberTR0_660004671,"")
i_strcpy(pt_PrefixJoingTR0_660004671,"")
i_strcpy(pt_portjoingTR0_660004671,"")

i_strcpy(pt_porta_660004671,"")

#G5R1
ptr_valeurDATE_660004671 ="ptr_valeurDATE0123456789"
ptr_date_res_660004671 ="ptr_date_res0123456789"
i_strcpy (ptr_valeurDATE_660004671,"")
i_strcpy (ptr_date_res_660004671,"")

# G5R2 lot2
pt_champ_660004671="pt_champ_1111111111111111111111"
i_strcpy(pt_champ_660004671, "")


##################################################################################
# Identification de la provenance de l'article
# flag_rdt : nb de passage en redistribution (lecture de l'enveloppe obligatoire)
##################################################################################

#Creation Conv_URS g_iartout9
erreur_660004671 = i_cree_art("Conv_URS",g_iartout9)

flag_rdt_660004671 = -1
flag_rdt_660004671 = i_LireRedistCpt()

SI (flag_rdt_660004671 == 0)
ALORS
  erreur_660004671 = i_add_opt( "E_Redistri2" )
FINSI
erreur_660004671 = i_set_attr_val_n( $E_Redistri2::EnvoiRedis, 0)


#
# variable fonctionnelle globale
#

# calcul de VALO_IDPART_3N
date_cra_660004671=i_get_art_field(g_iartin,$Tcomp_nss9::ddebut)
SI(i_get_tab_field("VariableContexte",date_cra_660004671,"VALO_IDPART_3N") != g_inull)
ALORS
  VALO_IDPART_3N_660004671 = 1
SINON
  VALO_IDPART_3N_660004671 = 0
FINSI

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

bT3T8ITX_660004671 = 0
date_table_660004671 = 0
SI(i_get_tab_field("VariableContexte",date_cra_660004671,"DATEFIN_ITX") == g_inull)
ALORS
  trace("DATEFIN_ITX Absent de la table VariableContexte -> msgITX present")
  bT3T8ITX_660004671 = 1
SINON
  i_strcpy(ptr_valeurDATE_660004671, i_get_tab_field("VariableContexte", date_cra_660004671, "DATEFIN_ITX"))
  i_get_sub_str(ptr_valeurDATE_660004671,2,-1,ptr_date_res_660004671)
  erreur_660004671 = i_cree_art("Conv_URS", g_iartout7)
  erreur_660004671 = i_set_art_str (g_iartout7,$Conv_URS::DATE,ptr_date_res_660004671)
  date_table_660004671 = i_get_art_field(g_iartout7, $Conv_URS::DATEN)
  trace1(" date_cra   = %d", date_cra_660004671)
  trace1(" date_table = %d", date_table_660004671)
  SI (date_cra_660004671 < date_table_660004671)
  ALORS
    trace("date_cra < date_table -> msgITX present")
    bT3T8ITX_660004671 = 1
  FINSI
FINSI

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


# FE_0028 comptabilisation des CRAs issus de la redistribution
date_fin_660004671=i_get_art_field(g_iartin,$Tcomp_nss9::dfin)
erreur_660004671= i_incr_redist_dist_660004265(date_fin_660004671)


valPositionMO1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionMO:0)
valPositionMO2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionMO:1)

valPositionCF1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionCF:0)
valPositionCF2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionCF:1)

valPositionIC1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_IC:0)
valPositionIC2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_IC:1)
valPositionIC3_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_IC:2)
valPositionIC4_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_IC:3)
valPositionIC5_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_IC:4)

valPositionOC1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_OC:0)
valPositionOC2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_OC:1)
valPositionOC3_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_OC:2)
valPositionOC4_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_OC:3)
valPositionOC5_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_OC:4)

valPositionTR1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionTR:0)
valPositionTR2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionTR:1)
valPositionTR3_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionTR:2)
valPositionTR4_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionTR:3)
valPositionTR5_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::positionTR:4)

valPositionRCF1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_RCF:0)
valPositionRCF2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_RCF:1)

valPositionMST1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_MST:0)
valPositionMST2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_MST:1)

valPositionSMO1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SMO:0)
valPositionSMO2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SMO:1)

valPositionSMT1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SMT:0)
valPositionSMT2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SMT:1)

valPositionSSP1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SSP:0)
valPositionSSP2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_SSP:1)

valPositionISO1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_ISO:0)
valPositionISO2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_ISO:1)

valPositionISC1_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_ISC:0)
valPositionISC2_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::position_ISC:1)


SI ( valPositionMO1_660004671  ==  0 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  == -1 && valPositionCF2_660004671  == -1
  && valPositionIC1_660004671  ==  1 && valPositionIC2_660004671  == -1 && valPositionOC1_660004671  ==  2 && valPositionOC2_660004671  == -1
  && valPositionTR1_660004671  ==  3 && valPositionTR2_660004671  == -1 && valPositionTR3_660004671  == -1 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
  && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
  && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
  && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
ALORS
  trace("Trait SDE")
  i_strcpy(pt_TYPE_COMPOSITE_660004671, "SDE")
  typeCRA_660004671=0x00
SINON
  #G3R10 suppression des tests IC2, OC2, TR2, TR3
  SI ( valPositionMO1_660004671  == -1 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  ==  0 && valPositionCF2_660004671  == -1
#   && valPositionIC1  ==  1 && valPositionIC2  == -1 && valPositionOC1  ==  2 && valPositionOC2  == -1
    && valPositionIC1_660004671  ==  1 && valPositionOC1_660004671  ==  2
#   && valPositionTR1  ==  3 && valPositionTR2  == -1 && valPositionTR3  == -1 && valPositionRCF1 == -1 && valPositionRCF2 == -1
    && valPositionTR1_660004671  ==  3 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
    && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
    && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
    && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
  ALORS
    trace("Trait CFWD")
    i_strcpy(pt_TYPE_COMPOSITE_660004671, "CFWD")
    typeCRA_660004671=0x02
    Type_TcompCFWD_660004671 = Type02_660004671
    SI (!i_valid_field_n(g_iartin, $Tcomp_nss9::mblStatRnbCF))
    ALORS
      typeCRA_660004671 = 0x06
      Type_TcompCFWD_660004671 = Type06_660004671
    FINSI
  SINON
    SI ( valPositionMO1_660004671  == -1 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  == -1 && valPositionCF2_660004671  == -1
      && valPositionIC1_660004671  ==  1 && valPositionIC2_660004671  == -1 && valPositionOC1_660004671  ==  2 && valPositionOC2_660004671  == -1
      && valPositionTR1_660004671  ==  0 && valPositionTR2_660004671  ==  3 && valPositionTR3_660004671  == -1 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
      && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
      && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
      && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
    ALORS
      trace("Trait TR")
      i_strcpy(pt_TYPE_COMPOSITE_660004671, "TR")
      typeCRA_660004671=0x06
    SINON
      #G3R10 suppression du test TR3
      SI ( valPositionMO1_660004671  ==  0 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  == -1 && valPositionCF2_660004671  == -1
        && valPositionIC1_660004671  ==  1 && valPositionIC2_660004671  ==  4 && valPositionOC1_660004671  ==  2 && valPositionOC2_660004671  ==  5
#       && valPositionTR1  ==  3 && valPositionTR2  ==  6 && valPositionTR3  == -1 && valPositionRCF1 == -1 && valPositionRCF2 == -1
        && valPositionTR1_660004671  ==  3 && valPositionTR2_660004671  ==  6 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
        && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
        && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
        && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
      ALORS
        trace("Trait SDETR")
        i_strcpy(pt_TYPE_COMPOSITE_660004671, "SDETR")
        typeCRA_660004671=0x00
#G2R6
      SINON
        SI ( valPositionMO1_660004671  ==  0 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  == -1 && valPositionCF2_660004671  == -1
          && valPositionIC1_660004671  ==  1 && valPositionIC2_660004671  == -1 && valPositionOC1_660004671  ==  2 && valPositionOC2_660004671  ==  4
          && valPositionTR1_660004671  ==  3 && valPositionTR2_660004671  ==  5 && valPositionTR3_660004671  == -1 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
          && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
          && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
          && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
        ALORS
          trace("Trait MSOTR")
          i_strcpy(pt_TYPE_COMPOSITE_660004671, "MSOTR")
          typeCRA_660004671=0x08
        SINON
          SI ( valPositionMO1_660004671  == -1 && valPositionMO2_660004671  == -1 && valPositionCF1_660004671  == -1 && valPositionCF2_660004671  == -1
            && valPositionIC1_660004671  ==  1 && valPositionIC2_660004671  == -1 && valPositionOC1_660004671  ==  2 && valPositionOC2_660004671  ==  4
            && valPositionTR1_660004671  ==  0 && valPositionTR2_660004671  ==  3 && valPositionTR3_660004671  ==  5 && valPositionRCF1_660004671 == -1 && valPositionRCF2_660004671 == -1
            && valPositionMST1_660004671 == -1 && valPositionMST2_660004671 == -1 && valPositionSMO1_660004671 == -1 && valPositionSMO2_660004671 == -1
            && valPositionSMT1_660004671 == -1 && valPositionSMT2_660004671 == -1 && valPositionSSP1_660004671 == -1 && valPositionSSP2_660004671 == -1
            && valPositionISO1_660004671 == -1 && valPositionISO2_660004671 == -1 && valPositionISC1_660004671 == -1 && valPositionISC2_660004671 == -1 )
          ALORS
            trace("Trait TRTR")
            i_strcpy(pt_TYPE_COMPOSITE_660004671, "TRTR")
            typeCRA_660004671=0x06
          SINON
            trace("Type composite Non Connu")
            i_strcpy(pt_TYPE_COMPOSITE_660004671, "ERR")
          FINSI
        FINSI
      FINSI
#/G2R6
    FINSI
  FINSI
FINSI

# G3R10 calcul Service_SDETR
SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDETR") == 0 )
ALORS
  SI ( valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == 10 && valPositionIC5_660004671  == 13
    && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == 11 && valPositionOC5_660004671  == 14
    && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == 12 && valPositionTR5_660004671  == 15 )
  ALORS
    Service_SDETR_660004671 = 5
  SINON
    SI ( valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == 10 && valPositionIC5_660004671  == -1
      && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == 11 && valPositionOC5_660004671  == -1
      && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == 12 && valPositionTR5_660004671  == -1 )
    ALORS
      Service_SDETR_660004671 = 4
    SINON
      SI ( valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == -1
        && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == -1
        && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == -1 )
      ALORS
        Service_SDETR_660004671 = 3
      SINON
        SI ( valPositionIC3_660004671  == -1
          && valPositionOC3_660004671  == -1
          && valPositionTR3_660004671  == -1 )
        ALORS
          Service_SDETR_660004671 = 2
        SINON
          trace("Type composite Errone")
          i_strcpy(pt_TYPE_COMPOSITE_660004671, "ERR")
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

# G3R10 calcul Service_CFWD
Service_CFWD_660004671 = 0
ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR1")
ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR1")
SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") == 0 )
ALORS
  SI ( valPositionIC2_660004671  ==  4 && valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == 10 && valPositionIC5_660004671  == 13
    && valPositionOC2_660004671  ==  5 && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == 11 && valPositionOC5_660004671  == 14
    && valPositionTR2_660004671  ==  6 && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == 12 && valPositionTR5_660004671  == 15 )
  ALORS
    Service_CFWD_660004671 = 5
    ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR5")
    ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR5")
  SINON
    SI ( valPositionIC2_660004671  ==  4 && valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == 10 && valPositionIC5_660004671  == -1
      && valPositionOC2_660004671  ==  5 && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == 11 && valPositionOC5_660004671  == -1
      && valPositionTR2_660004671  ==  6 && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == 12 && valPositionTR5_660004671  == -1 )
    ALORS
      Service_CFWD_660004671 = 4
      ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR4")
      ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR4")
    SINON
      SI ( valPositionIC2_660004671  ==  4 && valPositionIC3_660004671  ==  7 && valPositionIC4_660004671  == -1
        && valPositionOC2_660004671  ==  5 && valPositionOC3_660004671  ==  8 && valPositionOC4_660004671  == -1
        && valPositionTR2_660004671  ==  6 && valPositionTR3_660004671  ==  9 && valPositionTR4_660004671  == -1 )
      ALORS
        Service_CFWD_660004671 = 3
        ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR3")
        ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR3")
      SINON
        SI ( valPositionIC2_660004671  ==  4 && valPositionIC3_660004671  == -1
          && valPositionOC2_660004671  ==  5 && valPositionOC3_660004671  == -1
          && valPositionTR2_660004671  ==  6 && valPositionTR3_660004671  == -1 )
        ALORS
          Service_CFWD_660004671 = 2
          ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR2")
          ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR2")
        SINON
          SI ( valPositionIC2_660004671  == -1
            && valPositionOC2_660004671  == -1
            && valPositionTR2_660004671  == -1 )
          ALORS
            Service_CFWD_660004671 = 1
            ic_calledNumberTR_660004671  = i_get_field_num(g_iartin, "calledNumberTR1")
            ic_outgoingRouteTR_660004671 = i_get_field_num(g_iartin, "outgoingRoutTR1")
          SINON
            trace("Type composite Errone")
            i_strcpy(pt_TYPE_COMPOSITE_660004671, "ERR")
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI


trace("**** Tcomp_nss9 : Debut du pcode de distribution ****")

#==============================================================================
# les traitements prefixe ZB et prefixe portabilite sur le champ CallNumber_TR1
# sont communs aux composites SDE, CFWD et SDETR
#==============================================================================
#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
# dans le champ calledNumber_TR1
#####################################################################

##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ Tcomp_nss9::calledNumberTR1 = calledNumber_TR1, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
ZBPrefixVal_660004671=-1
erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberTR1, pt_champ_660004671)
longueur_660004671=i_strlen(pt_champ_660004671)
SI (longueur_660004671 >= 8 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0)
ALORS
  SI( (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,0)<12)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,1)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,2)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,3)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,4)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,5)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,6)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,7)<10) )
  ALORS

    Flag_ZB_660004671 = 0
    SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,7)
      ZBPrefixDigitO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,8)
      ZBPrefixDigitT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,9)
      Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
    SINON
      SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,5)
        ZBPrefixDigitO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,6)
        ZBPrefixDigitT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR1,7)
        Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
      ZBPrefixDigitD_660004671 >= 7 && ZBPrefixDigitD_660004671 <= 9 &&
      ZBPrefixDigitO_660004671 >= 7 && ZBPrefixDigitO_660004671 <= 9 &&
      (ZBPrefixDigitT_660004671 == 1 || ZBPrefixDigitT_660004671 == 2 || ZBPrefixDigitT_660004671 == 4 || ZBPrefixDigitT_660004671 == 9) )
    ALORS

      SI (ZBPrefixVal_660004671 == -1)
      ALORS
        ZBPrefixVal_660004671=600*1000 + ZBPrefixDigitD_660004671*100 + ZBPrefixDigitO_660004671*10 + ZBPrefixDigitT_660004671
      FINSI

      SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
      ALORS
        ZBPrefixLong_660004671 = 6
      SINON
        ZBPrefixLong_660004671 = 8
      FINSI

      Prefix_index_660004671 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP_CFWD_1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, Prefix_index_660004671, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
      ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
      SI (ZBPrefixLong_660004671 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP_CFWD_1
      FINSI

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

  FINSI
FINSI


#-----------------------------------------------------------
#G3R10 lot2 Prefix itinerance sur 6 octets (nouveau format)
#-----------------------------------------------------------
#Recherche et traitement du prefixe d'itinerance nouveau format
# dans le champ T3t5TR 1/T4t5.3/calledNumberTR - format: 41xxxx0T
#TON/NPI == 41
#interrogation de la table RoutinNumberSac avec valeur de retour itin
#------------------------------------------------------------------
SI (Flag_ZBTR1_660004671 == 0 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0 )
ALORS
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR1 - 2 )
  SI (RoutingNumberLong_660004671 >= 5)
  ALORS
    RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 0)
    RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 1)

    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS

      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2)*100000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 3)*10000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 7)
      # appel table externe RNSAC pour determiner la cle
      valTerm_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 7)
      SI (valTerm_660004671 == 1 || valTerm_660004671 == 2 || valTerm_660004671 == 4 || valTerm_660004671 == 9)
      ALORS
        erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberTR1, pt_calledNumberTR_660004671)
        i_get_sub_str (pt_calledNumberTR_660004671,2,7,pt_Prefixitin_660004671)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_Prefixitin_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"itin") == 0)
        ALORS
          Flag_itin1_660004671 = 1
          # -  -- Memorisation du prefixe d'itinerance
          i_get_sub_str(pt_Prefixitin_660004671,0,3,pt_ITInerant_660004671)

          # -  -- Suppression du prefixe itinerance  sur 6 digits : xxxx0T
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

          #Forcage   du TON/NPI suivant la valeur de T
          SI ((valTerm_660004671 == 4) || (valTerm_660004671 == 9))
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,0,0x4)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,1,0x1)
          FINSI
          SI (valTerm_660004671 == 1)
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,0,0x1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,1,0x1)
          FINSI
          SI (valTerm_660004671 == 2)
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,0,0x2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1,1,0x1)
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe de portabilite - RN (routing number)
# dans le champ calledNumberTR1
#####################################################################

#QC1455 : G5R2 : Correction QC1444/1292 cra TcompCFW02_nss9 Item ZB
SI (Flag_ZBTR1_660004671 == 0  && Flag_itin1_660004671 == 0 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0 )
ALORS
  RoutingNumberVal_0_660004671=-1
  RoutingNumberError_660004671 = 0
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR1 - 2 )
  SI (RoutingNumberLong_660004671 >= 8)
  ALORS
    RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 0)
    RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 1)

    SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2)
      RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 3)

      SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 5)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 6)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 7)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Lot3 Curling_Free
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberVal_0_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
# --- Suppression du prefixe pour 11 33 RN *
            RoutingNumberVal_0_660004671=RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

          FINSI
          # G3R3 Curling Free
        SINON
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0 )
          ALORS

            trace ("<<__LINE__>> ====  detection sva ===========")
            #G3R4 lot1 memorisation du prefix sva
            #Prefix_SVA = RoutingNumberTmpVal
            #i_strcpy(pt_PrefixeSVA,pt_CleRoutingNumberSAC)
            # suppression du prefix sva
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

          SINON
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              trace ("<<__LINE__>> ====  detection iti ===========")
              #G3R3 lot3 memorisation du prefix itinerant
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix itinerant
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

              #fin sva
            FINSI
          FINSI
        FINSI
      FINSI
    SINON
      SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 3)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 5)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Lot3 Curling_Free
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberVal_0_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
# --- Suppression du prefixe pour 41 RN *
            RoutingNumberVal_0_660004671 = RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

          FINSI
          #G3R3 Curling Free
        SINON
          #debut sva
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            #G3R4 lot1 memorisation du prefix sva
            #Prefix_SVA = RoutingNumberTmpVal
            #i_strcpy(pt_PrefixeSVA,pt_CleRoutingNumberSAC)
            # suppression du prefix sva
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

            #fin sva
            #G3R4 Prefix sva
          SINON
            #debut iti
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              #G3R3 lot3 memorisation du prefix itinerant
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix itinerant
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#trace1("__FILE__:__LINE__ ##################### ======> Valeur de RoutingNumberVal_0 : <%d> ", RoutingNumberVal_0)

#####################################################################
# G3R3 lot2
# Traitement d'un eventuel prefixe de portabilite
# dans le champ redirectNumTR
#####################################################################
# Suppression de prefix RN dans le champ redirectNumTR:0

RoutingNumberRedirectVal_660004671=-1
RoutingNumberError_660004671 = 0
RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::redirectNumTR:0 - 1 )
SI (RoutingNumberLong_660004671 >= 8)
ALORS
  RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0)
  RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1)

  SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
  ALORS
    RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2)
    RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3)

    SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
      #G3R3 lot3 Curling_Free
      #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
      i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
      SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
          # --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        FINSI
        #G3R3 Curling Free
      SINON
        SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
        ALORS
          #G3R3 lot3 memorisation du prefix itinerant
          ITInerant_660004671 = RoutingNumberTmpVal_660004671
          i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
          # suppression du prefix itinerant
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        SINON
          #G3R4 sva
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            trace ("<<__LINE__ ----------------- detection prefix sva pour Tcomp_nss9::redirectNumTR --------------")
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          FINSI
          #/G3R4 sva
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
      #G3R3 Curling Free
      #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
      i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
      SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
# --- Suppression du prefixe pour 41 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        FINSI
        #G3R3 Curling Free
      SINON
        SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
        ALORS
          ITInerant_660004671 = RoutingNumberTmpVal_660004671
          i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
          # suppression du prefix itinerant
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        SINON
          #G3R4 sva
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            trace ("<<__LINE__ ----------------- detection prefix sva pour Tcomp_nss9::redirectNumTR --------------")
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          FINSI
          #/G3R4 sva
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#/G3R3 lot2

#==========================================================#
# QC1148 G3R8 Lot3 item Mappy ABC traitement des prefixes  #
# RN et SVA pour le champ OrigCalledNumTR:0              #
#==========================================================#
# Suppression de prefix RN et sva dans le champ OrigCalledNumTR:0
RoutingNumberRedirectVal_660004671=-1
RoutingNumberError_660004671 = 0
RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0 - 1 )
SI (RoutingNumberLong_660004671 >= 8)
ALORS
  #trace ("<<__LINE__>>=================OrigCalledNumTR:0========================")
  RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 0)
  RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 1)

  SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
  ALORS
    RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2)
    RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 3)

    SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
      #G3R3 lot3 Curling_Free
      #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
      #trace2("<<=================pt_CleRoutingNumberSAC = %s===============", pt_CleRoutingNumberSAC,"")
      i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
      SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
          trace("<<__LINE__>>===========Suppression du prefixe pour 11 33 RN==========")
          # --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
        FINSI
      SINON
        #  prefixe sva
        SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
        ALORS
          #trace ("<<__LINE__>> ====  detection sva ===========")
          #G3R4 lot1 memorisation du prefix sva
          #Prefix_SVA = RoutingNumberTmpVal
          #i_strcpy(pt_PrefixeSVA,pt_CleRoutingNumberSAC)
          # suppression du prefix sva
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 3)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 4)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
      #G3R3 Curling Free
      #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
      i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))

      SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
          #trace("<<__LINE__>>===========Suppression du prefixe pour 41 RN==========")
          # --- Suppression du prefixe pour 41 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
        FINSI
      SINON
        #  prefixe sva
        SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
        ALORS
          #trace ("<<__LINE__ ----------------- detection prefix sva pour Tcomp_nss9::OrigCalledNumTR --------------")
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#/Fin G3R8 lot3 traitement prefix porta et sva pour Tcomp_nss9::OrigCalledNumTR:0
#/Fin QC1148

#==============================================================================
# les traitements prefixe ZB et prefixe portabilite sur le champ CallNumber_TR2
# sont communs aux composites SDE, CFWD et SDETR, MSOTR
#==============================================================================
##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ Tcomp_nss9::calledNumberTR2 = calledNumber_TR2, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDE") != 0)
ALORS
  ZBPrefixValSDETR_660004671=-1
  erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberTR2, pt_champ_660004671)
  longueur_660004671=i_strlen(pt_champ_660004671)
  SI (longueur_660004671 >= 8 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0)
  ALORS
    SI  ( (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,0)<12)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,1)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,2)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,3)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,4)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,5)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,6)<10)
      && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,7)<10) )
    ALORS

      Flag_ZB_660004671 = 0
      SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
      ALORS
        ZBPrefixDigitSDETRD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,7)
        ZBPrefixDigitSDETRO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,8)
        ZBPrefixDigitSDETRT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,9)
        Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
      SINON
        SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
        ALORS
          ZBPrefixDigitSDETRD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,5)
          ZBPrefixDigitSDETRO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,6)
          ZBPrefixDigitSDETRT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR2,7)
          Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
        FINSI
      FINSI

      # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
      SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
        ZBPrefixDigitSDETRD_660004671 >= 7 && ZBPrefixDigitSDETRD_660004671 <= 9 &&
        ZBPrefixDigitSDETRO_660004671 >= 7 && ZBPrefixDigitSDETRO_660004671 <= 9 &&
        (ZBPrefixDigitSDETRT_660004671 == 1 || ZBPrefixDigitSDETRT_660004671 == 2 || ZBPrefixDigitSDETRT_660004671 == 4 || ZBPrefixDigitSDETRT_660004671 == 9) )
      ALORS
# QC1432 rajout booleen ZBPrefixTR1_8
        SI (ZBPrefixValSDETR_660004671 == -1)
        ALORS
          ZBPrefixValSDETR_660004671=600*1000 + ZBPrefixDigitSDETRD_660004671*100 + ZBPrefixDigitSDETRO_660004671*10 + ZBPrefixDigitSDETRT_660004671
          ZBPrefixTR1_8_660004671 = 1
        FINSI
#/QC1432 rajout booleen ZBPrefixTR1_8
        SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
        ALORS
          ZBPrefixLong_660004671 = 6
        SINON
          ZBPrefixLong_660004671 = 8
        FINSI

        Prefix_index_660004671 = 2

        # Suppression de [33] eventuel et du prefixe ZB avant normalisation
        POINT BOUCLE_ZBSKIP_SDETR_1
        erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, Prefix_index_660004671, 0x0f)
        erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
        ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
        SI (ZBPrefixLong_660004671 != 0)
        ALORS
          SAUT BOUCLE_ZBSKIP_SDETR_1
        FINSI

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

    FINSI
  FINSI
FINSI


#-----------------------------------------------------------
#Recherche et traitement du prefixe d'itinerance nouveau format
# dans le champ T3t5TR 2/T4t5.3/calledNumberTR - format: 41xxxx0T
#TON/NPI == 41
#interrogation de la table RoutinNumberSac avec valeur de retour itin
#------------------------------------------------------------------
SI (Flag_ZBTR2_660004671 == 0 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0)
ALORS
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR2 - 2 )
  SI (RoutingNumberLong_660004671 >= 5)
  ALORS
    RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 0)
    RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 1)

    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS

      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2)*100000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 3)*10000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 7)
      # appel table externe RNSAC pour determiner la cle
      valTerm_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 7)
      SI (valTerm_660004671 == 1 || valTerm_660004671 == 2 || valTerm_660004671 == 4 || valTerm_660004671 == 9)
      ALORS
        erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberTR2, pt_calledNumberTR_660004671)
        i_get_sub_str (pt_calledNumberTR_660004671,2,7,pt_Prefixitin_660004671)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671,pt_Prefixitin_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"itin") == 0)
        ALORS
          Flag_itin2_660004671 = 1
          # --- Memorisation du prefixe d'itinerance
          i_get_sub_str (pt_Prefixitin_660004671,0,3,pt_ITInerant_660004671)
          # --- Suppression du prefixe itinerance  sur 6 digits : xxxx0T
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)

          #Forcage  du TON/NPI suivant la valeur de T
          SI ((valTerm_660004671 == 4) || (valTerm_660004671 == 9))
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,0,0x4)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,1,0x1)
          FINSI
          SI (valTerm_660004671 == 1)
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,0,0x1)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,1,0x1)
          FINSI
          SI (valTerm_660004671 == 2)
          ALORS
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,0,0x2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2,1,0x1)
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#--G3R10 lot2 FIN


#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ calledNumberTR2
#####################################################################

#--
SI (Flag_ZBTR2_660004671 == 0 && Flag_itin2_660004671 == 0 && i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") != 0)
ALORS
  trace("<<__LINE__>> ============= ICI ====================")
  RoutingNumberValSDETR_660004671=-1
  RoutingNumberVal_660004671 = -1
  RoutingNumberError_660004671 = 0
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR2 - 2 )
  erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)
  trace2("<<__LINE__>> ============== pt_calledNumberTR = %s ================",pt_calledNumberTR_660004671,"")

  trace ("<<__LINE__>> ============= ICI ===============")
  RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 0)
  RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 1)

  SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
  ALORS
    trace("<<__LINE__>> ============= ICI ====================")
    RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2)
    RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 3)

    SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
    ALORS
      SI (RoutingNumberLong_660004671 >= 9)
      ALORS
        trace("<<__LINE__>> ============= ICI ====================")
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 5)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 6)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 7)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Curling Free
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        trace2("<<__LINE__>> ====================calledNumberTR2 pt_CleRoutingNumberSAC=<%s>============",pt_CleRoutingNumberSAC_660004671,"")
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberValSDETR_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
# --- Suppression du prefixe pour 11 33 RN *
            trace("<<__LINE__>> =============calledNumberTR2- DETECTION PREFIX RN PORTABILITE ================")
            RoutingNumberVal_660004671=RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
          FINSI
          #G3R3 Curling Free
        SINON
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            trace ("<<__LINE__ >> ============= detection sva dans  calledNumberTR2==============")
            #G3R4 lot1 memorisation du prefix sva
            Prefix_SVA_660004671 = RoutingNumberTmpVal_660004671
            i_strcpy(pt_PrefixeSVA_660004671,pt_CleRoutingNumberSAC_660004671)
            # suppression du prefix sva
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)

          SINON
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              trace ("<<__LINE__ >> ============= detection iti dans calledNumberTR2==============")
              #G3R3 lot3 memorisation du prefix itinerant
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix itinerant
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            SINON
              Length_calledNumberTR_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR2 - 2)
              erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)

              trace2("<<__LINE__>> ============== pt_calledNumberTR = %s ================",pt_calledNumberTR_660004671,"")
              SI (Length_calledNumberTR_660004671 > 7)
              ALORS
                i_get_sub_str(pt_calledNumberTR_660004671, 4, -1, pt_calledNumberTR_660004671)
                i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
                trace2("<<__LINE>> ===========pt_PrefixJoing=<%s>====================",pt_PrefixJoing_660004671,"")
                i_strcpy(pt_portjoing_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoing_660004671))
                SI (i_strcmp(pt_portjoing_660004671,"joig") == 0)
                ALORS
                  trace("<<__LINE__>>==============INTER joig detecte==================")
                  FlagInter_660004671 = 1
                  PREFIXJoig_660004671 = 1
                FINSI
              FINSI
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  SINON
    trace ("<<__LINE__>> ============== ICI ===================")
    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      SI (RoutingNumberLong_660004671 >=8)
      ALORS
        trace ("<<__LINE__>> ============== INTER ======================")
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 3)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 5)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Curling Free
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberValSDETR_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
# --- Suppression refixe pour 41 RN *
            RoutingNumberVal_660004671=RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)

          FINSI
          #G3R3 Curling Free
        SINON
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            trace ("<<__LINE__ >> ============= detection sva ==============")
            #G3R4 lot1 memorisation du prefix sva
            Prefix_SVA_660004671 = RoutingNumberTmpVal_660004671
            i_strcpy(pt_PrefixeSVA_660004671,pt_CleRoutingNumberSAC_660004671)
            # suppression du prefix sva
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)


          SINON
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              trace ("<<__LINE__ >> ============= detection iti ==============")
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix itinerant
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
#----DEBUT
            SINON
              Length_calledNumberTR_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR2 - 2)
              erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)
              Prexf1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 0)
              Prexf2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 1)
              Prexf3_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2)
              Prexf4_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 3)
              trace2("<<__LINE__>> ============== pt_calledNumberTR = %s ================",pt_calledNumberTR_660004671,"")
              trace ("<<__LINE__>> ========== numero national =======================")
              SI ((Prexf1_660004671 == 4 && Prexf2_660004671 == 1) && Length_calledNumberTR_660004671 > 6)
              ALORS
                FlagNat_660004671 = 1
                trace("<<__LINE__>> ============NAT joig detecte ======================")
                i_get_sub_str(pt_calledNumberTR_660004671, 2, -1, pt_calledNumberTR_660004671)
                i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
                #SINON
                # numero inter
                #SI ((Prexf1 == 1 && Prexf2 == 1 && Prexf3 == 3 && Prexf4 == 3) && Length_calledNumberTR > 7)
                #ALORS
                #FlagInter = 1
                #trace("<<__LINE__>>==============INTER joig detecte==================")
                #i_get_sub_str(pt_calledNumberTR, 4, -1, pt_calledNumberTR)
                #i_get_sub_str(pt_calledNumberTR, 0, -10, pt_PrefixJoing)
                #FINSI
                i_strcpy(pt_portjoing_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoing_660004671))
                SI (i_strcmp(pt_portjoing_660004671,"joig") == 0)
                ALORS
                  FlagNat_660004671 = 1
                  PREFIXJoig_660004671 = 1
                FINSI
              FINSI
              #i_strcpy(pt_portjoing,i_get_tab_field(RNSAC, date_fin, pt_PrefixJoing))
              #SI (i_strcmp(pt_portjoing,"joig") == 0)
              #ALORS
              #    PREFIXJoig = 1
              #FINSI
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#------------DEBUT

#########################################
#Suppression du prefix de joignabilite
##########################################
SI (PREFIXJoig_660004671)
ALORS
  SI (FlagInter_660004671)
  ALORS
    #Cas Inter
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
    POINT BOUCLE7
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
      SAUT BOUCLE7
    FINSI
#erreur = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberCF,pt_calledNumberCF)
#trace2 ("<<__LINE__>>=============pt_calledNumberCF=%s====================", pt_calledNumberCF,"")
  FINSI
  SI (FlagNat_660004671)
  ALORS
    #Cas National
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004671)
    POINT BOUCLE8
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
      SAUT BOUCLE8
    FINSI
    erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR3,pt_calledNumberTR_660004671)
    trace2 ("<<__LINE__>>=============pt_calledNumberTR=%s====================", pt_calledNumberTR_660004671,"")
  FINSI
FINSI

#--

#trace1("__FILE__:__LINE__ ##################### ======> Valeur de RoutingNumberTmpVal : <%d> ", RoutingNumberTmpVal)


#G3R7 Gestion des MVNOs lights

SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDE") == 0 || i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDETR") == 0 || i_strcmp(pt_TYPE_COMPOSITE_660004671, "MSOTR") == 0)
ALORS
  digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 0)
  digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 1)
  digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 2)
  digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 3)
  digit5_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 4)
  SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8) && (digit4_660004671==0) && (digit5_660004671==1) )
  ALORS
    IMSI_OrangeCo_660004671 =1
  SINON
    SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8))
    ALORS
      erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::IMSIMO:0,str_IMSIMO_660004671)
      i_get_sub_str (str_IMSIMO_660004671, 0, 4, str_MNC_660004671)
      erreur_660004671=i_format_str2( str_conteneur_660004671, "%s%s", "L_", str_MNC_660004671)
      SI (i_get_tab_field("MVNO", date_cra_660004671, str_conteneur_660004671)) != g_inull
      ALORS
        IMSI_OrangeCo_660004671 = 1
      SINON
        IMSI_OrangeCo_660004671 = 0
      FINSI
    FINSI
  FINSI
FINSI

SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD")) == 0
ALORS
  digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 0)
  digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 1)
  digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 2)
  digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 3)
  digit5_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 4)
  SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8) && (digit4_660004671==0) && (digit5_660004671==1) )
  ALORS
    IMSI_OrangeCo_660004671 = 1
  SINON
    SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8))
    ALORS
      erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::IMSICF:0,str_IMSICF_660004671)
      i_get_sub_str (str_IMSICF_660004671, 0, 4, str_MNC_660004671)
      erreur_660004671=i_format_str2( str_conteneur_660004671, "%s%s", "L_", str_MNC_660004671)
      SI (i_get_tab_field("MVNO", date_cra_660004671, str_conteneur_660004671)) != g_inull
      ALORS
        IMSI_OrangeCo_660004671 = 1
      SINON
        IMSI_OrangeCo_660004671 = 0
      FINSI
    FINSI
  FINSI

FINSI

trace1 ("<<__LINE__>> ======== IMSI_OrangeCo = %d ==================",IMSI_OrangeCo_660004671)

#/G3R7 Gestion des MVNOs lights

#####################################################################
# Calcul variable fonctionnelle CellID_OF et des booleens IMSI ORANGE
# Pour tous les composites
#####################################################################
flag_freeFormatData_660004671 = 0
i_strcpy(pt_CellID_OF_660004671,"")
i_strcpy(pt_temp2_660004671,"")

SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDE") == 0 || i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDETR") == 0)
ALORS
  digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 0)
  digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 1)
  digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 2)
  digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 3)
  digit5_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSIMO:0, 4)
  SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8) && (digit4_660004671==0) && (digit5_660004671==1) )
  ALORS
    b_IMSIMO1_ORANGE_660004671=1
  FINSI
FINSI

SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") == 0)
ALORS
  digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 0)
  digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 1)
  digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 2)
  digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 3)
  digit5_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::IMSICF:0, 4)
  SI ( (digit1_660004671==2) && (digit2_660004671==0) && (digit3_660004671==8) && (digit4_660004671==0) && (digit5_660004671==1) )
  ALORS
    b_IMSICF1_ORANGE_660004671=1
  FINSI
FINSI

SI (b_IMSIMO1_ORANGE_660004671 || b_IMSICF1_ORANGE_660004671 || i_strcmp(pt_TYPE_COMPOSITE_660004671, "TR") == 0)
ALORS
  # SI FreeFormatData1 present et sa longueur = 3 octets)
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::freeFormatData1))
  ALORS
    SI (i_get_art_field(g_iartin,$Tcomp_nss9::freeFormatData1 - 1) == 3)
    ALORS
      erreur_660004671 = i_cree_art("Conv_URS",g_iartout9)
      erreur_660004671 = i_dup_chp_1val(g_iartin, g_iartout9, $Tcomp_nss9::freeFormatData1, $Conv_URS::CellIDOFH)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::CellIDOFD, pt_temp2_660004671)
      i_get_sub_str(pt_temp2_660004671, 0, 4, pt_temp2_660004671)
      erreur_660004671 = i_format_str2( pt_CellID_OF_660004671, "%s%s", "CellID_OF_", pt_temp2_660004671 )
      flag_freeFormatData_660004671=1
    FINSI
    #G3R10 lot1 modif valorisation de l a variable Cellid_OF, suppression du  freeFormatData2
  FINSI
FINSI

SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDE") == 0 )
ALORS
  trace("Tcomp_nss9: Dist SDE")
  SAUT DISTRIB_SDE
SINON
  SI (i_strcmp(pt_TYPE_COMPOSITE_660004671, "CFWD") == 0 )
  ALORS
    trace("Tcomp_nss9 : Dist CFWD")
    SAUT DISTRIB_CFWD
  SINON
    SI(i_strcmp(pt_TYPE_COMPOSITE_660004671, "SDETR") == 0)
    ALORS
      trace("Tcomp_nss9: Dist SDETR")
      SAUT DISTRIB_SDETR
    SINON
      SI(i_strcmp(pt_TYPE_COMPOSITE_660004671, "TR") == 0)
      ALORS
        trace("Tcomp_nss9: Dist TR")
        SAUT DISTRIB_TR
# G2R6
      SINON
        SI(i_strcmp(pt_TYPE_COMPOSITE_660004671, "MSOTR") == 0)
        ALORS
          trace("Tcomp_nss9: Dist MSOTR")
          SAUT DISTRIB_MSOTR
        SINON
          SI(i_strcmp(pt_TYPE_COMPOSITE_660004671, "TRTR") == 0)
          ALORS
            trace("Tcomp_nss9: Dist TRTR")
            SAUT DISTRIB_TRTR
          FINSI
        FINSI
# /G2R6
      FINSI
    FINSI
  FINSI
FINSI

#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

POINT DISTRIB_SDE
#================================================================
#    $$$$   $$$$    $$$$$
#   $___    $   $   $__
#       $   $   $   $
#   $$$$    $$$$    $$$$$
#================================================================
#####################################################################
# Choix de la table de duplication
#####################################################################

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
#G1R8 etait plus bas
#####################################################################
# appel urgent:
# - si champ "tlserv" du CRA = 0x12 => appel urgent
#####################################################################
#gsmTlSrv = i_get_art_field(g_iartin,$Tcomp_nss9::teleSrvCodeMO:0)
#SI (gsmTlSrv == 0x12)
#ALORS
# app_urg = 1
#SINON
# app_urg = 0
#FINSI
# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc

#
# si le CRA est VPN, on a isVPN = 1
#
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR1)
SI (calledNumber_TR1_present_660004671)
ALORS
  val_Camel_660004671 = i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,0)*256*256*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,1)*256*256*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,2)*256*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,3)*256*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,4)*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,5)*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,6)*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,7)

  erreur_660004671= i_EntierToString(val_Camel_660004671,str_Camel_660004671,11)
  erreur_660004671=i_format_str2(pt_cleVPN_660004671,"%s%s","NSS9_VPN_",str_Camel_660004671)
  SI(i_get_tab_field("Marque_VPN",date_cra_660004671,pt_cleVPN_660004671) != g_inull)
  ALORS
    isVPN_660004671 = 1
  FINSI
FINSI

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

calledNumber_present_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
SI (calledNumber_present_660004671 > 0 )
ALORS
  TON_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 0)
  NPI_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 1)
FINSI

# On valide la suppression des caracteres speciaux
flag_rm_escape_char_660004671=1

#G3R7 gestion des MVNOs lights
SI IMSI_OrangeCo_660004671
#SI b_IMSIMO1_ORANGE
ALORS
#   Cas des abonnes ITINERIS
  SI ( isVPN_660004671 == 1 )
  ALORS
    indice_duptab_660004671 = DUP_TAB_NORMITINERIS_VPN_660004671
  SINON
    indice_duptab_660004671 = DUP_TAB_NORMITINERIS_660004671
  FINSI
SINON
#   Cas des ROAMERS
  is_roamers_660004671 = 1
#
# on passe maintenant par une duplication intermidiaire pour tester la normalisation du champ
#
  erreur_660004671 = i_dup_art_tab(g_iartin, g_iartout4, "Tnormal3")
  trace1("retour i_dup_art_tab sur Tnormal3 = %d",erreur_660004671)
  SI (erreur_660004671 < 0)
  ALORS
#     Cas echec normalisation idpart, on verifie qu'on a un echec aussi avec l'automate VPN
    SI ( isVPN_660004671 == 1 )
    ALORS
      erreur_660004671 = i_dup_art_tab(g_iartin, g_iartout4, "TnormalTlv")
      trace1("retour i_dup_art_tab sur TnormalVPN = %d",erreur_660004671)
      SI (erreur_660004671 < 0)
      ALORS
        indice_duptab_660004671 = DUP_TAB_ECHECNORM_660004671
      SINON
        indice_duptab_660004671 = DUP_TAB_NORMROAMERS_VPN_660004671
      FINSI
    SINON
      indice_duptab_660004671 = DUP_TAB_ECHECNORM_660004671
    FINSI
  SINON
    SI ( isVPN_660004671 == 1 )
    ALORS
      indice_duptab_660004671 = DUP_TAB_NORMROAMERS_VPN_660004671
    SINON
      indice_duptab_660004671 = DUP_TAB_NORMROAMERS_660004671
    FINSI
  FINSI

  SI (calledNumber_present_660004671 > 0 )
  ALORS
    SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
    ALORS
      dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
      SI (dig3_660004671!=0)
      ALORS
#         On invalide la suppression des caracteres speciaux
        flag_rm_escape_char_660004671=0
      FINSI
    FINSI
  FINSI
FINSI
#####################################################################
# Pour le service Transgroupe (OICK=4), retrait du prefixe 0 (TON=2)
#####################################################################

digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 0)
digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 1)
digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 2)
digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 3)

SI ( ( digit1_660004671 == 0 ) && ( digit2_660004671 == 0 ) && ( digit3_660004671 == 4 ) && ( digit4_660004671 == 0x0f ) )
ALORS
  dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)

  SI ( ( TON_660004671 == 2 ) && ( dig3_660004671 == 0 ) )
  ALORS
    erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2, 0x0f)
    erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberMO:0)
  SINON
    #####################################################################
    # MB FE425 Ajout du prefixe 8588 pour les numeros courts on-net
    #          L'article change de nom pour pouvoir utiliser un autre
    #          automate
    #        Pas de prefixe 0 d'echappement
    # MB EV624 L'article ne change plus de nom, mais de table de duplication
    #####################################################################

    SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
    ALORS
      indice_duptab_660004671 = DUP_TAB_NORMTGROUPE_660004671
    FINSI
  FINSI
#         Cas des ROAMERS
FINSI

#       Suppression des caracteres speciaux
SI ((calledNumber_present_660004671 > 0) && (flag_rm_escape_char_660004671==1))
ALORS
# fonction inconnue de platine
#   erreur = i_rm_escape_char_end(g_iartin, $Tcomp_nss9::calledNumber_MO:0)
#
# fonction equivalente :
#
  indice_660004671 = 2
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
  taille_660004671 = taille_660004671 * 2

  POINT BOUCLE_DEBUT

  SI (indice_660004671 < taille_660004671)
  ALORS
    val_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_660004671)
    SI (val_660004671 > 9)
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_660004671, 15)
    FINSI
    indice_660004671 = indice_660004671 + 1
    SAUT BOUCLE_DEBUT
  FINSI
FINSI

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

#####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################

# Duplication avec choix de la table
ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", indice_duptab_660004671)

SI (ic_660004671 != 0)
ALORS
  ERREUR_660004671 = ERR_DUPL_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDE" ,indice_duptab_660004671)
  SAUT STOCKE_ERRONE
FINSI

#G5R1
# SDE: ajout de T3t8/msgITX si (bT3T8ITX == 1) et indice_duplication == {0, 1, 3, 4, 15, 16}
SI (bT3T8ITX_660004671 == 1) &&
  ((indice_duptab_660004671 == 0)
  || (indice_duptab_660004671 == 1)
  || (indice_duptab_660004671 == 3)
  || (indice_duptab_660004671 == 4)
  || (indice_duptab_660004671 == 15)
  || (indice_duptab_660004671 == 16))
ALORS
  SI (i_valid_field_n(g_iartin,$Tcomp_nss9::numOfMrPulseTR:0))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t8","")
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $Tcomp_nss9::numOfMrPulseTR:0))
    trace ("Type_Tcomp_SDE: Ajout du champ msgITX")
  FINSI
FINSI

#####################################################################
# QC1232 evolution champ tterm pour FREE
# T3t1.14 (tterm)
# tterm   :-  :-  :MSET :FF
# avec Tcomp_nss9/disconnPartyMO
#####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::disconnPartyMO))
ALORS
  res_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::disconnPartyMO)
  SI (res_660004671 == 0 || res_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004671 == 2)
    ALORS
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI


SI (indice_duptab_660004671 == DUP_TAB_NORMTGROUPE_660004671)
ALORS

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
# #debut G1R8 SDETR plus de troncature et normalisation quand app_urg vrai
  dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
  SI ((dig3_660004671 < 1) || (dig3_660004671 > 9))
  ALORS
    trace("Tcomp_nss9 : Normalisation TRANSGROUPE SDE NOK")
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDE" ,indice_duptab_660004671)
    SAUT STOCKE_ERRONE
  FINSI
  taille_idpart_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t2", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t2", "idpart", (taille_idpart_660004671+2)*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 0, 0x3)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 1, 0x3)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 2, 0x8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 3, 0x5)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 4, 0x8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 5, 0x8)
  indice_idpart_660004671 = 6
  indice_called_660004671 = 2

  POINT BOUCLE_IDPART_SDE
  Digit_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_called_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_idpart_660004671, Digit_660004671)

  indice_idpart_660004671 = indice_idpart_660004671 + 1
  indice_called_660004671 = indice_called_660004671 + 1

  SI (indice_called_660004671 < taille_idpart_660004671*2)
  ALORS
    SAUT BOUCLE_IDPART_SDE
  FINSI
# FINSI
# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
FINSI

# G2R2 : Offre kiosque visio
# On verifie que calledNumberMO fait partie des numeros courts de l'offre via un automate dedie (5 digits et normalisation NOK = le num ne fait pas partie de l offre
# S il en fait partie, on force idpart du Tdpvgsm avec le resultat de la normalisation
# Remarque importante : on travaille sur g_iartout12 (et non g_iartin) car le mecanisme de normalisation/troncature semble alterer l article d entree
taille_idpart_660004671 = i_get_art_field(g_iartout12, $Tcomp_nss9::calledNumberMO:0 -1)
SI (taille_idpart_660004671 == 4)
ALORS
  Digit_660004671 = i_get_art_fieldtab(g_iartout12, $Tcomp_nss9::calledNumberMO:0, 7)
  SI (Digit_660004671 == 0x0F)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartout12, g_iartout9, $Tcomp_nss9::calledNumberMO:0,$Conv_URS::idpart, -$NORM:KIOSQUE_VISIO, 0)
    SI (erreur_660004671 == 0)
    ALORS
      erreur_660004671 = i_resize_tlv(g_iartout,"T3t2", "idpart", 4*8)
      erreur_660004671 = i_dup_chp_1val(g_iartout9, g_iartout, $Conv_URS::idpart, $Tdpvgsm::idpart)
    FINSI
  FINSI
FINSI
# Fin G2R2

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiMO_660004671,"")
i_strcpy(str_exchDCBMO_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiMO,str_exchasciiMO_660004671)
trace2("<<<__LINE__<<<__FILE__<<< ################# str_exchasciiMO = %s ################",str_exchasciiMO_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiMO_660004671," ")
trace1("<<<__LINE__<<<__FILE__<<< ############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
	i_get_sub_str (str_exchasciiMO_660004671, 0, position_660004671 - 1 ,str_exchasciiMO_660004671)
	trace2("<<<__LINE__<<<__FILE__<<< ################# str_exchasciiMO modifie = %s ################",str_exchasciiMO_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiMO_660004671,str_exchDCBMO_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBMO_660004671, longueur_660004671)


###################################################################
# calcul temporaire du champ DATE a cause du 2VAL inoperant V3t1.5
###################################################################
date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::ddebut)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004671)

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

#####################################################################
# FE2242 : OLA 28/12/04
# Si la normalisation echoue et si IMSI roamer, recopie du
# CalledPartyNumber ds le champ V3t2 sans le TON+NPI
#####################################################################
SI (indice_duptab_660004671 == DUP_TAB_ECHECNORM_660004671)
ALORS
#  Cas Echec normalisation : copie sans TON+NPI
  calledNumber_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
#
# on prend la taille du champ que l on divise par 8 car la taille de "calledNumber_MO" est donnee en "bit"
#
    taille_idpart_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t2", "")
    trace("Echec normalisation : copie sans TON+NPI")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberMO:0, $Tdpvgsm::idpart, -$NORM:CIT_IDENT, 0)

    SI (erreur_660004671)
    ALORS
#     type_erreur = CODE_ERREUR_DUPLICATION
      trace("Tsde_nss9 : Erreur duplication idpart 2242")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "idpart")
      SAUT STOCKE_ERRONE
      RETOUR TRAIT_OK
    FINSI

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  FINSI
FINSI
trace("fin traitement idpart 2242")

# FE 312
# traduction en un entier 16 bit du champ OICK
# et creation du champ dans l'article en sortie


serviceKey_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKey_IC:0)
OICK_present_660004671       = i_valid_field_n(g_iartin,$Tcomp_nss9::oIcKMO:0)

SI ( OICK_present_660004671 )
ALORS
  val_OICK_660004671 = digit1_660004671*100 + digit2_660004671*10 + digit3_660004671

#  --- Creation du T4t11.1
  erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.1", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.1","nbsvcIN",1)
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, 1)

#  --- Creation du T4t11.2
#  --- la taille 2 correspond a 2 octet (taille d'une clef)
  erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.2","lstSVCIN",2)

#  --- DPV TLV : mise a jour lstSVCIN
#  --- ecriture de l'octet de poids fort
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (val_OICK_660004671 / 256) )
#  --- ecriture de l'octet de poids faible
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1, (val_OICK_660004671 & 0xFF) )
SINON
  SI ( serviceKey_present_660004671 )
  ALORS
#  --- Creation du T4t11.1
    erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.1", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.1","nbsvcIN",1)
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, 1)

#  --- Creation du T4t11.2
#  --- la taille 2 correspond a 2 octet (taille d'une clef)
    erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.2","lstSVCIN",2)

#  --- attention le champ ServiceKey du Tsde_nss9 est sur 4octets
#  --- on ne copie que les 2 octets de poids faible
#  --- ecriture de l'octet de poids fort
# OGA anomalie NSS9 champ lstSVCIN
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (g_iartin.serviceKeyIC1[4]*16+g_iartin.serviceKeyIC1[5]) )
#  --- ecriture de l'octet de poids faible
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1, (g_iartin.serviceKeyIC1[6]*16+g_iartin.serviceKeyIC1[7]) )
# /OGA anomalie NSS9 champ lstSVCIN
  FINSI
FINSI

#  --- Creation du T4t11.3
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR1)
SI (calledNumber_TR1_present_660004671)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t11.3","")

#  --- Normalisation du numero SCPIN dans l'article de sortie DPV
  SI (is_roamers_660004671)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::SCPIN,-$NORM:ROAMERS2,0)
  SINON
#G3R7 Gestions des MVNOs lights normalisation de V4t11.3 avec MET_ASN1_SCPIN
    SI (IMSI_OrangeCo_660004671 == 1)
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::SCPIN,-$NORM:MET_ASN1_SCPIN,0)
    FINSI
  FINSI

  SI ( erreur_660004671 != 0)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur duplication champ SCPIN")
#   type_erreur = CODE_ERREUR_DUPLICATION

    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "SCPIN")
    SAUT STOCKE_ERRONE
#   SAUT STOCKE_RECYCLE
  FINSI
FINSI
# Fin FE312


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

#####################################################################
# Traitement du system type V3t1.10 (systtype)
#
#####################################################################

SI (i_valid_field_n(g_iartin, $Tcomp_nss9::rNCidOf1stRNCMO:0))
ALORS
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::systype,0x01)
FINSI

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

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004671)
ALORS
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumTR:0 -1)
  SI (taille_660004671 >= 2)
  ALORS
    TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 0)
    NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 1)

# --- portOrigNet sera absent du DPV si en entree le champ
# --- origLocNumber a un TON NPI different de 41 (E///)

    SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumTR:0,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004671 != 0 )
      ALORS
        trace("Erreur dup_chp_rnis - T3t6")
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "portOrigNet")
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement du champs transporteurs sortant et entrant T3t16
#
#####################################################################
#
# ---- Duplication du champ transporteur Sortant
#

tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::outgoingRouteTR:0 - 1))

SI    ((tailleChpTrans_660004671 <= 7 ) && (i_valid_field_n(g_iartin, $Tcomp_nss9::outgoingRouteTR:0)))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, g_iartin.outgoingRoutTR1[], tailleChpTrans_660004671)
FINSI



#####################################################################
# Prise en compte du champ "service support": V3t1.7 (svcsup)
# Si teleservice == 0xff et service support renseigne
#   -> on renseigne teleservice pour la valorisation et le CTDC
#####################################################################

SI (calledNumber_TR1_present_660004671)
ALORS
  str_calledNumberTR_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR1)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR_660004671,15,1,str_calledNumberTRtmp_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp_660004671,2, 9,  str_calledNumberTRtmp_660004671)
  pt_TN1_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp_660004671)
FINSI

tlserv_mod_660004671 = 0
gsmTlSrv_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::teleSrvCodeMO:0)

SI ((gsmTlSrv_660004671 & 0xff) == 0xff)
ALORS
  tlserv_mod_660004671 = 1
  svcsup_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::bearerSvcCodeMO:0)

  SI( pt_TN1_660004671== g_inull )
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,svcsup_660004671)
  SINON
#Valeur par defaut
    SAUT FIN_SVCSUP
  FINSI

  Q1_660004671 = svcsup_660004671 & 0xf0
  Q2_660004671 = svcsup_660004671 & 0x0f

  SI ((Q1_660004671 != 0x10) && (Q1_660004671 != 0x90))
  ALORS
    SAUT ERR_SVCSUP
  FINSI

  SI (Q2_660004671 && (Q2_660004671 < 0x07))
  ALORS
    vsvcsup_660004671 = 0x16
    SAUT OK_SVCSUP
  FINSI

  SI ((Q2_660004671 > 0x09) && (Q2_660004671 < 0x0f) && (Q2_660004671 != 0x0b))
  ALORS
    vsvcsup_660004671 = 0x1e
    SAUT OK_SVCSUP
  FINSI

  SI (Q2_660004671 == 0x07)
  ALORS
    vsvcsup_660004671 = 0x17
    SAUT OK_SVCSUP
  FINSI

  SI (Q2_660004671 == 0x0F)
  ALORS
    vsvcsup_660004671 = 0x1f
    SAUT OK_SVCSUP
  FINSI

  POINT   ERR_SVCSUP
  trace1("Erreur champ service support -> 0x%x", svcsup_660004671)
  trace1("Erreur champ service support -> 0x%d", svcsup_660004671)
  SAUT FIN_SVCSUP

  POINT   OK_SVCSUP
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,vsvcsup_660004671)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::tlserv,vsvcsup_660004671)
FINSI

POINT   FIN_SVCSUP

#####################################################################
# Traitement des champs CAMEL
#
#####################################################################
gSMCallRefNum_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::gSMCallRefNumMO:0)
mSCaddress_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::mSCAddressMO:0)
CAMEL_SCFAdr_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::CAMEL_SCFAdrMO:0)
CAMEL_servkey_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::CAMEL_servkeyMO:0)
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)

SI ( (gSMCallRefNum_present_660004671) || (mSCaddress_present_660004671) || (CAMEL_SCFAdr_present_660004671) || (CAMEL_servkey_present_660004671) )
ALORS
# --- Test de coherence chp oblig
  SI (!gSMCallRefNum_present_660004671)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur chp gSMCallRefNum_MO absent")
#   type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "gSMCallRefNum_MO")
    SAUT STOCKE_ERRONE
#   SAUT STOCKE_RECYCLE
  FINSI

  SI (!mSCaddress_present_660004671)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur chp mSCaddress_MO absent")
#   type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "mSCaddress_MO")
    SAUT STOCKE_ERRONE
#   SAUT STOCKE_RECYCLE
  FINSI

  SI (!CAMEL_SCFAdr_present_660004671)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur chp CAMEL_SCFAdr_MO absent")
#   type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "CAMEL_SCFAdr_MO")
    SAUT STOCKE_ERRONE
#   SAUT STOCKE_RECYCLE
  FINSI

  SI (!CAMEL_servkey_present_660004671)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur chp CAMEL_servkey_MO absent")
#   type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "CAMEL_servkey_MO")
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.1","")
  taillegSMCallRefNum_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::gSMCallRefNumMO:0 -1)
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.1","C_CallRefNum",taillegSMCallRefNum_660004671*8)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_CallRefNum, g_iartin.gSMCallRefNuMO1[], taillegSMCallRefNum_660004671)

  SI ( erreur_660004671 != 0)
  ALORS
#   erreur = MESSTRAD0(DEST_JNL, "Erreur dup champ gSMCallRefNum")
#   type_erreur = CODE_ERREUR_DUPLICATION
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "C_CallRefNum")
    SAUT STOCKE_ERRONE
#   SAUT STOCKE_RECYCLE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.2","")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::mSCAddressMO:0, $Tdpvgsm::C_MSCAddress, -$NORM:MET_ASN1_NEW, 0)
  SI ( erreur_660004671 != 0)
  ALORS
    trace("Erreur dup champ MSCAddress")
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "C_MSCAddress")
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.3","")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::CAMEL_SCFAdrMO:0, $Tdpvgsm::C_SrvAddress1, -$NORM:MET_ASN1_NEW, 0)
  SI ( erreur_660004671 != 0)
  ALORS
    trace("Erreur dup champ SCFAddress")
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "C_SrvAddress1")
    SAUT STOCKE_ERRONE
  FINSI

  SI (calledNumber_TR1_present_660004671)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.4","")
    SI (is_roamers_660004671)
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:ROAMERS2, 0)
    SINON
#G3R7 Gestion des MVNOs lights normalisation de V4t18.4 avec MET_ASN1_SCPIN_VPN ou MET_ASN1_SCPIN
      SI (IMSI_OrangeCo_660004671 == 1)
      ALORS
        SI(i_get_tab_field("VariableContexte",date_cra_660004671,"SDE_SDETR_V4t18_4_VPN") != g_inull)
        ALORS
          trace("## SDE_SDETR_V4t18_4_VPN present => normalisation V4t18.4 avec MET_ASN1_SCPIN_VPN")
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:MET_ASN1_SCPIN_VPN, 0)
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:MET_ASN1_SCPIN, 0)
        FINSI
      FINSI
    FINSI

    SI ( erreur_660004671 != 0)
    ALORS
      trace("Erreur dup champ calledNb(TR)")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "C_DestNum1")
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.5","")
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key1, g_iartin.CAMELservkeyMO1[], 4)

  SI ( erreur_660004671 != 0)
  ALORS
    trace("Tcomp_nss9: Erreur dup champ service Key1")
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8521 ,2 , g_iartout12, "" , 3, code_rejet_660004671,"SDE", "C_Key1")
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Level1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_DefChInd1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Modif1,0xF)
FINSI

########################################################################
# calcul temporaire du champ V3t7 (estalloc) a cause du 2VAL inoperant
########################################################################
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::timeForTCCallMO:0))
ALORS
  erreur_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::timeForTCCallMO:0)
  date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::DATEMO:0)
  date_660004671 = date_660004671 + erreur_660004671
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::estalloc, date_660004671)
FINSI

############################################################
#   Si appel d'urgence (partenaire non renseigne) on force a 0 le nombre
#   d'UM et d'UT (CNET + FTM/RT 18/02/94)
# V3t1.8 (tlserv

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
gsmTlSrv_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::teleSrvCodeMO:0)
SI (gsmTlSrv_660004671 == 0x12)
#SI app_urg
ALORS
  nbum_660004671 = 0
  nbut_660004671 = 0
  # erreur = i_set_art_field(g_iartout,$Tdpvgsm::chgcar,nbum)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::nbUT,nbut_660004671)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::tlserv,0x12)
#FINSI
## V3t1.15 (indtax)
#SI (!app_urg)
#ALORS
##Pas de calcul de prevaloristion pour appel urgent
SINON
# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  #####################################################################
  # 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_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0x01)

  #####################################################################
  #   calc_preval.cpp
  #
  #   Calcul prevalorisation et affectation des valeurs au DPV
  #
  #   LZ 16/06/00     Creation pour basculement DPV2.7 DPV2.8
  # Fichier a inclure dans un pseudo_code qui regroupe
  # la partie prevalorisation de l'artobj .
  #####################################################################

  ################################################################################
  # Les variables suivantes doivent etre definie
  #  V3t1.16 (nbut) , nbum , $Tdpvgsm::chgcar , $Tdpvgsm::nbUT
  ################################################################################

  #####################################################################
  # Cas des DPV2.8 --> nouvelle prevalorisation = fonction i_preval
  #     qui calcule uniquement nbut
  #####################################################################
  nbum_660004671 = 0xFFFF
  nbut_660004671 = 0xFFFFFFFF

  #############
  # appel preval Tcomp
  ############
  nbut_660004671 = preval_ut_660004265(g_iartout)
  nbum_660004671 = 0xFFFF

  SI (nbut_660004671 == -1 )
  ALORS
    ERREUR_660004671 = ERR_VALO_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8522 ,2 , g_iartout12, "" , 2, code_rejet_660004671, "SDE", 0)
    trace("Fin traitement: erreur prevalorisation")
    SAUT STOCKE_ERRONE
  SINON
    SI (nbut_660004671 == -2 )
    ALORS
      trace("pas de prevalorisation : retour preval == -2")
      nbut_660004671 = 0xFFFFFFFF
    SINON
      trace1("Prevalorisation OK avec valeur : %d", nbut_660004671)
    FINSI
  FINSI
  #############
  # /appel preval
  ############
FINSI

erreur_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::teleSrvCodeMO:0)
SI (erreur_660004671 == 0x12)
ALORS
  nbut_660004671 = 0x00000000
# nbum = 0x0000
FINSI

erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbUT, nbut_660004671)

trace1("NBUM = %x", i_get_art_field(g_iartout, $Tdpvgsm::chgcar))
trace1("NBUT = %x", i_get_art_field(g_iartout, $Tdpvgsm::nbUT))

# --- Modifie le 12/09/2002 : Par Hery Rakotovao
# FO8134 : Maj de la valeur du champ indtax a 0xff apres le calcul
# de prevalorisation
#
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0xff)


#
#       NR 15/02/96 Remise a 0xff de tlserv dans le DPV
#

SI (calledNumber_TR1_present_660004671 && (pt_TN1_660004671 != g_inull)  )
ALORS
  SI(isVPN_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv,0x34)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv,0x33)
  FINSI
SINON
  SI (tlserv_mod_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0xff)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, gsmTlSrv_660004671)
  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
#####################################################################
# ################################################
#   CAS DPV 3.2 : Ajout du champs T3t34 (ZBprefix)
# ################################################
SI (ZBPrefixVal_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t34","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitD_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitO_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitT_660004671)
FINSI

###################################################################
# Ajout du champ T4t35.4 (presenceInd)
###################################################################

SI ( ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode1_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode2_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode3_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode4_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode5_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode6_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode7_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode8_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode9_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode10_MO) == 0x51 ) )
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t35.4","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t35.4","presenceInd",1)
  erreur_660004671 = 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_660004671     = 0x08
  userProtocol_660004671 = 0x04
SINON
  userRate_660004671     = 0xFF
  userProtocol_660004671 = 0xFF
FINSI

transIndicator_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::transIndicMO:0)

SI ( transIndicator_present_660004671 )
ALORS
  tranInd_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::transIndicMO:0)
# 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_660004671 = 0x00
  SINON
    tranInd_660004671 = 0xFF
  FINSI
FINSI

SI ( (userRate_660004671 != 0xFF) || (userProtocol_660004671 != 0xFF) || (tranInd_660004671 != 0xFF) )
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t37","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t37","CSDaddInfo",3)
  CSDaddValue_660004671 = userRate_660004671*0x10000 + userProtocol_660004671*0x100 + tranInd_660004671
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::CSDaddInfo,CSDaddValue_660004671)
FINSI

###################################################################
# Ajout du champ T4t38.1 (origCallpartId)
###################################################################
calltype_660004671 = i_get_art_field(g_iartout, $Tdpvgsm::type)
SI ((calltype_660004671 == 0x00) || (calltype_660004671 == 0x02))
ALORS
  calledNumber_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
# %%  OGA 98 %%
    erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout4)
    erreur_660004671 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
# OGA anomalie origCallPartId | troncature qui modifie l'article IN
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartout12, g_iartout4, $Tcomp_nss9::calledNumberMO:0, $TnormalHAscii::buf, -$NORM:IDENT2,0)
# /OGA anomalie origCallPartId | troncature qui modifie l'article IN

    res_660004671 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004671)
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004671)

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  FINSI

FINSI

###################################################################
# Ajout du champ T4t38.2 (dialledDigits)
###################################################################
SI (calltype_660004671 == 0x00)
ALORS
  calledNumber_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
    lg_calledNumber_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 - 1)
    SI (lg_calledNumber_660004671 > 1)
    ALORS
# %%  OGA 98 %%
      erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout6)
      erreur_660004671 = i_ajout_tlv(g_iartout6, "T3t1", "buf")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout6, $Tcomp_nss9::calledNumberMO:0, $TnormalHAscii::buf, -$NORM:CIT_IDENT,0)

      res_660004671 = i_get_art_field(g_iartout6, $TnormalHAscii::buf -1)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.2","")
      erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::dialledDigits, g_iartout6.buf[], res_660004671)
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.2","dialledDigits", res_660004671)
# %% /OGA 98 %%
    FINSI
# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  FINSI
FINSI

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

# Debut G1R4
###################################################################
# Ajout du champ V4t52.1 (callingLocation)
###################################################################
SI flag_freeFormatData_660004671 == 1
ALORS
  #Rechercher dans la table avec la cle "CellID_OF_XXXXX" (XXXXX = CellID)
  i_strcpy(pt_temp1_660004671, i_get_tab_field("VariableContexte", date_cra_660004671, pt_CellID_OF_660004671))
  SI (i_strcmp( pt_temp1_660004671, g_inull)  != 0)
  ALORS
    b_RechTableCellID_OF1_660004671=1
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t52", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t52.1","callingLocation", 3)
    erreur_660004671 = i_retrait_tlv(g_iartout, "T4t52.2", "")
    g_iartout.callingLocation[0] = g_iartin.freeFormatData1[0]
    g_iartout.callingLocation[1] = g_iartin.freeFormatData1[1]
    g_iartout.callingLocation[2] = g_iartin.freeFormatData1[2]
    #Changer le 6 ieme digit en "F"
    erreur_660004671 = ((g_iartout.callingLocation[2]/0x10) * 0x10)
    g_iartout.callingLocation[2] = erreur_660004671 + 0x0F
  FINSI
FINSI


###########################################
# V4t18.6 (C_CSEInfo1)
#
###########################################
SI (!b_RechTableCellID_OF1_660004671)
ALORS
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::freeFormatData1))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.6","")
    SI (i_get_art_field(g_iartin,$Tcomp_nss9::freeFormatData1 - 1) <= 40)
    ALORS
      erreur_660004671 = i_dup_chp_1val(g_iartin, g_iartout, $Tcomp_nss9::freeFormatData1, $Tdpvgsm::C_CSEInfo1)
    SINON
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.6","C_CSEInfo1",40)
      indice_660004671=-1
      POINT BOUCLE1
      SI (indice_660004671 < 40)
      ALORS
        indice_660004671=indice_660004671 + 1
        g_iartout.C_CSEInfo1[indice_660004671] = g_iartin.freeFormatData1[indice_660004671]
        SAUT BOUCLE1
      FINSI
    FINSI
  FINSI
FINSI
#####################################################################
#         Stockage
#####################################################################
POINT STOCKE_DPV_SDE
trace("Tcomp_nss9/SDE - STOCKE_DPV")

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

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "SDE", 0)
  SAUT STOCKE_ERRONE
FINSI

SAUT FIN_DISTRIB
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

POINT DISTRIB_CFWD

#================================================================
#      $$    $$$$$  $         $  $$$$
#    $       $       $   $   $   $   $
#    $       $$$      $ $ $ $    $   $
#      $$    $         $   $     $$$$
#================================================================
#======== debut composite CFWD ======================================

# Debut G1R4 RHE

#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
# dans le champ calledNumber_CF
#####################################################################
##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ Tcomp_nss9::calledNumberCF:0 = calledNumber_TR2, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
ZBPrefixValCF_660004671=-1
erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberCF:0, pt_champ_660004671)
longueur_660004671=i_strlen(pt_champ_660004671)
SI (longueur_660004671 >= 8)
ALORS
  SI  ( (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,0)<12)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,1)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,2)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,3)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,4)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,5)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,6)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,7)<10) )
  ALORS

    Flag_ZB_660004671 = 0
    SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitCFD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,7)
      ZBPrefixDigitCFO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,8)
      ZBPrefixDigitCFT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,9)
      Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
    SINON
      SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitCFD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,5)
        ZBPrefixDigitCFO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,6)
        ZBPrefixDigitCFT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberCF:0,7)
        Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
      ZBPrefixDigitCFD_660004671 >= 7 && ZBPrefixDigitCFD_660004671 <= 9 &&
      ZBPrefixDigitCFO_660004671 >= 7 && ZBPrefixDigitCFO_660004671 <= 9 &&
      (ZBPrefixDigitCFT_660004671 == 1 || ZBPrefixDigitCFT_660004671 == 2 || ZBPrefixDigitCFT_660004671 == 4 || ZBPrefixDigitCFT_660004671 == 9) )
    ALORS

      SI (ZBPrefixValCF_660004671 == -1)
      ALORS
        ZBPrefixValCF_660004671=600*1000 + ZBPrefixDigitCFD_660004671*100 + ZBPrefixDigitCFO_660004671*10 + ZBPrefixDigitCFT_660004671
      FINSI

      SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
      ALORS
        ZBPrefixLong_660004671 = 6
      SINON
        ZBPrefixLong_660004671 = 8
      FINSI

      Prefix_index_660004671 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP_CF_1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF:0, Prefix_index_660004671, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberCF:0)
      ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
      SI (ZBPrefixLong_660004671 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP_CF_1
      FINSI

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

  FINSI
FINSI

# G5R2lot2 QC1429 correction de la G3R10 prefixe ZB de calledNumberTR positionne avant iti
# G3R10 ZB pour T3t34 : ZBprefix
##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ ic_calledNumberTR calcule en ligne 846, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
ZBPrefixVal_N_660004671=-1
erreur_660004671 = i_get_art_str(g_iartin, ic_calledNumberTR_660004671, pt_champ_660004671)
longueur_660004671=i_strlen(pt_champ_660004671)
SI (longueur_660004671 >= 8)
ALORS
  SI  ( (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,0)<12)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,1)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,2)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,3)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,4)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,5)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,6)<10)
    && (i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,7)<10) )
  ALORS

    Flag_ZB_660004671 = 0
    SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitN_D_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,7)
      ZBPrefixDigitN_O_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,8)
      ZBPrefixDigitN_T_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,9)
      Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
    SINON
      SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitN_D_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,5)
        ZBPrefixDigitN_O_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,6)
        ZBPrefixDigitN_T_660004671=i_get_art_fieldtab(g_iartin,ic_calledNumberTR_660004671,7)
        Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
      ZBPrefixDigitN_D_660004671 >= 7 && ZBPrefixDigitN_D_660004671 <= 9 &&
      ZBPrefixDigitN_O_660004671 >= 7 && ZBPrefixDigitN_O_660004671 <= 9 &&
      (ZBPrefixDigitN_T_660004671 == 1 || ZBPrefixDigitN_T_660004671 == 2 || ZBPrefixDigitN_T_660004671 == 4 || ZBPrefixDigitN_T_660004671 == 9) )
    ALORS

      SI (ZBPrefixVal_N_660004671 == -1)
      ALORS
        ZBPrefixVal_N_660004671=600*1000 + ZBPrefixDigitN_D_660004671*100 + ZBPrefixDigitN_O_660004671*10 + ZBPrefixDigitN_T_660004671
      FINSI

      SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
      ALORS
        ZBPrefixLong_660004671 = 6
      SINON
        ZBPrefixLong_660004671 = 8
      FINSI

      Prefix_index_660004671 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP_N_1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, Prefix_index_660004671, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
      ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
      SI (ZBPrefixLong_660004671 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP_N_1
      FINSI

      # Si T = 4 ou 9 alors forcage du TON+NPI a 41 avant normalisation
      SI (ZBPrefixDigitN_T_660004671 == 4 || ZBPrefixDigitN_T_660004671 == 9)
      ALORS
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,0,0x4)
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,1,0x1)
      FINSI
      # Si T = 1 alors forcage du TON+NPI a 11 avant normalisation
      SI (ZBPrefixDigitN_T_660004671 == 1)
      ALORS
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,0,0x1)
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,1,0x1)
      FINSI
      # Si T = 2 alors forcage du TON+NPI a 21 avant normalisation
      SI (ZBPrefixDigitN_T_660004671 == 2)
      ALORS
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,0,0x2)
        erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671,1,0x1)
      FINSI
    FINSI

  FINSI
FINSI
# /G5R2lot2 QC1429


# G3R10
#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ redirectNumber_CF pour T3t12
#####################################################################
RoutingNumberValCF_660004671=-1
RoutingNumberError_660004671 = 0
RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::redirectNumCF:0 - 1 )
SI (RoutingNumberLong_660004671 >= 8)
ALORS
  RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 0)
  RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 1)

  SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
  ALORS
    RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2)
    RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 3)

    SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)

      SI (i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671)!= g_inull)
      ALORS
        SI ( RoutingNumberValCF_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
          #--- Suppression du prefixe pour 11 33 RN *
          RoutingNumberValCF_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 3)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 4)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)

      SI (i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671)!= g_inull)
      ALORS
        SI ( RoutingNumberValCF_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
          #--- Suppression du prefixe pour 41 RN *
          RoutingNumberValCF_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumCF:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
############################################################

#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ calledNumberTR:x Service_CFWD pour T3t12 : portpref
#####################################################################
# QC1429 ajout condition ZBPrefixVal_N absent
SI (Service_CFWD_660004671 > 0 && Type_TcompCFWD_660004671 == Type02_660004671 && ZBPrefixVal_N_660004671 == -1)
ALORS
  RoutingNumberVal_N_660004671=-1
  RoutingNumberError_660004671 = 0
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, ic_calledNumberTR_660004671 - 2 )
  trace3("<<<__LINE__<<<__FILE__<<< RoutingNumberLong n =<%d>, Service_CFWD=n=<%d>", RoutingNumberLong_660004671, Service_CFWD_660004671, 0)
  SI (RoutingNumberLong_660004671 >= 8)
  ALORS
    RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 0)
    RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 1)

    SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2)
      RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 3)

      SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4) * 1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 5) * 100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 6) * 10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 7)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Lot3 Curling_Free
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberVal_N_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
            # --- Suppression du prefixe pour 11 33 RN *
            RoutingNumberVal_N_660004671=RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
          FINSI
          # G3R3 Curling Free
        SINON
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            trace ("<<__LINE__>> ====  detection sva ===========")
            #G3R4 lot1 memorisation du prefix sva
            #Prefix_SVA = RoutingNumberTmpVal
            #i_strcpy(pt_PrefixeSVA,pt_CleRoutingNumberSAC)
            # suppression du prefix sva
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
          SINON
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              trace ("<<__LINE__>> ====  detection iti ===========")
              #G3R3 lot3 memorisation du prefix itinerant
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix itinerant
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            FINSI
          FINSI
        FINSI
      FINSI
    SINON
      SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2) * 1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 3) * 100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 4) * 10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 5)
        # Debut G1R6 : appel table externe pour determiner le RN
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #G3R3 Lot3 Curling_Free
        i_strcpy(pt_portabilite_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_portabilite_660004671,"porta") == 0)
        ALORS
          SI ( RoutingNumberVal_N_660004671 != -1 )
          ALORS
            RoutingNumberError_660004671 = 1
          SINON
            # --- Suppression du prefixe pour 41 RN *
            RoutingNumberVal_N_660004671 = RoutingNumberTmpVal_660004671
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
          FINSI
          #G3R3 Curling Free
        SINON
          SI (i_strcmp(pt_portabilite_660004671,"sva") == 0)
          ALORS
            # suppression du prefix itinerant
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
            erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            #G3R4 Prefix sva
          SINON
            SI (i_strcmp(pt_portabilite_660004671,"iti") == 0)
            ALORS
              #G3R3 lot3 memorisation du prefix itinerant
              ITInerant_660004671 = RoutingNumberTmpVal_660004671
              i_strcpy(pt_ITInerant_660004671,pt_CleRoutingNumberSAC_660004671)
              # suppression du prefix sva
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
              erreur_660004671 = i_set_art_fieldtab(g_iartin, ic_calledNumberTR_660004671, 2, 0x0f)
              erreur_660004671 = i_skip_f_in_field_n(g_iartin, ic_calledNumberTR_660004671)
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
  #trace1("__FILE__:__LINE__ ##################### ======> Valeur de RoutingNumberVal_N : <%d> ", RoutingNumberVal_N)
FINSI
# /G3R10

##################################################
#G3R8lot2 prefix de joignabilite
#traitement dans champ calledNumberCF pour
#les types 06 du composite CFWD
#################################################
#G3R10 lot2 test si prefix ZB n a pas deja ete detecte pour calledNumberCF
SI (Flag_ZBCFWD_CF1_660004671 == 0)
ALORS
  SI (Type_TcompCFWD_660004671 == Type06_660004671)
  ALORS
    Length_calledNumberCF_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberCF - 1 )
    erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberCF,pt_calledNumberCF_660004671)
    Prexf1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF, 0)
    Prexf2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF, 1)
    Prexf3_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF, 2)
    Prexf4_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF, 3)

    #trace2("<<__LINE__>>=================== pt_calledNumberCF = %s ===========================",pt_calledNumberCF,"")
    # numero national
    SI ((Prexf1_660004671 == 4 && Prexf2_660004671 == 1) && Length_calledNumberCF_660004671 > 6)
    ALORS
      FlagNat_660004671 = 1
      i_get_sub_str(pt_calledNumberCF_660004671, 2, -1, pt_calledNumberCF_660004671)
      i_get_sub_str(pt_calledNumberCF_660004671, 0, -10, pt_PrefixJoing_660004671)
    SINON
      # numero inter
      SI ((Prexf1_660004671 == 1 && Prexf2_660004671 == 1 && Prexf3_660004671 == 3 && Prexf4_660004671 == 3) && Length_calledNumberCF_660004671 > 7)
      ALORS
        FlagInter_660004671 = 1
        i_get_sub_str(pt_calledNumberCF_660004671, 4, -1, pt_calledNumberCF_660004671)
        i_get_sub_str(pt_calledNumberCF_660004671, 0, -10, pt_PrefixJoing_660004671)
      FINSI
    FINSI

    i_strcpy(pt_portjoing_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoing_660004671))

    SI (i_strcmp(pt_portjoing_660004671,"joig") == 0)
    ALORS
      PREFIXJoig_660004671 = 1
    FINSI
  FINSI

FINSI
trace1 ("<<__LINE__>> =====================PREFIXjoig= %d =======================",PREFIXJoig_660004671)
trace2 ("<<__LINE__>> ====================pt_PrefixJoing = %s====================",pt_PrefixJoing_660004671,"")

#########################################
#Suppression du prefix de joignabilite
##########################################
SI (PREFIXJoig_660004671)
ALORS
  SI (FlagInter_660004671)
  ALORS
    #Cas Inter
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
    POINT BOUCLE5
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF:0, 4, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberCF:0)
      SAUT BOUCLE5
    FINSI
    #erreur = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberCF,pt_calledNumberCF)
    #trace2 ("<<__LINE__>>=============pt_calledNumberCF=%s====================", pt_calledNumberCF,"")
  FINSI
  SI (FlagNat_660004671)
  ALORS
    #Cas National
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004671)
    POINT BOUCLE6
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberCF:0, 2, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberCF:0)
      SAUT BOUCLE6
    FINSI
    #erreur = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberCF,pt_calledNumberCF)
    #trace2 ("<<__LINE__>>=============pt_calledNumberCF=%s====================", pt_calledNumberCF,"")
  FINSI
FINSI
#############################################
# Fin traitemnt  du prefix joignabilite
#\G3R8lot2 prefix joignabilite
###########################################
#####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################
# Si IMSI non itineris
#G3R7 Gestion du code MNC pour les MVNOs Lights
#SI !b_IMSICF1_ORANGE
SI (IMSI_OrangeCo_660004671 == 0)
ALORS
  is_roamers_660004671 = 1
FINSI

SI ( (i_get_art_field(g_iartin,$Tcomp_nss9::callingNumberCF - 1) == 2)
  && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 0) == 4 )
  && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 1) == 1 )
  && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 2) == 0 )
  && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 3) == 0x0f ) )
ALORS
  ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 8)
  indice_duptab_660004671 = 8
SINON
  SI (is_roamers_660004671)
  ALORS
    # indice 7 de la table de duplication qui correspond au numero 2 du CRA TcompCF_nss9
    #
    ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 7)
    indice_duptab_660004671 = 7
  SINON
    # indice 5 de la table de duplication qui correspond au numero 0 du CRA TcompCF_nss9
    # G3R7 Gestion des MVNOs lights normalisation du champ V3t2/V3t" avec MET_ASN1_NEW_2242/MET_ASN1_NEW
    SI IMSI_OrangeCo_660004671
    ALORS
      ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 5)
      indice_duptab_660004671 = 5
    FINSI
  FINSI
FINSI
trace1("Tcomp_nss9/CF indice_duptab : <%d>",indice_duptab_660004671)

SI (ic_660004671 != 0)
ALORS
  trace("Tcomp_nss9/CF : Creation DPV impossible")
  ERREUR_660004671 = ERR_DUPL_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", indice_duptab_660004671)
  SAUT STOCKE_ERRONE
FINSI

#####################################################################
# QC1232 evolution champ tterm pour FREE
# T3t1.14 (tterm)
# tterm   :-  :-  :MSET :FF
# avec Tcomp_nss9/disconnPartyCF
#####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::disconnPartyCF))
ALORS
  res_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::disconnPartyCF)
  SI (res_660004671 == 0 || res_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004671 == 2)
    ALORS
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI

# Debut G1R4 RHE
# Modif pour Type06 apres dup pour Type02
SI (Type_TcompCFWD_660004671 == Type06_660004671)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::type, 0x06)
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tentite, 0x01)
FINSI
# Fin G1R4 RHE

###################################################################
# calcul temporaire du champ DATE a cause du 2VAL inoperant
###################################################################
date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::ddebut)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004671)


##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiCF_660004671,"")
i_strcpy(str_exchDCBCF_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiCF,str_exchasciiCF_660004671)
trace2("################# str_exchasciiCF = %s ################",str_exchasciiCF_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiCF_660004671," ")
trace1("############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
	i_get_sub_str (str_exchasciiCF_660004671, 0, position_660004671 - 1 ,str_exchasciiCF_660004671)
	trace2("<<<__LINE__<<<__FILE__<<< ################# str_exchasciiCF modifie = %s ################",str_exchasciiCF_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiCF_660004671,str_exchDCBCF_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBCF_660004671, longueur_660004671)

# traduction en un entier 16 bit du champ OICK
# et creation du champ dans l'article en sortie
#QC1252 point 1 et 3
SI (Type_TcompCFWD_660004671 == Type02_660004671)
ALORS
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::oIcKCF) || i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC1) || Service_CFWD_660004671 >= 2)
  ALORS
    ####################################################################
    # V4t11.1 nbsvcIN
    ###################################################################
    #SI (Service_CFWD > 0)
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::oIcKCF))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.1", "")
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, 1)
    SINON
      erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.1", "")
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, Service_CFWD_660004671)
    FINSI

    ####################################################################
    # V4t11.2 lstSVCIN
    ###################################################################
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::oIcKCF))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
      erreur_660004671 = i_resize_tlv(g_iartout, "T4t11.2", "lstSVCIN", 2)

      digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKCF:0, 0)
      digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKCF:0, 1)
      digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKCF:0, 2)
      val_OICK_660004671 = digit1_660004671*100 + digit2_660004671*10 + digit3_660004671

      #  --- ecriture de l'octet de poids fort
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (val_OICK_660004671 / 256))
      #  --- ecriture de l'octet de poids faible
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1, (val_OICK_660004671 & 0xFF))
    SINON
      SI (Service_CFWD_660004671 > 0)
      ALORS
        erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
        erreur_660004671 = i_resize_tlv(g_iartout, "T4t11.2", "lstSVCIN", Service_CFWD_660004671 * 2)

        SI (i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC1))
        ALORS
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (g_iartin.serviceKeyIC1[4] * 16 + g_iartin.serviceKeyIC1[5]))
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1 ,(g_iartin.serviceKeyIC1[6] * 16 + g_iartin.serviceKeyIC1[7]))
        FINSI
        SI (Service_CFWD_660004671 >= 2 && i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC2))
        ALORS
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 2, (g_iartin.serviceKeyIC2[4] * 16 + g_iartin.serviceKeyIC2[5]))
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 3, (g_iartin.serviceKeyIC2[6] * 16 + g_iartin.serviceKeyIC2[7]))
        FINSI
        SI (Service_CFWD_660004671 >= 3 && i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC3))
        ALORS
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 4, (g_iartin.serviceKeyIC3[4] * 16 + g_iartin.serviceKeyIC3[5]))
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 5, (g_iartin.serviceKeyIC3[6] * 16 + g_iartin.serviceKeyIC3[7]))
        FINSI
        SI (Service_CFWD_660004671 >= 4 && i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC4))
        ALORS
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 6, (g_iartin.serviceKeyIC4[4] * 16+ g_iartin.serviceKeyIC4[5]))
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 7, (g_iartin.serviceKeyIC4[6] * 16+ g_iartin.serviceKeyIC4[7]))
        FINSI
        SI (Service_CFWD_660004671 == 5 && i_valid_field_n(g_iartin, $Tcomp_nss9::serviceKeyIC5))
        ALORS
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 8, (g_iartin.serviceKeyIC5[4] * 16 + g_iartin.serviceKeyIC5[5]))
          erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 9, (g_iartin.serviceKeyIC5[6] * 16 + g_iartin.serviceKeyIC5[7]))
        FINSI
      FINSI
    FINSI

    ####################################################################
    # V4t11.3 SCPIN
    ###################################################################
    coLocated_IC_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::coLocated_IC)
    pointCSSNum_IC_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::pointCSSNum_IC)
    globalTitle_IC_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::globalTitle_IC)
    globalTSSNum_IC_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::globalTSSNum_IC)

    SI (coLocated_IC_present_660004671==1)
    ALORS
      trace("Le champ Tcomp_nss9::coLocated_IC est present, mais de type NULL, il n'est donc pas recopie en sortie")
    SINON
      SI (pointCSSNum_IC_present_660004671==1)
      ALORS
        erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.3", "")
        taille_chp_660004671 = (i_get_art_field(g_iartin, $Tcomp_nss9::pointCSSNum_IC-1))*8
        erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.3","SCPIN", taille_chp_660004671 )
        erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::SCPIN, i_get_art_fieldptr(g_iartin, $Tcomp_nss9::pointCSSNum_IC), taille_chp_660004671)
      SINON
        SI (globalTitle_IC_present_660004671==1)
        ALORS
          erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.3", "")
          taille_chp_660004671 = (i_get_art_field(g_iartin, $Tcomp_nss9::globalTitle_IC-1))*8
          erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.3","SCPIN", taille_chp_660004671)
          erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::SCPIN, i_get_art_fieldptr(g_iartin, $Tcomp_nss9::globalTitle_IC), taille_chp_660004671)
        SINON
          SI (globalTSSNum_IC_present_660004671==1)
          ALORS
            erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.3", "")
            taille_chp_660004671 = (i_get_art_field(g_iartin, $Tcomp_nss9::globalTSSNum_IC-1))*8
            erreur_660004671 = i_resize_tlv(g_iartout,"T4t11.3","SCPIN", taille_chp_660004671)
            erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::SCPIN, i_get_art_fieldptr(g_iartin, $Tcomp_nss9::globalTSSNum_IC), taille_chp_660004671)
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
# fin de la condition Type02

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

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

SI (i_valid_field_n(g_iartin, $Tcomp_nss9::intIncomCallCF:0))
ALORS
  SI (i_get_art_field(g_iartin, $Tcomp_nss9::intIncomCallCF:0) == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::origine,1)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::origine,0)
  FINSI
FINSI

#####################################################################
# Traitement du champ Portability Origin Network (T3t6)
#
#####################################################################
# Debut G1R4 RHE
SI (Type_TcompCFWD_660004671 == Type02_660004671)
ALORS
  origLocatNum_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::origLocNumberCF:0)

  SI (origLocatNum_present_660004671)
  ALORS
    indice_chp_origLocNb_660004671 = $Tcomp_nss9::origLocNumberCF:0
  SINON
    indice_chp_origLocNb_660004671 = $Tcomp_nss9::origLocNumTR:0
  FINSI

  # --- On verifie que le champ origLocNumber est present
  origLocNum_present_660004671 = i_valid_field_n(g_iartin, indice_chp_origLocNb_660004671)
  SI (origLocNum_present_660004671)
  ALORS
    SI (i_get_art_field(g_iartin, indice_chp_origLocNb_660004671-1) == 0)
    ALORS
      origLocNum_present_660004671 = 0
    FINSI
  FINSI

  # --- Si le champ est absent le T3t6 du DPV sera absent
  SI (origLocNum_present_660004671)
  ALORS
    #
    # on prend la taille du champ que l on divise par 8 car la taille de "origLocNumber" est donnee en "bit"
    #
    taille_660004671 = i_get_art_field(g_iartin, indice_chp_origLocNb_660004671-1)
    SI (taille_660004671 >= 2)
    ALORS
      TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, indice_chp_origLocNb_660004671, 0)
      NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, indice_chp_origLocNb_660004671, 1)
      # --- portOrigNet sera absent du DPV si en entree le champ
      # --- origLocNumber a un TON NPI different de 41 (E///)
      # --- ou A1 (alcatel)  et si le
      # --- numero ne commence pas par 61 ou 62 ou 63

      SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
      ALORS
        # --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, indice_chp_origLocNb_660004671,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)

        SI ( erreur_660004671 != 0 )
        ALORS
          trace("Tcomp_nss9 :CF erreur de duplication du portOrigNet")
          ERREUR_660004671 = ERR_NORM_660004671
          code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
          erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "portOrigNet")
          SAUT STOCKE_ERRONE
          #SAUT STOCKE_RECYCLE
        FINSI
      FINSI
    FINSI
  FINSI
SINON
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::origLocNumberCF:0))
  ALORS
    indice_chp_origLocNb_660004671 = $Tcomp_nss9::origLocNumberCF:0
    taille_660004671 = i_get_art_field(g_iartin, indice_chp_origLocNb_660004671-1)
    SI (taille_660004671 >= 2)
    ALORS
      TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, indice_chp_origLocNb_660004671, 0)
      NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, indice_chp_origLocNb_660004671, 1)
      # --- portOrigNet sera absent du DPV si en entree le champ
      # --- origLocNumber a un TON NPI different de 41 (E///)
      # --- ou A1 (alcatel)  et si le
      # --- numero ne commence pas par 61 ou 62 ou 63

      SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
      ALORS
        # --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, indice_chp_origLocNb_660004671,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)

        SI ( erreur_660004671 != 0 )
        ALORS
          trace("Tcomp_nss9 :CF erreur de duplication du portOrigNet")
          ERREUR_660004671 = ERR_NORM_660004671
          code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
          erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "portOrigNet")
          SAUT STOCKE_ERRONE
          #SAUT STOCKE_RECYCLE
        FINSI
      FINSI
    FINSI
  FINSI
FINSI

# Debut G1R4 RHE
#####################################################################
# Ajout T3t8 (msgITX) pour le CFWD Type06
#####################################################################
#G5R1
# CFWD: ajout de T3t8/msgITX si (bT3T8ITX == 1) et si (Type_TcompCFWD == Type06)
#SI (Type_TcompCFWD == Type06)
SI (Type_TcompCFWD_660004671 == Type06_660004671) && (bT3T8ITX_660004671 == 1)
ALORS
  SI (i_valid_field_n(g_iartin,$Tcomp_nss9::NumOfMrPulseCF))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t8","")
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $Tcomp_nss9::NumOfMrPulseCF))
    trace("Type_TcompCFWD = Type06 : Ajout de T3t8/msgITX")
  FINSI
FINSI

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

#####################################################################
# Traitement des champs transporteurs sortant et entrants
# T3t16 : TrSortant, T3t17 : TrEntrant
#####################################################################
# G3R10
# ---- Duplication du champ transporteur Sortant
# T3t16 : TrSortant
SI (Service_CFWD_660004671 > 0 && i_valid_field_n(g_iartin, ic_outgoingRouteTR_660004671))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,(ic_outgoingRouteTR_660004671 - 2))
  SI (tailleChpTrans_660004671 > 7)
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout, "T3t16", "TrSortant", tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin, ic_outgoingRouteTR_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI
# /G3R10
#
# ---- Duplication du champ transporteur Entrant
# T3t17 : TrEntrant
tailleChpTrans_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::incomingRouteCF:0 -1))
SI ((tailleChpTrans_660004671 <= 7 ) && (i_valid_field_n(g_iartin, $Tcomp_nss9::incomingRouteCF:0)))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004671 = i_resize_tlv(g_iartout, "T3t17", "TrEntrant", tailleChpTrans_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoutCF1[], tailleChpTrans_660004671)
SINON
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::incomingRouteCF:0))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004671 = i_resize_tlv(g_iartout, "T3t17", "TrEntrant",7)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoutCF1[], 7)
  FINSI
FINSI


#####################################################################
# Traitement des champs CAMEL
# T4t18.1 : C_CallRefNum, T4t18.2 : C_MSCAddress, T4t18.3 : C_SrvAddress1, T4t18.4 : C_DestNum1, T4t18.5 : C_Key1, T4t18.6 : C_CSEInfo1
#####################################################################

# Debut G1R4 RHE
SI (Type_TcompCFWD_660004671 == Type02_660004671)
ALORS
  gSMCallRefNum_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::gSMCallRefNumCF:0)
  mSCaddress_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::mSCAddressCF:0)
  CAMEL_SCFAdr_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::CAMEL_SCFAdrCF:0)
  CAMEL_servkey_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::CAMEL_servkeyCF:0)
  calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
  CAMEL_initCF_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::CAMEL_initCFCF:0)

  SI ( (gSMCallRefNum_present_660004671) || (mSCaddress_present_660004671) || (CAMEL_SCFAdr_present_660004671)  || (CAMEL_servkey_present_660004671) )
  ALORS
    # --- Test de coherence chp oblig
    SI (!gSMCallRefNum_present_660004671)
    ALORS
      trace("Tcomp_nss9/CF : Erreur chp gSMCallRefNum absent")
      ERREUR_660004671 = ERR_CROISE_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "gSMCallRefNum")
      SAUT STOCKE_ERRONE
    FINSI

    SI (!mSCaddress_present_660004671)
    ALORS
      trace("Tcomp_nss9/CF : Erreur chp mSCaddress absent")
      ERREUR_660004671 = ERR_CROISE_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "mSCaddress")
      SAUT STOCKE_ERRONE
    FINSI

    SI (!CAMEL_SCFAdr_present_660004671)
    ALORS
      trace("Tcomp_nss9/CF : Erreur chp CAMEL_SCFAdr absent")
      ERREUR_660004671 = ERR_CROISE_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "CAMEL_SCFAdr")
      SAUT STOCKE_ERRONE
    FINSI

    SI (!CAMEL_servkey_present_660004671)
    ALORS
      trace("Tcomp_nss9/CF: Erreur chp CAMEL_servkey absent")
      ERREUR_660004671 = ERR_CROISE_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "CAMEL_servkey")
      SAUT STOCKE_ERRONE
    FINSI
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.1","")
    taillegSMCallRefNum_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::gSMCallRefNumCF:0 -1)
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.1","C_CallRefNum",taillegSMCallRefNum_660004671*8)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_CallRefNum,g_iartin.gSMCallRefNuCF1[],taillegSMCallRefNum_660004671)

    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9/CF : Erreur dup champ gSMCallRefNum")
      ERREUR_660004671 = ERR_DUPL_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8521 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "C_CallRefNum")
      SAUT STOCKE_ERRONE
    FINSI
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.2","")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::mSCAddressCF:0,$Tdpvgsm::C_MSCAddress,-$NORM:MET_ASN1_NEW,0)

    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9/CF : Erreur dup champ MSCAddress")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "C_MSCAddress")
      SAUT STOCKE_ERRONE
    FINSI
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.3","")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::CAMEL_SCFAdrCF:0,$Tdpvgsm::C_SrvAddress1,-$NORM:MET_ASN1_NEW,0)

    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9/CF :Erreur dup champ SCFAddress")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "C_SrvAddress1")
      SAUT STOCKE_ERRONE
    FINSI
#G3R10
    SI (Service_CFWD_660004671 > 0 && i_valid_field_n(g_iartin, ic_calledNumberTR_660004671))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.4","")
      SI (is_roamers_660004671)
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, ic_calledNumberTR_660004671, $Tdpvgsm::C_DestNum1,-$NORM:ROAMERS2, 0)
      SINON
        #G3R7 Gestion des MVNOs light normalisation du champ V4t18.4 avec MET_ASN1_NEW
        SI IMSI_OrangeCo_660004671
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, ic_calledNumberTR_660004671, $Tdpvgsm::C_DestNum1, -$NORM:MET_ASN1_NEW, 0)
        FINSI
      FINSI
# /G3R10
      SI ( erreur_660004671 != 0)
      ALORS
        trace1("Tcomp_nss9/CF : Erreur dup champ calledNb(TR), Service_CFWD=<%d>",Service_CFWD_660004671)
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "C_DestNum1")
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.5","")
    erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::C_Key1,g_iartin.CAMELservkeyCF1[],4)

    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9/CF: Erreur dup champ service Key1")
      ERREUR_660004671 = ERR_DUPL_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8521 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "C_Key1")
      SAUT STOCKE_ERRONE
    FINSI
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Level1,0xF)

    SI (CAMEL_initCF_present_660004671)
    ALORS
      erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,0x1)
    SINON
      erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,0xF)
    FINSI
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_DefChInd1,0xF)
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Modif1,0xF)
  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
#####################################################################

#################################################
#  CAS DPV 3.2 : Ajout du champs T3t34 : ZBprefix
#################################################
SI (ZBPrefixValCF_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t34", "")
  erreur_660004671 = i_resize_tlv(g_iartout, "T3t34", "ZBprefix", 3 * 8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 0, 6)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 1, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 2, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 3, ZBPrefixDigitCFD_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 4, ZBPrefixDigitCFO_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 5, ZBPrefixDigitCFT_660004671)
SINON
  SI (Type_TcompCFWD_660004671 == Type02_660004671 && ZBPrefixVal_N_660004671 != -1)
  ALORS
    # G3R10
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t34", "")
    erreur_660004671 = i_resize_tlv(g_iartout, "T3t34", "ZBprefix", 3 * 8)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 0, 6)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 1, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 2, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 3, ZBPrefixDigitN_D_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 4, ZBPrefixDigitN_O_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 5, ZBPrefixDigitN_T_660004671)
  FINSI
  # /G3R10
FINSI

###################################################################
# Ajout du champ T4t38.1 origCallpartId
###################################################################
calledNumber_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberCF:0)
SI (calledNumber_present_660004671)
ALORS
  # %%  OGA 98 %%
  erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout4)
  erreur_660004671 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout4, $Tcomp_nss9::calledNumberCF:0, $TnormalHAscii::buf, -$NORM:IDENT2,0)

  res_660004671 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.1","")
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004671)
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004671)
  # %% /OGA 98 %%
FINSI

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

# Debut G1R4
###################################################################
# Ajout du champ V4t52.1 callingLocation
###################################################################
SI flag_freeFormatData_660004671 == 1
ALORS
  #Rechercher dans la table avec la cle "CellID_OF_XXXXX" (XXXXX = CellID)
  i_strcpy(pt_temp1_660004671, i_get_tab_field("VariableContexte", date_cra_660004671, pt_CellID_OF_660004671))
  SI (i_strcmp( pt_temp1_660004671, g_inull)  != 0)
  ALORS
    b_RechTableCellID_OF1_660004671=1
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t52", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t52.1","callingLocation", 3)
    erreur_660004671 = i_retrait_tlv(g_iartout, "T4t52.2", "")
    g_iartout.callingLocation[0] = g_iartin.freeFormatData1[0]
    g_iartout.callingLocation[1] = g_iartin.freeFormatData1[1]
    g_iartout.callingLocation[2] = g_iartin.freeFormatData1[2]
    #Changer le 6 ieme digit en "F"
    erreur_660004671 = ((g_iartout.callingLocation[2]/0x10) * 0x10)
    g_iartout.callingLocation[2] = erreur_660004671 + 0x0F
  FINSI
FINSI
###########################################
# V4t18.6 (C_CSEInfo1)
###########################################
SI (!b_RechTableCellID_OF1_660004671)
ALORS
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::freeFormatData1))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.6","")
    SI (i_get_art_field(g_iartin,$Tcomp_nss9::freeFormatData1 - 1) <= 40)
    ALORS
      erreur_660004671 = i_dup_chp_1val(g_iartin, g_iartout, $Tcomp_nss9::freeFormatData1, $Tdpvgsm::C_CSEInfo1)
    SINON
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.6","C_CSEInfo1",40)
      indice_660004671=-1
      POINT BOUCLE2
      SI (indice_660004671 < 40)
      ALORS
        indice_660004671=indice_660004671 + 1
        g_iartout.C_CSEInfo1[indice_660004671] = g_iartin.freeFormatData1[indice_660004671]
        SAUT BOUCLE2
      FINSI
    FINSI
  FINSI
FINSI

#############################################################
# G3R3 lot2 mapping ABC (CFWD) ajout champ T3t63 LastCallingNb
###############################################################
#QC859 Correction alimentation dub champ T3t63(LastCalling)
redirectNumCF_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumCF:0 - 1))
SI (redirectNumCF_present_660004671 && RoutingNumberLong_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
  SI (is_roamers_660004671)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::redirectNumCF:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
  SINON
    #G3R7 gestion des MVNOs lights normalisation de V3t63 avec MET_ASN1_NEW
    SI IMSI_OrangeCo_660004671
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::redirectNumCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW,0)
    FINSI
  FINSI

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

SINON
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::callingNumberCF:0))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
    SI ( (i_get_art_field(g_iartin,$Tcomp_nss9::callingNumberCF:0 - 1) == 2)
      && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 0) == 4 )
      && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 1) == 1 )
      && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 2) == 0 )
      && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 3) == 0x0f ) )
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_410,0)
    SINON
      SI (is_roamers_660004671)
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
      SINON
        #G3R7 Gestion des MVNOs lights normalisation de V3t63 avec MET_ASN1_NEW_2242
        SI IMSI_OrangeCo_660004671
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW_2242,0)
        FINSI
      FINSI
    FINSI

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

  FINSI
FINSI


#################################################################
# G5R3  (Ajout T3t64(RedirectingNb)
# QC1460
################################################################

SI (redirectNumCF_present_660004671)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t64","")

  SI IMSI_OrangeCo_660004671
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumCF:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW,0)
  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumCF:0,$Tdpvgsm::RedirectingNb,-$NORM:ROAMERS2,0)
  FINSI
FINSI


#QC1142
##########################################################
#G3R8 lot2 Ajout du champ T3t70 si joignabilite detecte
#Type_TcompCFWD == Type06 (Oublie en G3R8C1 lot2)
########################################################
SI (Type_TcompCFWD_660004671 == Type06_660004671)
ALORS
  SI (PREFIXJoig_660004671==1)
  ALORS
    #trace2("<<__LINE__>>---------Creation T3t70 pt_PrefixJoing=%s ---------",pt_PrefixJoing,"")
    erreur_660004671  = i_ajout_tlv(g_iartout,"T3t70","")
    longueur_660004671 = i_conv_ascii_dcb(pt_PrefixJoing_660004671,pt_PrefixJoingDCB_660004671)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004671, longueur_660004671)
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t70","PrefixeSVA",longueur_660004671 * 8)
  FINSI
FINSI
#\QC1142

#####################################################################
# Stockage
#####################################################################
POINT STOCKE_DPV_CF
trace("Tcomp_nss9/CF - STOCKE_DPV")

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

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "CFWD", 0)
  SAUT STOCKE_ERRONE
FINSI

#####################################################################
# Creation du pseudo DPV
#####################################################################
pseudo_DPV_660004671 = 0
# QC534 : IMSI <> 20801 comme au GSMCE au lieu de <> 208
# Si IMSI  non Orange France ( <> 20801 ), on generera un pseudo DPV
# CFWD de Type02 = pseudo DPV, CFWD de Type06 = pas de pseudo DPV

#G3R7 Gestion des MVNOs light creation d un pseudo DPV a partir de IMSI_OrangeCo
SI (Type_TcompCFWD_660004671 == Type02_660004671)
ALORS
  SI (IMSI_OrangeCo_660004671 == 0)
  ALORS
    pseudo_DPV_660004671 = 1
  FINSI
FINSI

# =======TRAITEMENT PSEUDO DPV ==========================================
SI pseudo_DPV_660004671
ALORS
  #####################################################################
  #  Traitement d'un eventuel prefixe de portabilite
  #  dans le champ CF.redirectingNumber
  #####################################################################
# debut

# FIN
  # Duplication en pseudo DPV en utilisant la table de duplication d'indice 6
  #
  # indice 6 de la table de duplication qui correspond au numero 1 du CRA TcompCF_nss9
  #
  ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 6)
  indice_duptab_660004671 = 6
  SI (ic_660004671 != 0)
  ALORS
#   type_erreur = CODE_ERREUR_DUPLICATION
#   erreur = i_stocke_errone(g_iartin,stocke_date,dom_rejete,type_erreur,g_ieec)
#   trace("TcompCF_nss9 : Creation Pseudo_DPV impossible => Rejet")
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", indice_duptab_660004671)
#   RETOUR TRAIT_OK
    SAUT STOCKE_ERRONE
  FINSI

# tterm   :-  :-  :MSET :FF  , pas de calcul pour le pseudo

  ##################################################################
  # QC396, QC1292 suite NonReg G5R1C6
  # T3t1.3 idemet du pseudo
  ##################################################################
  # QC1292
  i_strcpy(str_exchasciiCF_660004671,"")
  i_strcpy(str_exchDCBCF_660004671,"")
  erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiCF,str_exchasciiCF_660004671)
  trace2("################# str_exchasciiCF = %s ################",str_exchasciiCF_660004671,"")
  position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiCF_660004671," ")
  trace1("############ position= %d ###########",position_660004671)
  SI ( position_660004671 > -1)
  ALORS
  	i_get_sub_str (str_exchasciiCF_660004671, 0, position_660004671 - 1 ,str_exchasciiCF_660004671)
  	trace2("<<<__LINE__<<<__FILE__<<< ################# str_exchasciiCF modifie = %s ################",str_exchasciiCF_660004671,"")
  FINSI
  longueur_660004671 = i_conv_ascii_dcb (str_exchasciiCF_660004671,str_exchDCBCF_660004671 )
  SI (longueur_660004671 > 9)
  ALORS
  	longueur_660004671 = 9
  FINSI
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBCF_660004671, longueur_660004671)


  ###################################################################
  # calcul temporaire du champ DATE a cause du 2VAL inoperant
  ###################################################################
  date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::ddebut)
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004671)

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

  #####################################################################
  #  Mise a jour du T3 portability prefix (T3t12)
  #####################################################################
  #debut
  SI ( RoutingNumberValCF_660004671 != -1 )
  ALORS
    # --- Si un prefixe RN a ete trouve alors mise a jour du champ du DPV
    trace ("<<__LINE__>> ===== 1 =====================")
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t12", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberValCF_660004671 / 1000) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberValCF_660004671 / 100)  % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberValCF_660004671 / 10)   % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberValCF_660004671 % 10)          )
  FINSI
  #FIN
  #####################################################################
  # 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_660004671 = i_memset_field_n(g_iartout,$Tdpvgsm::local,0x00)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 0,0x02)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 2,0x08)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local, 4,0x01)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::local,13,0x0f)

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

  # --- Si le champ est absent le T3t6 du DPV sera absent
  SI (origLocNum_present_660004671)
  ALORS
    #
    # on prend la taille du champ que l on divise par 8 car la taille de "origLocNumber_CF" est donnee en "bit"
    #
    taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumberCF:0 -1)
    SI (taille_660004671 >= 2)
    ALORS
      TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumberCF:0, 0)
      NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumberCF:0, 1)
      # --- portOrigNet sera absent du DPV si en entree le champ
      # --- origLocNumber a un TON NPI different de 41 (E///)
      # --- ou A1 (alcatel)  et si le
      # --- numero ne commence pas par 61 ou 62 ou 63

      SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
      ALORS
        # --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumberCF:0,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
        SI ( erreur_660004671 != 0 )
        ALORS
          trace("Erreur duplication champ portOrigNet")
          ERREUR_660004671 = ERR_NORM_660004671
          code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
          erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "CFWD", "portOrigNet")
          SAUT STOCKE_ERRONE
        FINSI
      FINSI
    FINSI
  FINSI

  #####################################################################
  # Traitement du champ transporteur entrant
  #
  #####################################################################
  #
  # ---- Duplication du champ transporteur Entrant
  #
  tailleChpTrans_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::incomingRouteCF:0 -1))

  SI ((tailleChpTrans_660004671 <= 7 )
    && (i_valid_field_n(g_iartin, $Tcomp_nss9::incomingRouteCF:0)))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
    erreur_660004671 = i_resize_tlv(g_iartout, "T3t17", "TrEntrant", tailleChpTrans_660004671)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoutCF1[], tailleChpTrans_660004671)
  SINON
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::incomingRouteCF:0))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
      erreur_660004671 = i_resize_tlv(g_iartout, "T3t17", "TrEntrant", 7)
      erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, g_iartin.incomingRoutCF1[], 7)
    FINSI
  FINSI

  #####################################################################
  # Traitement d'un eventuel prefixe Zone Blanche
  #####################################################################

  #################################################
  #  CAS DPV 3.2 : Ajout du champs T3t34 : ZBprefix
  #################################################
  SI (ZBPrefixValCF_660004671 != -1)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t34", "")
    erreur_660004671 = i_resize_tlv(g_iartout, "T3t34", "ZBprefix", 3*8)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 0, 6)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 1, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 2, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 3, ZBPrefixDigitCFD_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 4, ZBPrefixDigitCFO_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 5, ZBPrefixDigitCFT_660004671)
  SINON
    # G3R10
    SI (ZBPrefixVal_N_660004671 != -1)
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout, "T3t34", "")
      erreur_660004671 = i_resize_tlv(g_iartout, "T3t34", "ZBprefix", 3*8)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 0, 6)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 1, 0)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 2, 0)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 3, ZBPrefixDigitN_D_660004671)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 4, ZBPrefixDigitN_O_660004671)
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::ZBprefix, 5, ZBPrefixDigitN_T_660004671)
    FINSI
    # /G3R10
  FINSI

  ###################################################################
  # Ajout du champ T4t38.1 origCallpartId
  ###################################################################
  calledNumber_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberCF:0)
  SI (calledNumber_present_660004671)
  ALORS
    # %%  OGA 98 %%
    erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout4)
    erreur_660004671 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout4, $Tcomp_nss9::calledNumberCF:0, $TnormalHAscii::buf, -$NORM:IDENT2,0)

    res_660004671 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
    erreur_660004671 = i_ajout_tlv(g_iartout, "T4t38.1", "")
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004671)
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004671)
    # %% /OGA 98 %%
  FINSI

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

  ###################################################################
  # G3R3 lot 2 Mapping ABC Ajout du champ V3t63 LastCallingNb
  ###################################################################
#QC860 correction alimentation du champ T3t63 (LastCallingNb pour le pseudo dpvgsm Mail du 27/04/11 17:28
  redirectNumCF_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumCF:0)
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumCF:0 - 1))

  SI (redirectNumCF_present_660004671 && RoutingNumberLong_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
    SI (is_roamers_660004671)
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::redirectNumCF:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::redirectNumCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW,0)
    FINSI

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

  SINON
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::callingNumberCF:0))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
      SI ( (i_get_art_field(g_iartin,$Tcomp_nss9::callingNumberCF:0 - 1) == 2)
        && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 0) == 4 )
        && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 1) == 1 )
        && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 2) == 0 )
        && (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::callingNumberCF:0, 3) == 0x0f ) )
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_410,0)
      SINON
        SI (is_roamers_660004671)
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2,0)
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberCF:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW_2242,0)
        FINSI
      FINSI

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

    FINSI
  FINSI

#---------------------------------------------------------------------------------------------------------------------
  #  Stockage du Pseudo DPV
  SAUT STOCKE_PSEUDO_DPV_CF

  ######################################################################
  #           Stockage Pseudo DPV
  ######################################################################

  POINT STOCKE_PSEUDO_DPV_CF

  trace("Tcomp_nss9/CF - STOCKE_DPV")

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

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

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

  erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Oui_660004671)
  # QC1005
  SI (erreur_660004671 == TRAI_KO_660004671)
  ALORS
    trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
#   ERREUR = ERR_DISTR
#   code_rejet = MODULE + ERREUR + EFFICACE
#   erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "CFWD", 0)
    SAUT STOCKE_ERRONE
  FINSI
FINSI

# ======== FIN DU TRAITEMENT PSEUDO DPV =======================================
# ######################### Fin de traitement Tcomp_nss9/CFWD ####################
#================================================================
SAUT FIN_DISTRIB

#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

POINT DISTRIB_SDETR
#================================================================
#    $$$$   $$$$    $$$$$    $$$$$$$    $$$$
#   $___    $   $   $__         $       $   $
#       $   $   $   $           $       $ $
#   $$$$    $$$$    $$$$$       $       $    $
#================================================================
#####################################################################
# Choix de la table de duplication
#####################################################################

#debut G1R8 app_urg : remonte ici
#####################################################################
# appel urgent:
# - si champ "tlserv" du CRA = 0x12 => appel urgent
#####################################################################
# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc

#
# si le CRA est VPN, on a isVPN = 1
#
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR1)
SI (calledNumber_TR1_present_660004671)
ALORS
  val_Camel_660004671 = i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,0)*256*256*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,1)*256*256*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,2)*256*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,3)*256*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,4)*256*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,5)*256
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,6)*16
  + i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,7)

  erreur_660004671= i_EntierToString(val_Camel_660004671,str_Camel_660004671,11)
  erreur_660004671=i_format_str2(pt_cleVPN_660004671,"%s%s","NSS9_VPN_",str_Camel_660004671)

  SI(i_get_tab_field("Marque_VPN",date_cra_660004671,pt_cleVPN_660004671) != g_inull)
  ALORS
    isVPN_660004671 = 1
  FINSI
FINSI

#
#         (si le champ est present car il est optionnel)
#
calledNumber_present_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
SI (calledNumber_present_660004671 > 0 )
ALORS
  TON_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 0)
  NPI_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 1)
FINSI

# On valide la suppression des caracteres speciaux
flag_rm_escape_char_660004671=1
#SI b_IMSIMO1_ORANGE
#G3R7 Gestion des MVNOs light normalisatuion du champ V3t2 avec MET_ASN1_NEW_VPN ou MET_ASN1_NEW
SI IMSI_OrangeCo_660004671
ALORS
  SI ( isVPN_660004671 == 1 )
  ALORS
    indice_duptab_660004671 = DUP_TAB_NORMITINERIS_SDETR_VPN_660004671
  SINON
    indice_duptab_660004671 = DUP_TAB_NORMITINERIS_SDETR_660004671
  FINSI
SINON
  #   Cas des ROAMERS
  is_roamers_660004671 = 1
  #
  # on passe maintenant par une duplication intermidiaire pour tester la normalisation du champ
  #
  erreur_660004671 = i_dup_art_tab(g_iartin, g_iartout4, "Tnormal3")
  trace1("SDETR : retour i_dup_art_tab sur Tnormal3 = %d",erreur_660004671)
  SI (erreur_660004671 < 0)
  ALORS
    # Cas echec normalisation idpart
    SI ( isVPN_660004671 == 1 )
    ALORS
      erreur_660004671 = i_dup_art_tab(g_iartin, g_iartout4, "TnormalTlv")
      trace1("retour i_dup_art_tab sur TnormalTlv = %d",erreur_660004671)

      SI (erreur_660004671 < 0)
      ALORS
        indice_duptab_660004671 = DUP_TAB_ECHECNORM_SDETR_660004671
      SINON
        indice_duptab_660004671 = DUP_TAB_NORMROAMERS_SDETR_VPN_660004671
      FINSI
    SINON
      indice_duptab_660004671 = DUP_TAB_NORMROAMERS_SDETR_VPN_660004671
    FINSI
  SINON
    SI ( isVPN_660004671 == 1 )
    ALORS
      indice_duptab_660004671 = DUP_TAB_NORMROAMERS_SDETR_VPN_660004671
    SINON
      indice_duptab_660004671 = DUP_TAB_NORMROAMERS_SDETR_660004671
    FINSI
  FINSI

  SI (calledNumber_present_660004671 > 0 )
  ALORS
    SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
    ALORS

      dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
      SI (dig3_660004671!=0)
      ALORS
#         On invalide la suppression des caracteres speciaux
        flag_rm_escape_char_660004671=0
      FINSI
    FINSI
  FINSI
FINSI
#####################################################################
# Pour le service Transgroupe (OICK=4), retrait du prefixe 0 (TON=2)
#####################################################################

digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 0)
digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 1)
digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 2)
digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 3)

SI ( ( digit1_660004671 == 0 ) && ( digit2_660004671 == 0 ) && ( digit3_660004671 == 4 ) && ( digit4_660004671 == 0x0f ) )
ALORS
  dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
  SI ( ( TON_660004671 == 2 ) && ( dig3_660004671 == 0 ) )
  ALORS
    erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2, 0x0f)
    erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberMO:0)
  SINON
    #####################################################################
    # MB FE425 Ajout du prefixe 8588 pour les numeros courts on-net
    #          L'article change de nom pour pouvoir utiliser un autre
    #          automate
    #        Pas de prefixe 0 d'echappement
    # MB EV624 L'article ne change plus de nom, mais de table de duplication
    #####################################################################

    SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
    ALORS
      indice_duptab_660004671 = DUP_TAB_NORMTGROUPE_SDETR_660004671
    FINSI
  FINSI
  #     Cas des ROAMERS
FINSI

#       Suppression des caracteres speciaux
SI ((calledNumber_present_660004671 > 0) && (flag_rm_escape_char_660004671==1))
ALORS
# fonction inconnue de platine
# erreur = i_rm_escape_char_end(g_iartin, $Tcomp_nss9::calledNumber_MO:0)
#
# fonction equivalente :
#
  indice_660004671 = 2
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
  taille_660004671 = taille_660004671 * 2

  POINT BOUCLE_DEBUT_SDETR
  SI (indice_660004671 < taille_660004671)
  ALORS
    val_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_660004671)
    SI (val_660004671 > 9)
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_660004671, 15)
    FINSI
    indice_660004671 = indice_660004671 + 1
    SAUT BOUCLE_DEBUT_SDETR
  FINSI
FINSI

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

#####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################

# Duplication avec choix de la table
ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", indice_duptab_660004671)

SI (ic_660004671 != 0)
ALORS
  ERREUR_660004671 = ERR_DUPL_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", indice_duptab_660004671)
  SAUT STOCKE_ERRONE
FINSI

#G5R1
# SEDTR: ajout de T3t8/msgITX si (bT3T8ITX == 1) et indice_duptab == {9, 10, 12, 13, 17, 18}
SI (bT3T8ITX_660004671 == 1) &&
  ((indice_duptab_660004671 == 9)
  || (indice_duptab_660004671 == 10)
  || (indice_duptab_660004671 == 12)
  || (indice_duptab_660004671 == 13)
  || (indice_duptab_660004671 == 17)
  || (indice_duptab_660004671 == 18))
ALORS
  SI (i_valid_field_n(g_iartin,$Tcomp_nss9::numOfMrPulseTR:0))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t8","")
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, i_get_art_field(g_iartin, $Tcomp_nss9::numOfMrPulseTR:0))
    trace ("Type_TcompSDETR:  Ajout du champ msgITX")
  FINSI
FINSI

#####################################################################
# QC1232 evolution champ tterm pour FREE
# T3t1.14 (tterm)
# tterm   :-  :-  :MSET :FF
# avec Tcomp_nss9/disconnPartyMO
#####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::disconnPartyMO))
ALORS
  res_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::disconnPartyMO)
  SI (res_660004671 == 0 || res_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004671 == 2)
    ALORS
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI
#######################

SI (indice_duptab_660004671 == DUP_TAB_NORMTGROUPE_SDETR_660004671)
ALORS
  # DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
  SI ((dig3_660004671 < 1) || (dig3_660004671 > 9))
  ALORS
    trace("Tcomp_nss9 : Normalisation TRANSGROUPE SDETR NOK")
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR" ,indice_duptab_660004671)
    SAUT STOCKE_ERRONE
  FINSI
  taille_idpart_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t2", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t2", "idpart", (taille_idpart_660004671+2)*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 0, 0x3)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 1, 0x3)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 2, 0x8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 3, 0x5)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 4, 0x8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::idpart, 5, 0x8)
  indice_idpart_660004671 = 6
  indice_called_660004671 = 2

  POINT BOUCLE_IDPART_SDE_TR
  Digit_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, indice_called_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, indice_idpart_660004671, Digit_660004671)

  indice_idpart_660004671 = indice_idpart_660004671 + 1
  indice_called_660004671 = indice_called_660004671 + 1

  SI (indice_called_660004671 < taille_idpart_660004671*2)
  ALORS
    SAUT BOUCLE_IDPART_SDE_TR
  FINSI
# FINSI
FINSI

###################################################################
# calcul temporaire du champ DATE a cause du 2VAL inoperant
###################################################################
date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::ddebut)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004671)

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiMO_660004671,"")
i_strcpy(str_exchDCBMO_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiMO,str_exchasciiMO_660004671)
trace2("################# str_exchasciiMO = %s ################",str_exchasciiMO_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiMO_660004671," ")
trace1("############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
	i_get_sub_str (str_exchasciiMO_660004671, 0, position_660004671 - 1 ,str_exchasciiMO_660004671)
	trace2("<<<__LINE__<<<__FILE__<<< ################# str_exchasciiMO modifie = %s ################",str_exchasciiMO_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiMO_660004671,str_exchDCBMO_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBMO_660004671, longueur_660004671)

###################################################################
# MAJ du V3t1.19
###################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::1RdioChnlUsedMO:0) == 0)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::support1, 0x00)
FINSI

#####################################################################
# FE2242 : OLA 28/12/04
# Si la normalisation echoue et si IMSI roamer, recopie du
# CalledPartyNumber ds le champ V3t2 sans le TON+NPI
#####################################################################
SI (indice_duptab_660004671 == DUP_TAB_ECHECNORM_SDETR_660004671)
ALORS
#  Cas Echec normalisation : copie sans TON+NPI
  calledNumber_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
#
# on prend la taille du champ que l on divise par 8 car la taille de "calledNumber_MO" est donnee en "bit"
#
    taille_idpart_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)

    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t2", "")
    trace("SDETR : Echec normalisation : copie sans TON+NPI")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberMO:0, $Tdpvgsm::idpart, -$NORM:CIT_IDENT, 0)

    SI (erreur_660004671)
    ALORS
      trace("SDETR : Erreur duplication idpart 2242")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "idpart")
      SAUT STOCKE_ERRONE
      RETOUR TRAIT_OK
    FINSI

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  FINSI
FINSI
trace("SDETR : fin traitement idpart 2242")

# FE 312
# traduction en un entier 16 bit du champ OICK
# et creation du champ dans l'article en sortie

serviceKey_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKey_IC:0)
OICK_present_660004671       = i_valid_field_n(g_iartin,$Tcomp_nss9::oIcKMO:0)

####################################################################
# V4t11.1 nbsvcIN
###################################################################
#QC1252  point 2
SI  (Service_SDETR_660004671 > 0 || OICK_present_660004671)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.1", "")

  SI OICK_present_660004671
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, 1)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbsvcIN, Service_SDETR_660004671)
  FINSI
FINSI

#QC1229 1234
####################################################################
# V4t11.2 lstSVCIN
###################################################################
SI ( OICK_present_660004671 )
ALORS
  val_OICK_660004671 = digit1_660004671*100 + digit2_660004671*10 + digit3_660004671
  #  --- DPV TLV : mise a jour lstSVCIN
  erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
  #  --- la taille 2 correspond a 2 octet (taille d'une clef)
  erreur_660004671 = i_resize_tlv(g_iartout, "T4t11.2", "lstSVCIN", 2)
  #  --- ecriture de l'octet de poids fort
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (val_OICK_660004671 / 256) )
  #  --- ecriture de l'octet de poids faible
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1, (val_OICK_660004671 & 0xFF) )
SINON
  SI (Service_SDETR_660004671 > 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T4t11.2", "")
    erreur_660004671 = i_resize_tlv(g_iartout, "T4t11.2", "lstSVCIN", 2 * Service_SDETR_660004671)

    SI (i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKeyIC1))
    ALORS
      #  --- attention le champ ServiceKey du Tsde_nss9 est sur 4 octets
      #  --- on ne copie que les 2 octets de poids faible
      #  --- ecriture de l'octet de poids fort
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 0, (g_iartin.serviceKeyIC1[4]*16+g_iartin.serviceKeyIC1[5]))
      #  --- ecriture de l'octet de poids faible
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 1, (g_iartin.serviceKeyIC1[6]*16+g_iartin.serviceKeyIC1[7]))
    FINSI
    SI (Service_SDETR_660004671 >= 2 && i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKeyIC2))
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 2, (g_iartin.serviceKeyIC2[4]*16+g_iartin.serviceKeyIC2[5]))
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 3, (g_iartin.serviceKeyIC2[6]*16+g_iartin.serviceKeyIC2[7]))
    FINSI
    SI (Service_SDETR_660004671 >= 3 && i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKeyIC3))
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 4, (g_iartin.serviceKeyIC3[4]*16+g_iartin.serviceKeyIC3[5]))
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 5, (g_iartin.serviceKeyIC3[6]*16+g_iartin.serviceKeyIC3[7]))
    FINSI
    SI (Service_SDETR_660004671 >= 4 && i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKeyIC4))
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 6, (g_iartin.serviceKeyIC4[4]*16+g_iartin.serviceKeyIC4[5]))
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 7, (g_iartin.serviceKeyIC4[6]*16+g_iartin.serviceKeyIC4[7]))
    FINSI
    SI (Service_SDETR_660004671 == 5 && i_valid_field_n(g_iartin,$Tcomp_nss9::serviceKeyIC5))
    ALORS
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 8, (g_iartin.serviceKeyIC5[4]*16+g_iartin.serviceKeyIC5[5]))
      erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::lstSVCIN, 9, (g_iartin.serviceKeyIC5[6]*16+g_iartin.serviceKeyIC5[7]))
    FINSI
  FINSI

FINSI

####################################################################
# V4t11.3 SCPIN
###################################################################
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR1)
SI (calledNumber_TR1_present_660004671)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t11.3","")

#  --- Normalisation du numero SCPIN dans l'article de sortie DPV
  SI (is_roamers_660004671)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::SCPIN,-$NORM:ROAMERS2,0)
  SINON
    #G3R7 Gestion des MVNOs T4t11.3 normalise avec MET_ASN1_SCPIN
    SI IMSI_OrangeCo_660004671
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::SCPIN,-$NORM:MET_ASN1_SCPIN,0)
    FINSI
  FINSI

  SI ( erreur_660004671 != 0)
  ALORS
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "SCPIN")
    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_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#####################################################################
# Traitement du system type
#
#####################################################################

SI (i_valid_field_n(g_iartin,$Tcomp_nss9::rNCidOf1stRNCMO:0))
ALORS
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::systype,0x01)
FINSI

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

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004671)
ALORS
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumTR:0 -1)

  SI (taille_660004671 >= 2)
  ALORS
    TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 0)
    NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 1)

    # --- portOrigNet sera absent du DPV si en entree le champ
    # --- origLocNumber a un TON NPI different de 41 (E///)
    # --- ou A1 (alcatel)  et si le
    # --- numero ne commence pas par 61 ou 62 ou 63
    SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
    ALORS

# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumTR:0,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)

      SI ( erreur_660004671 != 0 )
      ALORS
        trace("SDETR : Erreur dup_chp_rnis - T3t6")
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "portOrigNet")
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement du champs transporteurs sortant et entrant
#
#####################################################################
#
# ---- Duplication du champ transporteur Sortant
#

tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::outgoingRouteTR:1 - 1))

SI    ((tailleChpTrans_660004671 <= 7 ) && (i_valid_field_n(g_iartin,$Tcomp_nss9::outgoingRouteTR:0)))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004671)
# erreur = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, g_iartin.outgoingRouteTR[], tailleChpTrans)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::outgoingRouteTR:1)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI

#G1R8 deplacer plus haut #####################################################################
#G1R8 # appel urgent:
#G1R8 # - si champ "tlserv" du CRA = 0x12 => appel urgent
#G1R8 #####################################################################

#####################################################################
# Prise en compte du champ "service support":
# Si teleservice == 0xff et service support renseigne
#   -> on renseigne teleservice pour la valorisation et le CTDC
#####################################################################

SI (calledNumber_TR1_present_660004671)
ALORS
  str_calledNumberTR_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR1)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR_660004671,15,1,str_calledNumberTRtmp_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp_660004671,2, 9,  str_calledNumberTRtmp_660004671)
  pt_TN1_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp_660004671)
FINSI

calledNumber_TR2_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR2)
SI (calledNumber_TR2_present_660004671)
ALORS
  str_calledNumberTR2_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR2)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR2_660004671,15,1,str_calledNumberTRtmp2_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp2_660004671,2, 9,  str_calledNumberTRtmp2_660004671)
  pt_TN2_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp2_660004671)
FINSI

#G3R10 lot1 debut####################
calledNumber_TR3_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR3)
SI (calledNumber_TR3_present_660004671)
ALORS
  str_calledNumberTR3_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR3)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR3_660004671,15,1,str_calledNumberTRtmp3_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp3_660004671,2, 9,  str_calledNumberTRtmp3_660004671)
  pt_TN3_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp3_660004671)
FINSI

calledNumber_TR4_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR4)
SI (calledNumber_TR4_present_660004671)
ALORS
  str_calledNumberTR4_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR4)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR4_660004671,15,1,str_calledNumberTRtmp4_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp4_660004671,2, 9,  str_calledNumberTRtmp4_660004671)
  pt_TN4_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp4_660004671)
FINSI


calledNumber_TR5_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR5)
SI (calledNumber_TR5_present_660004671)
ALORS
  str_calledNumberTR5_660004671=i_get_art_fieldptr(g_iartin,$Tcomp_nss9::calledNumberTR5)
  erreur_660004671=i_ConvertirChaine(str_calledNumberTR5_660004671,15,1,str_calledNumberTRtmp5_660004671,15,3)
  i_get_sub_str(str_calledNumberTRtmp5_660004671,2, 9,  str_calledNumberTRtmp5_660004671)
  pt_TN5_660004671 = i_get_tab_field("MARQUE_TN_ERICSSON",date_cra_660004671,str_calledNumberTRtmp5_660004671)
FINSI

#G3R10 lot1 fin###################

tlserv_mod_660004671 = 0
gsmTlSrv_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::teleSrvCodeMO:0)

SI ((gsmTlSrv_660004671 & 0xff) == 0xff)
ALORS
  tlserv_mod_660004671 = 1
  svcsup_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::bearerSvcCodeMO:0)

  SI( (pt_TN1_660004671== g_inull) && (pt_TN2_660004671== g_inull) )
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,svcsup_660004671)
  SINON
    #Valeur par defaut
    SAUT FIN_SVCSUP_SDETR
  FINSI

  Q1_660004671 = svcsup_660004671 & 0xf0
  Q2_660004671 = svcsup_660004671 & 0x0f

  SI ((Q1_660004671 != 0x10) && (Q1_660004671 != 0x90))
  ALORS
    SAUT ERR_SVCSUP_SDETR
  FINSI

  SI (Q2_660004671 && (Q2_660004671 < 0x07))
  ALORS
    vsvcsup_660004671 = 0x16
    SAUT OK_SVCSUP_SDETR
  FINSI

  SI ((Q2_660004671 > 0x09) && (Q2_660004671 < 0x0f) && (Q2_660004671 != 0x0b))
  ALORS
    vsvcsup_660004671 = 0x1e
    SAUT OK_SVCSUP_SDETR
  FINSI

  SI (Q2_660004671 == 0x07)
  ALORS
    vsvcsup_660004671 = 0x17
    SAUT OK_SVCSUP_SDETR
  FINSI

  SI (Q2_660004671 == 0x0F)
  ALORS
    vsvcsup_660004671 = 0x1f
    SAUT OK_SVCSUP_SDETR
  FINSI

  POINT   ERR_SVCSUP_SDETR

  trace1("SDETR : Erreur champ service support -> 0x%x", svcsup_660004671)
  trace1("SDETR : Erreur champ service support -> 0x%d", svcsup_660004671)

  SAUT FIN_SVCSUP_SDETR

  POINT   OK_SVCSUP_SDETR

  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::svcsup,vsvcsup_660004671)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::tlserv,vsvcsup_660004671)
FINSI

POINT   FIN_SVCSUP_SDETR

#####################################################################
# Traitement des champs CAMEL
#
#####################################################################
gSMCallRefNum_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::gSMCallRefNumMO:0)
mSCaddress_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::mSCAddressMO:0)
CAMEL_SCFAdr_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::CAMEL_SCFAdrMO:0)
CAMEL_servkey_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0)
calledNumber_TR1_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR1)

SI ( (gSMCallRefNum_present_660004671) || (mSCaddress_present_660004671) || (CAMEL_SCFAdr_present_660004671) || (CAMEL_servkey_present_660004671) )
ALORS
# --- Test de coherence chp oblig
  SI (!gSMCallRefNum_present_660004671)
  ALORS
    # erreur = MESSTRAD0(DEST_JNL, "Erreur chp gSMCallRefNum_MO absent")
    # type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "gSMCallRefNum_MO")
    SAUT STOCKE_ERRONE
    # SAUT STOCKE_RECYCLE
  FINSI

  SI (!mSCaddress_present_660004671)
  ALORS
    # erreur = MESSTRAD0(DEST_JNL, "Erreur chp mSCaddress_MO absent")
    # type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "mSCaddress_MO")
    SAUT STOCKE_ERRONE
    # SAUT STOCKE_RECYCLE
  FINSI

  SI (!CAMEL_SCFAdr_present_660004671)
  ALORS
    # erreur = MESSTRAD0(DEST_JNL, "Erreur chp CAMEL_SCFAdr_MO absent")
    # type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "CAMEL_SCFAdr_MO")
    SAUT STOCKE_ERRONE
    # SAUT STOCKE_RECYCLE
  FINSI

  SI (!CAMEL_servkey_present_660004671)
  ALORS
    # erreur = MESSTRAD0(DEST_JNL, "Erreur chp CAMEL_servkey_MO absent")
    # type_erreur = CODE_ERREUR_SYNTAXIQUE
    ERREUR_660004671 = ERR_CROISE_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8520 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "CAMEL_servkey_MO")
    SAUT STOCKE_ERRONE
    # SAUT STOCKE_RECYCLE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.1","")
  taillegSMCallRefNum_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::gSMCallRefNumMO:0 -1)
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.1","C_CallRefNum",taillegSMCallRefNum_660004671*8)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_CallRefNum, g_iartin.gSMCallRefNuMO1[], taillegSMCallRefNum_660004671)

  SI ( erreur_660004671 != 0)
  ALORS
    # erreur = MESSTRAD0(DEST_JNL, "Erreur dup champ gSMCallRefNum")
    # type_erreur = CODE_ERREUR_DUPLICATION
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_CallRefNum")
    SAUT STOCKE_ERRONE
    # SAUT STOCKE_RECYCLE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.2","")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::mSCAddressMO:0, $Tdpvgsm::C_MSCAddress, -$NORM:MET_ASN1_NEW, 0)

  SI ( erreur_660004671 != 0)
  ALORS
    trace("SDETR: Erreur dup champ MSCAddress")
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_MSCAddress")
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.3","")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::CAMEL_SCFAdrMO:0, $Tdpvgsm::C_SrvAddress1, -$NORM:MET_ASN1_NEW, 0)

  SI ( erreur_660004671 != 0)
  ALORS
    trace("SDETR : Erreur dup champ SCFAddress")
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_SrvAddress1")
    SAUT STOCKE_ERRONE
  FINSI

  SI (calledNumber_TR1_present_660004671)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.4","")

    SI (is_roamers_660004671)
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:ROAMERS2, 0)
    SINON
      #G3R7 Gestion des MVNOs lights normalisation T4t18.4 avec MET_ASN1_SCPIN_VPN ou MET_ASN1_SCPIN
      SI IMSI_OrangeCo_660004671
      ALORS
        SI(i_get_tab_field("VariableContexte",date_cra_660004671,"SDE_SDETR_V4t18_4_VPN") != g_inull)
        ALORS
          trace("## SDE_SDETR_V4t18_4_VPN present => normalisation V4t18.4 avec MET_ASN1_SCPIN_VPN")
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:MET_ASN1_SCPIN_VPN, 0)
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberTR1, $Tdpvgsm::C_DestNum1, -$NORM:MET_ASN1_SCPIN, 0)
        FINSI
      FINSI
    FINSI

    SI ( erreur_660004671 != 0)
    ALORS
      trace("SDETR : Erreur dup champ calledNb(TR)")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_DestNum1")
      SAUT STOCKE_ERRONE
    FINSI
  FINSI

  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.5","")
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::C_Key1, g_iartin.CAMELservkeyMO1[], 4)

  SI ( erreur_660004671 != 0)
  ALORS
    trace("Tcomp_nss9 : Erreur dup champ service Key1")
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8521 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_Key1")
    SAUT STOCKE_ERRONE
  FINSI

  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Level1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_InitCfInd1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_DefChInd1,0xF)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::C_Modif1,0xF)

  SI (calledNumber_TR2_present_660004671)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.10","")
    SI (is_roamers_660004671)
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout, $Tcomp_nss9::calledNumberTR2, $Tdpvgsm::C_DestNum2, -$NORM:ROAMERS2, 0)
    SINON
      #G3R7 Gestion des MVNOs lights T4t18.10 normalise avec MET_ASN1_SCPIN
      SI IMSI_OrangeCo_660004671
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::calledNumberTR2, $Tdpvgsm::C_DestNum2, -$NORM:MET_ASN1_SCPIN, 0)
      FINSI
    FINSI

    SI ( erreur_660004671 != 0)
    ALORS
      trace("SDETR : Erreur dup champ calledNb(TR2)")
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "SDETR", "C_DestNum2")
      SAUT STOCKE_ERRONE
    FINSI
  FINSI
FINSI

###################################################################
# calcul temporaire du champ estalloc a cause du 2VAL inoperant
###################################################################
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::timeForTCCallMO:0))
ALORS
  erreur_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::timeForTCCallMO:0)
  date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::DATEMO:0)
  date_660004671 = date_660004671 + erreur_660004671
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::estalloc, date_660004671)
FINSI

############################################################
#   Si appel d'urgence (partenaire non renseigne) on force a 0 le nombre
#   d'UM et d'UT (CNET + FTM/RT 18/02/94)
#

# DEBUT 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
gsmTlSrv_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::teleSrvCodeMO:0)
SI (gsmTlSrv_660004671 == 0x12)
#SI app_urg
ALORS
  nbum_660004671 = 0
  nbut_660004671 = 0
  # erreur = i_set_art_field(g_iartout,$Tdpvgsm::chgcar,nbum)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::nbUT,nbut_660004671)
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::tlserv,0x12)
#FINSI
SINON
# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
#SI (!app_urg)
#ALORS
  #####################################################################
  # 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_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0x01)

  #####################################################################
  #   calc_preval.cpp
  #
  #   Calcul prevalorisation et affectation des valeurs au DPV
  #
  #   LZ 16/06/00     Creation pour basculement DPV2.7 DPV2.8
  # Fichier a inclure dans un pseudo_code qui regroupe
  # la partie prevalorisation de l'artobj .
  #####################################################################

  #####################################################################
  # Les variables suivantes doivent etre definie
  #  nbut , nbum , $Tdpvgsm::chgcar , $Tdpvgsm::nbUT
  #####################################################################

  #####################################################################
  # Cas des DPV2.8 --> nouvelle prevalorisation = fonction i_preval
  #     qui calcule uniquement nbut
  #####################################################################
  nbum_660004671 = 0xFFFF
  nbut_660004671 = 0xFFFFFFFF

  #############
  # appel preval Tcomp
  ############
  nbut_660004671 = preval_ut_660004265(g_iartout)

  nbum_660004671 = 0xFFFF
  SI (nbut_660004671 == -1 )
  ALORS
    ERREUR_660004671 = ERR_VALO_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8522 ,2 , g_iartout12, "" , 2, code_rejet_660004671, "SDETR", 0)
    trace("Fin traitement: erreur prevalorisation")
    SAUT STOCKE_ERRONE
  SINON
    SI (nbut_660004671 == -2 )
    ALORS
      trace("pas de prevalorisation : retour preval == -2")
      nbut_660004671 = 0xFFFFFFFF
    SINON
      trace1("Prevalorisation OK avec valeur : %d", nbut_660004671)
    FINSI
  FINSI
  #############
  # /appel preval
  ############
FINSI

erreur_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::teleSrvCodeMO:0)
SI (erreur_660004671 == 0x12)
ALORS
  nbut_660004671 = 0x00000000
# nbum = 0x0000
FINSI

#erreur = i_set_art_field(g_iartout, $Tdpvgsm::chgcar, nbum)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::nbUT, nbut_660004671)

trace1("SDETR : NBUM = %x", i_get_art_field(g_iartout, $Tdpvgsm::chgcar))
trace1("SDETR : NBUT = %x", i_get_art_field(g_iartout, $Tdpvgsm::nbUT))

# --- Modifie le 12/09/2002 : Par Hery Rakotovao
# FO8134 : Maj de la valeur du champ indtax a 0xff apres le calcul
# de prevalorisation
#
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::indtax, 0xff)

#
#       NR 15/02/96 Remise a 0xff de tlserv dans le DPV
#
#G3R10 debut *********************************************
SI Service_SDETR_660004671 == 2
ALORS
  SI (calledNumber_TR2_present_660004671 && pt_TN2_660004671 != g_inull)
  ALORS
    MARQUE_TN_660004671 = 1
  FINSI
SINON
  SI Service_SDETR_660004671 == 3
  ALORS
    SI (calledNumber_TR3_present_660004671 && pt_TN3_660004671 != g_inull)
    ALORS
      MARQUE_TN_660004671 = 1
    FINSI
  SINON
    SI Service_SDETR_660004671 == 4
    ALORS
      SI (calledNumber_TR4_present_660004671 && pt_TN4_660004671 != g_inull)
      ALORS
        MARQUE_TN_660004671 = 1
      FINSI
    SINON
      SI  Service_SDETR_660004671 == 5
      ALORS
        SI (calledNumber_TR5_present_660004671 && pt_TN5_660004671 != g_inull)
        ALORS
          MARQUE_TN_660004671 = 1
        FINSI

      FINSI
    FINSI
  FINSI
FINSI

val_Camel_660004671 = i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,0)*256*256*256*16
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,1)*256*256*256
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,2)*256*256*16
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,3)*256*256
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,4)*256*16
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,5)*256
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,6)*16
+ i_get_art_fieldtab(g_iartin,$Tcomp_nss9::CAMEL_servkeyMO:0,7)

erreur_660004671= i_EntierToString(val_Camel_660004671,str_Camel_660004671,11)
erreur_660004671=i_format_str2(pt_cleVPN_660004671,"%s%s","NSS9_VPN_",str_Camel_660004671)

SI MARQUE_TN_660004671 == 1
ALORS
  SI(i_get_tab_field("Marque_VPN",date_cra_660004671,pt_cleVPN_660004671) != g_inull)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv,0x34)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv,0x33)
  FINSI
SINON
  SI (tlserv_mod_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, 0xff)
  SINON
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tlserv, gsmTlSrv_660004671)
  FINSI
FINSI
#G3R10 FIN *********************************************

#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
#####################################################################
# ########################################
#   CAS DPV 3.2 : Ajout du champs T3t34
# ########################################
SI (ZBPrefixVal_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t34","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitD_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitO_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitT_660004671)
FINSI

###################################################################
# Ajout du champ T4t35.4 presenceInd
###################################################################

SI ( ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode1_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode2_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode3_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode4_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode5_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode6_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode7_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode8_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode9_MO ) == 0x51 )
  || ( i_get_art_field(g_iartin,$Tcomp_nss9::sSCode10_MO) == 0x51 ) )
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T4t35.4","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T4t35.4","presenceInd",1)
  erreur_660004671 = 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_660004671     = 0x08
  userProtocol_660004671 = 0x04
SINON
  userRate_660004671     = 0xFF
  userProtocol_660004671 = 0xFF
FINSI
transIndicator_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::transIndicMO:0)

SI ( transIndicator_present_660004671 )
ALORS
  tranInd_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::transIndicMO:0)
# 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_660004671 = 0x00
  SINON
    tranInd_660004671 = 0xFF
  FINSI
FINSI

SI ( (userRate_660004671 != 0xFF) || (userProtocol_660004671 != 0xFF) || (tranInd_660004671 != 0xFF) )
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t37","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t37","CSDaddInfo",3)
  CSDaddValue_660004671 = userRate_660004671*0x10000 + userProtocol_660004671*0x100 + tranInd_660004671
  erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::CSDaddInfo,CSDaddValue_660004671)
FINSI

###################################################################
# Ajout du champ T4t38.1 origCallpartId
###################################################################
calltype_660004671 = i_get_art_field(g_iartout, $Tdpvgsm::type)
SI ((calltype_660004671 == 0x00) || (calltype_660004671 == 0x02))
ALORS
  calledNumber_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
# %%  OGA 98 %%
    erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout4)
    erreur_660004671 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
# OGA anomalie origCallPartId | troncature qui modifie l'article IN
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartout12, g_iartout4, $Tcomp_nss9::calledNumberMO:0, $TnormalHAscii::buf, -$NORM:IDENT2,0)
# /OGA anomalie origCallPartId | troncature qui modifie l'article IN

    res_660004671 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004671)
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004671)
# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc
  FINSI
FINSI


###################################################################
# Ajout du champ T4t38.2 dialledDigits
###################################################################

SI (calltype_660004671 == 0x00)
ALORS
  calledNumber_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberMO:0)
  SI (calledNumber_present_660004671)
  ALORS
    lg_calledNumber_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::calledNumberMO:0 - 1)
    SI (lg_calledNumber_660004671 > 1)
    ALORS
# %%  OGA 98 %%
      erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout6)
      erreur_660004671 = i_ajout_tlv(g_iartout6, "T3t1", "buf")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout6, $Tcomp_nss9::calledNumberMO:0, $TnormalHAscii::buf, -$NORM:CIT_IDENT,0)

      res_660004671 = i_get_art_field(g_iartout6, $TnormalHAscii::buf -1)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.2","")
      erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::dialledDigits, g_iartout6.buf[], res_660004671)
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.2","dialledDigits", res_660004671)
# %% /OGA 98 %%
    FINSI

# FIN 15/04/2009 - DRE - G2R2 -  Retour arriere urgence 112 spec: CRA_Tcomp_nss9_A25.0.doc

  FINSI
FINSI

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

# Debut G1R4
###################################################################
# Ajout du champ V4t52.1 callingLocation
###################################################################
SI (flag_freeFormatData_660004671 != 0)
ALORS
  #Rechercher dans la table avec la cle "CellID_OF_XXXXX" (XXXXX = CellID)
  i_strcpy(pt_temp1_660004671, i_get_tab_field("VariableContexte", date_cra_660004671, pt_CellID_OF_660004671))
  SI (i_strcmp( pt_temp1_660004671, g_inull)  != 0)
  ALORS
    #QC253
    b_RechTableCellID_OF1_660004671=1
    #\QC253
    SI flag_freeFormatData_660004671 == 1
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout, "T3t52", "")
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t52.1","callingLocation", 3)
      erreur_660004671 = i_retrait_tlv(g_iartout, "T4t52.2", "")
      g_iartout.callingLocation[0] = g_iartin.freeFormatData1[0]
      g_iartout.callingLocation[1] = g_iartin.freeFormatData1[1]
      g_iartout.callingLocation[2] = g_iartin.freeFormatData1[2]
    FINSI
    #Changer le 6 ieme digit en "F"
    erreur_660004671 = ((g_iartout.callingLocation[2]/0x10) * 0x10)
    g_iartout.callingLocation[2] = erreur_660004671 + 0x0F
  FINSI
FINSI

###########################################
# V4t18.6 (C_CSEInfo1)
##G3R10 lot 1 modification des condtuions de valorisation du champ V4t18.6 (C_CSEInfo1)
###########################################
SI (!b_RechTableCellID_OF1_660004671)
ALORS
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::freeFormatData1))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t18.6","")
    SI (i_get_art_field(g_iartin,$Tcomp_nss9::freeFormatData1 - 1) <= 40)
    ALORS
      erreur_660004671 = i_dup_chp_1val(g_iartin, g_iartout, $Tcomp_nss9::freeFormatData1, $Tdpvgsm::C_CSEInfo1)
    SINON
      erreur_660004671 = i_resize_tlv(g_iartout,"T4t18.6","C_CSEInfo1",40)
      indice_660004671=-1
      POINT BOUCLE3
      SI (indice_660004671 < 40)
      ALORS
        indice_660004671=indice_660004671 + 1
        g_iartout.C_CSEInfo1[indice_660004671] = g_iartin.freeFormatData1[indice_660004671]
        SAUT BOUCLE3
      FINSI
    FINSI
  FINSI
FINSI
#####################################################################
#         Stockage
#####################################################################
POINT STOCKE_DPV_SDETR
trace("Tcomp_nss9/SDETR - STOCKE_DPV")

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

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "SDETR", 0)
  SAUT STOCKE_ERRONE
FINSI

SAUT FIN_DISTRIB
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

POINT DISTRIB_TR

#================================================================
#     $$$$$$$    $$$$
#        $       $   $
#        $       $ $
#        $       $    $
#================================================================


# Traitement specifique composite TRANSIT :
# - determination du champ servant a enrichir idpart
# - si redirectNumTR ou OrigCalledNum, prenormalisation
# - recopie du champ detecte (eventuellement prenormalise) dans l'ajout CE idpart



#G1R6 lot3
val_Key_660004671=i_get_art_fieldtab (g_iartin, $Tcomp_nss9::serviceKeyIC1, 6) * 10
val_Key_660004671 = val_Key_660004671 + i_get_art_fieldtab (g_iartin, $Tcomp_nss9::serviceKeyIC1, 7)
trace1("----------val_Key=%d-------------",val_Key_660004671)
SI (val_Key_660004671 == 47 || val_Key_660004671 == 48)
ALORS
  typeCRA_660004671 = 0x08
SINON
  typeCRA_660004671 = 0x06
FINSI
#/G1R6 lot3



#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
# dans le champ redirectNumTR_TR1
#####################################################################
##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ $Tcomp_nss9::redirectNumTR:0, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
ZBPrefixVal_660004671=-1
erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::redirectNumTR:0, pt_champ_660004671)
longueur_660004671=i_strlen(pt_champ_660004671)
SI (longueur_660004671 >= 8)
ALORS
  SI  ( (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,0)<12)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,1)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,2)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,3)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,4)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,5)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,6)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,7)<10) )
  ALORS

    Flag_ZB_660004671 = 0
    SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,7)
      ZBPrefixDigitO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,8)
      ZBPrefixDigitT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,9)
      Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
    SINON
      SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,5)
        ZBPrefixDigitO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,6)
        ZBPrefixDigitT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0,7)
        Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
      ZBPrefixDigitD_660004671 >= 7 && ZBPrefixDigitD_660004671 <= 9 &&
      ZBPrefixDigitO_660004671 >= 7 && ZBPrefixDigitO_660004671 <= 9 &&
      (ZBPrefixDigitT_660004671 == 1 || ZBPrefixDigitT_660004671 == 2 || ZBPrefixDigitT_660004671 == 4 || ZBPrefixDigitT_660004671 == 9) )
    ALORS

      SI (ZBPrefixVal_660004671 == -1)
      ALORS
        ZBPrefixVal_660004671=600*1000 + ZBPrefixDigitD_660004671*100 + ZBPrefixDigitO_660004671*10 + ZBPrefixDigitT_660004671
      FINSI

      SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
      ALORS
        ZBPrefixLong_660004671 = 6
      SINON
        ZBPrefixLong_660004671 = 8
      FINSI

      Prefix_index_660004671 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP_redir_1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, Prefix_index_660004671, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
      ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
      SI (ZBPrefixLong_660004671 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP_redir_1
      FINSI

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

  FINSI
FINSI

######################################################################
# Traitement d'un eventuel prefix Zone Blanche sortant
# dans le champ T3t5TR2/T4t5.16 translatedNum
#########################################################################################
#############################################################################################
# Traitement d'un eventuel prefixe Zone Blanche sortant, valorisera le champ DPV V3t57
# dans le champ T3t17/$Tcomp_nss9::translatedNum:1 = translatedNum2
# G1R6 lot4
# 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)
#############################################################################################
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::translatedNum:1))
ALORS
  erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::translatedNum:1, pt_champ_660004671)
  longueur_660004671=i_strlen(pt_champ_660004671)
  Flag_ZB_660004671 = 0
  SI (longueur_660004671 >= 8)
  ALORS
    SI (  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,0) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,1) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,2) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,3) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,4) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,5) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,6) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7) < 10
      )
    ALORS
      SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
      ALORS
        ZBPrefixTransD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7)
        ZBPrefixTransO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,8)
        ZBPrefixTransT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,9)
        Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
      SINON
        SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
        ALORS
          ZBPrefixTransD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,5)
          ZBPrefixTransO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,6)
          ZBPrefixTransT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7)
          Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
        FINSI
      FINSI
      # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
      SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
        ZBPrefixTransD_660004671 >= 7 && ZBPrefixTransD_660004671 <= 9 &&
        ZBPrefixTransO_660004671 >= 7 && ZBPrefixTransO_660004671 <= 9 &&
        (ZBPrefixTransT_660004671 == 1 || ZBPrefixTransT_660004671 == 2 || ZBPrefixTransT_660004671 == 4 || ZBPrefixTransT_660004671 == 9) )
      ALORS
        ZBPrefixTrans_660004671=600*1000 + ZBPrefixTransD_660004671*100 + ZBPrefixTransO_660004671*10 + ZBPrefixTransT_660004671
      FINSI
    FINSI
  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ redirectNumTR:0
#####################################################################
RoutingNumberRedirectVal_660004671=-1
RoutingNumberError_660004671 = 0
RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::redirectNumTR:0 - 1 )
SI (RoutingNumberLong_660004671 >= 8)
ALORS
  RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0)
  RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1)

  SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
  ALORS
    RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2)
    RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3)

    SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 5)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 6)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 7)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)

      SI (i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671)!= g_inull)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
# --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        FINSI
      FINSI
    FINSI
  SINON
    SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2)*1000
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3)*100
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 4)*10
      RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 5)
      # Debut G1R6 : appel table externe pour determiner le RN
      #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
      erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
      erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)

      SI (i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671)!= g_inull)
      ALORS
        SI ( RoutingNumberRedirectVal_660004671 != -1 )
        ALORS
          RoutingNumberError_660004671 = 1
        SINON
# --- Suppression du prefixe pour 41 RN *
          RoutingNumberRedirectVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#trace1("__FILE__:__LINE__ ############## ======> Valeur de RoutingNumberRedirectVal : <%d> ", RoutingNumberRedirectVal)


#-----------------------------------------
##G3R8lot2 prefix de joignabilite
#traitement dans champ calledNumber_TR1 pour
#les types 08 du composite TR:0
#-------------------------------------------
SI (typeCRA_660004671 == 0x08)
ALORS
  SI ( Flag_ZBTR1_660004671 == 0 && Flag_itin1_660004671 == 0)
  ALORS
    Length_calledNumberTR0_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR1 - 2)
    erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR1,pt_calledNumberTR0_660004671)
    Prexf1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 0)
    Prexf2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 1)
    Prexf3_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2)
    Prexf4_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 3)

#trace2("<<__LINE__>>=================== pt_calledNumberTR0 = %s ===========================",pt_calledNumberTR0,"")
    # numero national
    SI ((Prexf1_660004671 == 4 && Prexf2_660004671 == 1) && Length_calledNumberTR0_660004671 > 6)
    ALORS
      FlagNat_660004671 = 1
      #trace("<<__LINE__>> ============NAT======================")
      i_get_sub_str(pt_calledNumberTR0_660004671, 2, -1, pt_calledNumberTR0_660004671)
      i_get_sub_str(pt_calledNumberTR0_660004671, 0, -10, pt_PrefixJoingTR0_660004671)
    SINON
      # numero inter
      SI ((Prexf1_660004671 == 1 && Prexf2_660004671 == 1 && Prexf3_660004671 == 3 && Prexf4_660004671 == 3) && Length_calledNumberTR0_660004671 > 7)
      ALORS
        FlagInter_660004671 = 1
        #trace("<<__LINE__>>==============INTER==================")
        i_get_sub_str(pt_calledNumberTR0_660004671, 4, -1, pt_calledNumberTR0_660004671)
        i_get_sub_str(pt_calledNumberTR0_660004671, 0, -10, pt_PrefixJoingTR0_660004671)
      FINSI
    FINSI

    i_strcpy(pt_portjoingTR0_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoingTR0_660004671))

    SI (i_strcmp(pt_portjoingTR0_660004671,"joig") == 0)
    ALORS
      PREFIXJoigTR0_660004671 = 1
    FINSI

#trace1 ("<<__LINE__>> =====================PREFIXjoigTR0= %d =======================",PREFIXJoigTR0)
#trace2 ("<<__LINE__>> ====================pt_PrefixJoingTR0 = %s====================",pt_PrefixJoingTR0,"")

#############################################################
#Suppression du prefix de joignabilite pour calledNumber_TR1
#############################################################
    SI (PREFIXJoigTR0_660004671)
    ALORS
      SI (FlagInter_660004671)
      ALORS
        #Cas Inter
        long_660004671 = i_strlen(pt_PrefixJoingTR0_660004671)
        indice_660004671 = long_660004671
        #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
        POINT BOUCLE13
        SI (indice_660004671 > 0)
        ALORS
          indice_660004671=indice_660004671 - 1
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          SAUT BOUCLE13
        FINSI
        erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR1,pt_calledNumberTR0_660004671)
        #trace2 ("<<__LINE__>>=============pt_calledNumberTR0=%s====================", pt_calledNumberTR0,"")
      FINSI
      SI (FlagNat_660004671)
      ALORS
        #Cas National
        long_660004671 = i_strlen(pt_PrefixJoingTR0_660004671)
        indice_660004671 = long_660004671
        #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
        POINT BOUCLE14
        SI (indice_660004671 > 0)
        ALORS
          indice_660004671=indice_660004671 - 1
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR1, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR1)
          SAUT BOUCLE14
        FINSI
        #erreur = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR1,pt_calledNumberTR0)
        #trace2 ("<<__LINE__>>=============pt_calledNumberTR0=%s====================", pt_calledNumberTR0,"")
      FINSI
    FINSI
  FINSI
FINSI


# Duplication en tlv
#G1R6 lot3 generation des type 0x06 ou 0x08 pour TR

SI (typeCRA_660004671 == 0x06)
ALORS
  indice_duptab_660004671 = DUP_TAB_NORM_TR_660004671
  erreur_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", indice_duptab_660004671)
  SI (erreur_660004671 != 0)
  ALORS
    ERREUR_660004671 = ERR_DUPL_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "TR", indice_duptab_660004671)
    SAUT STOCKE_ERRONE
  FINSI
  #G5R1
  # TR: Ajout de T3t8/msgITX si (bT3T8ITX == 1)
  SI (bT3T8ITX_660004671 == 1)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t8","")
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::msgITX, 0xFF)
    trace ("Type_TcompTR: Ajout du champ msgITX")
  FINSI
SINON
  SI (typeCRA_660004671 == 0x08)
  ALORS
    indice_duptab_660004671 =  DUP_TAB_NORM_TR08_660004671
    #trace1("------------indice_duptab=%d--------------",indice_duptab)
    erreur_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", indice_duptab_660004671)
    SI (erreur_660004671 != 0)
    ALORS
      ERREUR_660004671 = ERR_DUPL_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "TR", indice_duptab_660004671)
      SAUT STOCKE_ERRONE
    FINSI
    #G5R1
    #Pas d'ajout de T3t8
  FINSI
FINSI

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiTR_660004671,"")
i_strcpy(str_exchDCBTR_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiTR,str_exchasciiTR_660004671)
trace2("################# str_exchasciiTR = %s ################",str_exchasciiTR_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiTR_660004671," ")
trace1("############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
	i_get_sub_str (str_exchasciiTR_660004671, 0, position_660004671 - 1 ,str_exchasciiTR_660004671)
	trace2("################# str_exchasciiTR = %s ################",str_exchasciiTR_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiTR_660004671,str_exchDCBTR_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBTR_660004671, longueur_660004671)

#/G1R6 lot3

####################################################################
## T3t1.4 : IMSI
####################################################################
# FO 637 : bourrage a F du 16eme Digit
g_iartout.IMSI[15] = 0x0F

####################################################################
## T3t1.5 : DATE
####################################################################
date_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::ddebut)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::DATE, date_660004671)

####################################################################
## T3t1.12 : origine
####################################################################
SI (i_get_art_field(g_iartin, $Tcomp_nss9::intIncomCallTR:0) == 1)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::origine, 0x01)
SINON
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::origine, 0x00)
FINSI

# FO 638
####################################################################
## T3t1.14 : tterm  :-  :-  :MSET :FF
####################################################################


####################################################################
## T3t2 : idpart
####################################################################
#QC664
SI (typeCRA_660004671 == 0x06 && i_valid_field_n(g_iartin, $Tcomp_nss9::CallingNumTR))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t2","")
  ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR
  SI (i_get_art_field(g_iartin, ic_idpartTransit_660004671 - 1) == 2) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:MET_ASN1_410,0)
  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:ROAMERS,0)
  FINSI

  SI ( erreur_660004671 != 0 )
  ALORS
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671 = i_PlvMessEmettre(8519,2,g_iartout12,"",3, code_rejet_660004671, "TR", "idpart")
    SAUT STOCKE_ERRONE
  FINSI
FINSI

SI (typeCRA_660004671 == 0x08)
ALORS
  # Choix du champ d'entree "ic_idpartTransit" utilise pour idpart
  ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR
  SI (VALO_IDPART_3N_660004671 == 1)
  ALORS
    SI (i_get_art_field(g_iartin, $Tcomp_nss9::redirectNumTR - 1) > 0)
    ALORS
      ic_idpartTransit_660004671 = $Tcomp_nss9::redirectNumTR
    SINON
      SI (i_get_art_field(g_iartin, $Tcomp_nss9::OrigCalledNumTR - 1) > 0)
      ALORS
        ic_idpartTransit_660004671 = $Tcomp_nss9::OrigCalledNumTR
      FINSI
    FINSI
  FINSI

  # QC1160
  SI (i_valid_field_n(g_iartin, ic_idpartTransit_660004671))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t2","")

    # --- Valorisation du champ idpart
    # si longueur du chp d'entree pour idpart = 2 octets = 4 digits
    SI ( i_get_art_field(g_iartin, ic_idpartTransit_660004671-1) == 2)
    ALORS
      # si chp d'entree pour idpart = 410F
      SI ( (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f) )
      ALORS
        # Cas Appelant = 0 (on utilise l'automate specifique pour la normalisation)
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:MET_ASN1_410,0)
      SINON
        # Cas Normal (on utilise l'automate de base pour la normalisation)
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI
    SINON
      # Cas Normal (on utilise l'automate de base pour la normalisation)
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI
    SI ( erreur_660004671 != 0 )
    ALORS
      ERREUR_660004671 = ERR_NORM_660004671
      code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
      erreur_660004671 = i_PlvMessEmettre(8519,2,g_iartout12,"",3, code_rejet_660004671, "TR", "idpart")
      SAUT STOCKE_ERRONE
    FINSI
  FINSI
FINSI

####################################################################
## T3t3 : local
####################################################################
erreur_660004671 = i_ajout_tlv(g_iartout,"T3t3","")
## --- Valorisation du champ local
erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::calledNumberTR2,$Tdpvgsm::local,-$NORM:MET_ASN1_NEW ,0)
SI ( erreur_660004671 != 0 )
ALORS
  ERREUR_660004671 = ERR_NORM_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671 = i_PlvMessEmettre(8519,2,g_iartout12,"",3, code_rejet_660004671, "TR", "local")
  SAUT STOCKE_ERRONE
FINSI


####################################################################
## T3t6 : portOrigNet
####################################################################

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004671)
ALORS
  # Taille en octet : le champ origLocNumber est un tableau de BIT
  SI (i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumTR-1) >= 2)
  ALORS
    TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR, 0)
    NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR, 1)

    # --- portOrigNet sera absent du DPV si en entree le champ
    # --- origLocNumber a un TON NPI different de 41 (E///)
    # --- ou A1 (alcatel)  et si le
    # --- numero ne commence pas par 61 ou 62 ou 63
    SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
    ALORS
      # --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumTR,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI ( erreur_660004671 != 0 )
      ALORS
        trace("Tcomp_nss9 :Erreur duplication champ portOrigNet")
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671 = i_PlvMessEmettre(8335,2,g_iartout12,"",2, code_rejet_660004671,"portOrigNet",0)
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI

####################################################################
## T3t8 : msgITX
####################################################################
#G1R6 lot ce champ est absent dans le dpvgsm si le typeCRA = 0x08

#G5R1
# Ajout de T3t8/msgITX si (bT3T8ITX == 1)
#SI (typeCRA == 0x06)
SI (typeCRA_660004671 == 0x06) && (bT3T8ITX_660004671 == 1)
ALORS
  SI (i_valid_field_n(g_iartin,$Tcomp_nss9::numOfMrPulseTR:0))
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t8","")
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::msgITX,i_get_art_field(g_iartin, $Tcomp_nss9::numOfMrPulseTR:0))
    trace("Alimentation de T3t8/msgITX")
  FINSI
FINSI

####################################################################
## T3t12 : portpref
####################################################################
# ParamME-G1R9
####################################################################
## T3t12 : portpref
####################################################################
# ParamME-G1R9
#trace1("__FILE__:__LINE__ ## G1R9 ## ======> Valeur de RoutingNumberVal_0 : <%d> ", RoutingNumberVal_0)
#trace1("__FILE__:__LINE__ ## G1R9 ## ======> Valeur de RoutingNumberVal : <%d> ", RoutingNumberVal)
#trace1("__FILE__:__LINE__ ## G1R9 ## ======> Valeur de typeCRA : <%d> ", typeCRA)

#QC906
#SI (typeCRA == 0x06) || (typeCRA == 0x08)

SI (typeCRA_660004671 == 0x06)
ALORS
  SI ( RoutingNumberVal_0_660004671 != -1)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t12", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberVal_0_660004671 / 1000) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberVal_0_660004671 / 100) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberVal_0_660004671 / 10) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberVal_0_660004671 % 10 ))
  FINSI
FINSI

SI (typeCRA_660004671 == 0x08)
ALORS
  SI ( RoutingNumberVal_660004671 != -1)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t12", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberVal_660004671 / 1000) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberVal_660004671 / 100) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberVal_660004671 / 10) % 10 )
    erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberVal_660004671 % 10 ))
  FINSI
FINSI
#FINSI
# /ParamME-G1R9

####################################################################
## T3t16 : TrSortant (g_iartin,$Tcomp_nss9::outgoingRouteTR:1)
####################################################################
#QC196
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::outgoingRouteTR:1))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::outgoingRouteTR:1 - 1))
  #trace1(">>>__LINE__>>> tailleChpTrans = <%d>",tailleChpTrans)
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::outgoingRouteTR:1)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI


####################################################################
## T3t17 : TrEntrant (g_iartin,$Tcomp_nss9::incomingRoute:0)
####################################################################
#QC196
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::incomingRoute:0))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::incomingRoute:0 - 1))
  #trace1(">>>__LINE__>>> tailleChpTrans = <%d>",tailleChpTrans)
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::incomingRoute:0)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI

####################################################################
## T4t30.1 : timeInCE
####################################################################
date_audit_gmt_660004671 = i_date_audit()
date_audit_660004671 = i_DHgetLocalTime(4, 7, date_audit_gmt_660004671)
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,date_audit_660004671)

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

####################################################################
## T4t34 : ZBprefix
####################################################################
SI (typeCRA_660004671 == 0x06)
ALORS
  SI (ZBPrefixValSDETR_660004671 != -1)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t34","")
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitSDETRD_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitSDETRO_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitSDETRT_660004671)
  FINSI
SINON
  SI(typeCRA_660004671 == 0x08)
  ALORS
    #trace("--------------typeCRA=8 et ZBPrefixVal-------")
    #trace1("------------ZBPrefixTR08=%d-------------",ZBPrefixTR08)
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2) && !i_valid_field_n(g_iartin,$Tcomp_nss9::translatedNum:1) && ZBPrefixTR1_8_660004671 == 1)
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t34","")
      erreur_660004671 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitSDETRD_660004671)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitSDETRO_660004671)
      erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitSDETRT_660004671)
    FINSI
  FINSI
FINSI


###################################################################
# Ajout du champ T4t38.1 origCallpartId
###################################################################
SI (typeCRA_660004671 == 0x06)
ALORS
  calledNumber_present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::calledNumberTR2)
  SI (calledNumber_present_660004671)
  ALORS
    # %%  OGA 98 %%
    erreur_660004671 = i_cree_art("TnormalHAscii", g_iartout4)
    erreur_660004671 = i_ajout_tlv(g_iartout4, "T3t1", "buf")
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout4, $Tcomp_nss9::calledNumberTR2, $TnormalHAscii::buf, -$NORM:MET_ASN1_NEW,0)

    res_660004671 = i_get_art_field(g_iartout4, $TnormalHAscii::buf -1)
    erreur_660004671 = i_ajout_tlv(g_iartout,"T4t38.1","")
    erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::origCallpartId, g_iartout4.buf[], res_660004671)
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t38.1","origCallpartId", res_660004671)
    # %% /OGA 98 %%
  FINSI
FINSI

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

###################################################################
# Ajout du champ V4t52.1 callingLocation
###################################################################
SI (flag_freeFormatData_660004671 == 1)
ALORS
  #Rechercher dans la table avec la cle "CellID_OF_XXXXX" (XXXXX = CellID)
  i_strcpy(pt_temp1_660004671, i_get_tab_field("VariableContexte", date_cra_660004671, pt_CellID_OF_660004671))
  SI (i_strcmp( pt_temp1_660004671, g_inull)  != 0)
  ALORS
    b_RechTableCellID_OF1_660004671=1
    erreur_660004671 = i_ajout_tlv(g_iartout, "T3t52", "")
    erreur_660004671 = i_resize_tlv(g_iartout,"T4t52.1","callingLocation", 3)
    erreur_660004671 = i_retrait_tlv(g_iartout, "T4t52.2", "")
    g_iartout.callingLocation[0] = g_iartin.freeFormatData1[0]
    g_iartout.callingLocation[1] = g_iartin.freeFormatData1[1]
    g_iartout.callingLocation[2] = g_iartin.freeFormatData1[2]
    #Changer le 6 ieme digit en "F"
    erreur_660004671 = ((g_iartout.callingLocation[2]/0x10) * 0x10)
    g_iartout.callingLocation[2] = erreur_660004671 + 0x0F
  FINSI
FINSI
###################################################################
# Ajout T3t57
###################################################################
SI(typeCRA_660004671 == 0x08)
ALORS
#QC834  ajout test ZBPrefixTrans != 0 avant ajout du champ T3t57
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::translatedNum:1) && ZBPrefixTrans_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t57","")
    erreur_660004671 = i_resize_tlv(g_iartout,"T3t57","GDCB",3*8)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 0, 6)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 1, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 2, 0)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 3, ZBPrefixTransD_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 4, ZBPrefixTransO_660004671)
    erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 5, ZBPrefixTransT_660004671)
  FINSI
FINSI

#################################################################
# G3R3 lot2 (TRANSIT)Ajout T3t63(LastCallingNb) typeCRA = 0x06
################################################################
#G3R8 lot3 Correctif Mapping ABC  Reiterer la normalisation avec les champs candidats
SI (typeCRA_660004671 == 0x06 )
ALORS
  redirectNumTR_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumTR:0 - 1))
  SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")


    SI (RoutingNumberLong_660004671 == 2)
    ALORS
      SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f) )
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

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

    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      #QC925
      SI ( erreur_660004671 != 0)
      ALORS
        trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        SAUT Normal1
      FINSI
    FINSI
  SINON
    POINT Normal1
    SI (i_valid_field_n(g_iartin, $Tcomp_nss9::CallingNumTR:0))
    ALORS
      SI (!i_valid_field_n(g_iartout,$Tdpvgsm::LastCallingNb))
      ALORS
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
      FINSI

      ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR:0
      SI ((i_get_art_field(g_iartin, ic_idpartTransit_660004671 - 1) == 2) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f))
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS,0)
      FINSI

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

    FINSI
  FINSI
#################################################################
# G3R3 lot2 (TRANSIT)Ajout T3t64(RedirectingNb) typeCRA = 0x06
################################################################

  SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t64","")

    SI (RoutingNumberLong_660004671 == 2)
    ALORS
      SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f))
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_410,0)
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

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

    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)

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

    FINSI
  FINSI
FINSI
################################################################
# G3R3 lot2 (TRANSIT)Ajout T3t63(LastCallingNb) typeCRA = 0x08
################################################################
#G3R8 lot3 Correctif Mapping ABC  Reiterer la normalisation avec les champs candidats
SI (typeCRA_660004671 == 0x08)
ALORS

  redirectNumTR_present_660004671 = i_valid_field_n (g_iartin, $Tcomp_nss9::redirectNumTR:0)
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::redirectNumTR:0 - 1)
  SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")


    SI (RoutingNumberLong_660004671 == 2)
    ALORS
      SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f))
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

      #QC925
      SI ( erreur_660004671 != 0)
      ALORS
        trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        SAUT Normal2
      FINSI

    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
      #QC925
      SI ( erreur_660004671 != 0)
      ALORS
        trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
        #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        SAUT Normal2
      FINSI
    FINSI
  SINON
    POINT Normal2
    OrigCalledNumTR_Present_660004671 = i_valid_field_n(g_iartin,$Tcomp_nss9::OrigCalledNumTR:0)
    OrigCalledNumTRLong_660004671 = i_get_art_field(g_iartin,$Tcomp_nss9::OrigCalledNumTR:0 - 1)

    SI (OrigCalledNumTR_Present_660004671 && OrigCalledNumTRLong_660004671 != 0)
    ALORS
      SI (!i_valid_field_n(g_iartout,$Tdpvgsm::LastCallingNb))
      ALORS
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
      FINSI

      SI (OrigCalledNumTRLong_660004671 == 2)
      ALORS
        SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 0) == 4) &&
          (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 1) == 1) &&
          (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 2) == 0) &&
          (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::OrigCalledNumTR:0, 3) == 0x0f))
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::OrigCalledNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::OrigCalledNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        FINSI

        SI ( erreur_660004671 != 0)
        ALORS
          trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          SAUT Normal3
        FINSI
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::OrigCalledNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        #QC925
        SI ( erreur_660004671 != 0)
        ALORS
          trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
          SAUT Normal3
        FINSI
      FINSI
    SINON
      POINT Normal3

      ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR:0
      SI (!i_valid_field_n(g_iartout,$Tdpvgsm::LastCallingNb))
      ALORS
        erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
      FINSI
      SI (i_get_art_field(g_iartin, ic_idpartTransit_660004671 - 1) == 2)
      ALORS
        SI ((i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
          (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
          (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
          (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f))
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        FINSI
        #QC925
        SI ( erreur_660004671 != 0)
        ALORS
          trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
        #QC925
        SI ( erreur_660004671 != 0)
        ALORS
          trace("Tcomp_nss9: Erreur de duplication + normalisation TR du champ T3t63 LastCallingNb")
          #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
        FINSI
      FINSI
    FINSI
  FINSI


################################################################
# G3R3 lot2 (TRANSIT)Ajout T3t64(RedirectingNb) typeCRA = 0x08
################################################################
  SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
  ALORS
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t64","")

    SI (RoutingNumberLong_660004671 == 2)
    ALORS
      SI (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
        (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f)
      ALORS
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_410,0)
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
      FINSI

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

    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)

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

    FINSI
  FINSI
FINSI
#\G3R3 lot2 (TRANSIT)Ajout T3t63(LastCallingNb)et T3t64 typeCra = 0x08


#G3R3 Curling Free ajout du champ T3t69 pour le type 08
SI (typeCRA_660004671 == 0x08)
ALORS
  SI (i_strcmp (pt_ITInerant_660004671,g_inull) != 0)
  ALORS
    trace2("<<__LINE__ ====ITINERANT DETECTE (PrefItinerance) ITInerant = <%s>=====",pt_ITInerant_660004671,"")
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t69","")
    longueur_660004671 = i_conv_ascii_dcb (pt_ITInerant_660004671, pt_ITInerantDCB_660004671)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefItinerance,pt_ITInerantDCB_660004671, longueur_660004671)
    #trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur)
    erreur_660004671  = i_resize_tlv( g_iartout, "T3t69", "PrefItinerance", longueur_660004671 * 8)
  FINSI
#G3R4 lot1 prefix SVA ajout du champ T3t70 pour le type 08
  SI (i_strcmp (pt_PrefixeSVA_660004671,g_inull) != 0)
  ALORS
    trace2("<<__LINE__ ====sva DETECTE (T3t70) sva = <%s>=====",pt_PrefixeSVA_660004671,"")
    erreur_660004671 = i_ajout_tlv(g_iartout,"T3t70","")
    longueur_660004671 = i_conv_ascii_dcb (pt_PrefixeSVA_660004671, pt_PrefixesvaDCB_660004671)
    erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixesvaDCB_660004671, longueur_660004671)
    #trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur)
    erreur_660004671  = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004671 * 8)
  FINSI
FINSI



##########################################################
#G3R8 lot2 Ajout du champ T3t70 si joignabilite detecte
########################################################

SI (PREFIXJoig_660004671==1)
ALORS
  trace2("<<__LINE__>>---------pt_PrefixJoing=%s prefix joignabilite detecte---------",pt_PrefixJoing_660004671,"")
  erreur_660004671  = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004671 = i_conv_ascii_dcb(pt_PrefixJoing_660004671,pt_PrefixJoingDCB_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004671, longueur_660004671)
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t70","PrefixeSVA",longueur_660004671 * 8)
FINSI


####################################################################
## Ajout du champ V3t99 GMSCForwTerm
####################################################################

SI !(i_valid_field_n(g_iartout, $Tdpvgsm::GretaTag))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t99","")
FINSI
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::GMSCForwTerm, 0x01)

######################################################################
##        Stockage
######################################################################
POINT STOCKE_DPV_TR

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "TR", 0)
  SAUT STOCKE_ERRONE
FINSI

SAUT FIN_DISTRIB


#G2R6 ###########################################################################
POINT DISTRIB_MSOTR
#================================================================
#   $     $     $$$$     $$$$    $$$$$$$    $$$$
#   $ $ $ $    $___     $    $      $       $   $
#   $  $  $        $    $    $      $       $ $
#   $     $    $$$$      $$$$       $       $    $
#================================================================


calledNumber_present_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberMO:0 -1)
SI (calledNumber_present_660004671 > 0 )
ALORS
  TON_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 0)
  NPI_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 1)
FINSI

##########################################################
# G3R8 Lot2 Traitement eventuel du prefix de joignabilite
# sur le champ calledNumberTR2 du composite MSOTR
#########################################################

Length_calledNumberTR_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR2 - 2)
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)
Prexf1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 0)
Prexf2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 1)
Prexf3_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2)
Prexf4_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 3)
trace2("<<__LINE__>> ============== pt_calledNumberTR = %s ================",pt_calledNumberTR_660004671,"")


# numero national
SI ((Prexf1_660004671 == 4 && Prexf2_660004671 == 1) && Length_calledNumberTR_660004671 > 6)
ALORS
  FlagNat_660004671 = 1
  trace("<<__LINE__>> ============NAT======================")
  i_get_sub_str(pt_calledNumberTR_660004671, 2, -1, pt_calledNumberTR_660004671)
  i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
SINON
  # numero inter
  SI ((Prexf1_660004671 == 1 && Prexf2_660004671 == 1 && Prexf3_660004671 == 3 && Prexf4_660004671 == 3) && Length_calledNumberTR_660004671 > 7)
  ALORS
    FlagInter_660004671 = 1
    trace("<<__LINE__>>==============INTER==================")
    i_get_sub_str(pt_calledNumberTR_660004671, 4, -1, pt_calledNumberTR_660004671)
    i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
  FINSI
FINSI

i_strcpy(pt_portjoing_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoing_660004671))

SI (i_strcmp(pt_portjoing_660004671,"joig") == 0)
ALORS
  PREFIXJoig_660004671 = 1
FINSI

#trace1 ("<<__LINE__>> =====================PREFIXJoig= %d =======================",PREFIXJoig)
#trace2 ("<<__LINE__>> ====================pt_PrefixJoing = %s====================",pt_PrefixJoing,"")

#########################################
#Suppression du prefix de joignabilite
##########################################
SI (PREFIXJoig_660004671)
ALORS
  SI (FlagInter_660004671)
  ALORS
    #Cas Inter
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
    POINT BOUCLE11
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 4, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
      SAUT BOUCLE11
    FINSI
    erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)
    trace2 ("<<__LINE__>>=============pt_calledNumberTR=%s====================", pt_calledNumberTR_660004671,"")
  FINSI
  SI (FlagNat_660004671)
  ALORS
    #Cas National
    long_660004671 = i_strlen(pt_PrefixJoing_660004671)
    indice_660004671 = long_660004671
    trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004671)
    POINT BOUCLE12
    SI (indice_660004671 > 0)
    ALORS
      indice_660004671=indice_660004671 - 1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR2, 2, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR2)
      SAUT BOUCLE12
    FINSI
    erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR2,pt_calledNumberTR_660004671)
    trace2 ("<<__LINE__>>=============pt_calledNumberTR=%s====================", pt_calledNumberTR_660004671,"")
  FINSI
FINSI

#\fin G3R8 lot2

#####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################

# Duplication avec choix de la table
ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 21)

SI (ic_660004671 != 0)
ALORS
  ERREUR_660004671 = ERR_DUPL_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "MSOTR", 21)
  SAUT STOCKE_ERRONE
FINSI

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiMO_660004671,"")
i_strcpy(str_exchDCBMO_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiMO,str_exchasciiMO_660004671)
trace2("################# str_exchasciiMO = %s ################",str_exchasciiMO_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiMO_660004671," ")
trace1("############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
  i_get_sub_str (str_exchasciiMO_660004671, 0, position_660004671 - 1 ,str_exchasciiMO_660004671)
  trace2("################# str_exchasciiMO = %s ################",str_exchasciiMO_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiMO_660004671,str_exchDCBMO_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBMO_660004671, longueur_660004671)

#####################################################################
# V3t2 (idpart) ; idpart absent de la duplication
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::callingNumberMO:0))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t2","")
  #SI b_IMSIMO1_ORANGE
  #G3R7 Gestion des MVNOs Light V3t2 normalise avec MET_ASN1_NEW
  SI IMSI_OrangeCo_660004671
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:MET_ASN1_NEW, 0)
  SINON
    erreur_660004671 = i_test_field_ila_n(g_iartin,$Tcomp_nss9::callingNumberMO:0,"Lrnis")
    SI (erreur_660004671 == 0)
    ALORS
      digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 0)
      digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 1)
      digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 2)
      digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 3)
      SI ( ( digit1_660004671 == 0 ) && ( digit2_660004671 == 0 ) && ( digit3_660004671 == 4 ) && ( digit4_660004671 == 0x0f ) )
      ALORS
        dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)
        SI ( ( TON_660004671 == 2 ) && ( dig3_660004671 == 0 ) )
        ALORS
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:ROAMERS2, 0)
        SINON
          SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
          ALORS
            erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:MET_ASN1_NEW, 0)
          SINON
            erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:ROAMERS2, 0)
          FINSI
        FINSI
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:ROAMERS2, 0)
      FINSI
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::idpart, -$NORM:ROAMERS2, 0)
    FINSI
  FINSI
  # Erreur de normalisation
  SI erreur_660004671
  ALORS
    trace("MSOTR : Erreur dup_chp_rnis - T3t2")
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "MSOTR", "callingNumberMO")
    SAUT STOCKE_ERRONE
  FINSI
FINSI



#####################################################################
# V3t3 V3t4 (local, MSISDN)
# Entree : T3t5TR2/T4t5.3/calledNumberTR, sortie : V3t3 et V3t4 (local, MSISDN)
#  Suppression de prefixe ZB (3.3.2.1) : deja fait en 705 pour TR1 (2eme TR)
#  Suppression de prefixe RN (3.3.2.2) : deja fait en 793 pour TR1 (2eme TR)
# QC541
#local    :-  :E  :NORM :number1  :-  :$MET_ASN1_NEW
#MSISDN   :-  :E  :NORM :number1  :-  :$MET_ASN1_NEW
# /QC541, QC561


#####################################################################
# Traitement du champ portOrigNet (T3t6)
#
# Entree : T3t1MO1/T4t1.14/origLocNumber_MO, sortie : V3t6 (portOrigNet)
# Si numero impacte present et  commence par 41, Normalisation avec automate CIT_IDENT (suppression  TON + NPI) Sinon champ absent
#####################################################################

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004671)
ALORS
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumberMO:0 -1)
  SI (taille_660004671 >= 2)
  ALORS
    TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumberMO:0, 0)
    NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumberMO:0, 1)

    # --- portOrigNet sera absent du DPV si en entree le champ
    # --- origLocNumber a un TON NPI different de 41 (E///)
    # --- ou A1 (alcatel)  et si le
    # --- numero ne commence pas par 61 ou 62 ou 63
    SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumberMO:0,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI erreur_660004671
      ALORS
        trace("MSOTR : Erreur dup_chp_rnis - T3t6")
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "MSOTR", "portOrigNet")
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI


####################################################################
## T3t12 : portpref
####################################################################
SI ( RoutingNumberVal_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t12", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberVal_660004671 / 1000) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberVal_660004671 / 100) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberVal_660004671 / 10) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberVal_660004671 % 10 ))
FINSI


####################################################################
## T3t16 : TrSortant (g_iartin,$Tcomp_nss9::outgoingRouteTR:1)
####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::outgoingRouteTR:1))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::outgoingRouteTR:1 - 1))
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::outgoingRouteTR:1)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI

####################################################################
## T3t17 : TrEntrant (g_iartin,$Tcomp_nss9::incomingAsRteMO)
####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::incomingAsRteMO))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::incomingAsRteMO - 1))
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::incomingAsRteMO)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI


######################################################################
# Traitement d'un eventuel prefix Zone Blanche sortant
# dans le champ T3t5TR2/T4t5.16 translatedNum
#########################################################################################
#############################################################################################
# Traitement d'un eventuel prefixe Zone Blanche sortant, valorisera le champ DPV V3t57
# dans le champ T3t17/$Tcomp_nss9::translatedNum:1 = translatedNum2
# G1R6 lot4
# 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)
#############################################################################################
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::translatedNum:1))
ALORS
  erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::translatedNum:1, pt_champ_660004671)
  longueur_660004671=i_strlen(pt_champ_660004671)
  Flag_ZB_660004671 = 0
  SI (longueur_660004671 >= 8)
  ALORS
    SI (  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,0) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,1) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,2) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,3) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,4) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,5) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,6) < 10
      &&  i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7) < 10
      )
    ALORS
      SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
      ALORS
        ZBPrefixTransD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7)
        ZBPrefixTransO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,8)
        ZBPrefixTransT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,9)
        Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
      SINON
        SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
        ALORS
          ZBPrefixTransD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,5)
          ZBPrefixTransO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,6)
          ZBPrefixTransT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::translatedNum:1,7)
          Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
        FINSI
      FINSI
      # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
      SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
        ZBPrefixTransD_660004671 >= 7 && ZBPrefixTransD_660004671 <= 9 &&
        ZBPrefixTransO_660004671 >= 7 && ZBPrefixTransO_660004671 <= 9 &&
        (ZBPrefixTransT_660004671 == 1 || ZBPrefixTransT_660004671 == 2 || ZBPrefixTransT_660004671 == 4 || ZBPrefixTransT_660004671 == 9) )
      ALORS
        ZBPrefixTrans_660004671=600*1000 + ZBPrefixTransD_660004671*100 + ZBPrefixTransO_660004671*10 + ZBPrefixTransT_660004671
      FINSI
    FINSI
  FINSI
FINSI


###################################################################
#  V4t30.1 (timeInCE) et V4t30.2 (eec)
###################################################################

########### timeInCE=Date_Audit
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

###################################################################
# Ajout T3t57
###################################################################
#QC834 ajout test ZBPrefixTrans != 0 avant ajout du champ T3t57
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::translatedNum:1) && ZBPrefixTrans_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t57","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t57","GDCB",3*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 0, 6)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 1, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 2, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 3, ZBPrefixTransD_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 4, ZBPrefixTransO_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::GDCB, 5, ZBPrefixTransT_660004671)
FINSI

###############################################################
# G3R3 lot2 (MSOTR)Ajout T3t63(LastCallingNb)
###############################################################

#Valorisation de T3t63 avec redirectNumTR

#G3R8 Lot3 reiterer la normalisation avec les champs candidats

redirectNumTR_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumTR:0 - 1))
SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")

  # Normalisation de T3t63 (LastCallingNb)
  SI (i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumTR:0 - 1)) == 2)
  ALORS
    SI ( (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f) )
    ALORS
      # Cas Appelant = 0 (on utilise l'automate specifique pour la normalisation)
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication + normalisation MSOTR du champ T3t63 LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      SAUT NormRediectN
    FINSI
  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication + normalisation MSOTR du champ T3t63 LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      SAUT NormRediectN
    FINSI
  FINSI
SINON
#Valorisation de T3t63 avec callingNumberMO
#Normalisation

  POINT NormRediectN

  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::callingNumberMO:0))
  ALORS
    SI (!i_valid_field_n(g_iartout, $Tdpvgsm::LastCallingNb))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
    FINSI

    #SI b_IMSIMO1_ORANGE
    #G3R7 Gestion des MVNOs lights T3t63 normalise avec  MET_ASN1_NEW
    SI IMSI_OrangeCo_660004671
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW, 0)
    SINON
      erreur_660004671 = i_test_field_ila_n(g_iartin,$Tcomp_nss9::callingNumberMO:0,"Lrnis")
      SI (erreur_660004671 == 0)
      ALORS
        digit1_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 0)
        digit2_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 1)
        digit3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 2)
        digit4_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::oIcKMO:0, 3)

        SI ( ( digit1_660004671 == 0 ) && ( digit2_660004671 == 0 ) && ( digit3_660004671 == 4 ) && ( digit4_660004671 == 0x0f ) )
        ALORS
          dig3_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberMO:0, 2)

          SI ( ( TON_660004671 == 2 ) && ( dig3_660004671 == 0 ) )
          ALORS
            erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2, 0)
          SINON
            SI ( (TON_660004671 == 2) && ((NPI_660004671 == 0)||(NPI_660004671 == 1)) )
            ALORS
              erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:MET_ASN1_NEW, 0)
            SINON
              erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2, 0)
            FINSI
          FINSI
        SINON
          erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2, 0)
        FINSI
      SINON
        erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::callingNumberMO:0, $Tdpvgsm::LastCallingNb, -$NORM:ROAMERS2, 0)
      FINSI
    FINSI
    # Erreur de normalisation
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication + normalisation MSOTR du champ T3t63 LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
    FINSI
  FINSI
FINSI
#/G3R3 lot2 Ajout T3t63(LastCallingNb)
##############################################################
# G3R3 lot2 (MSOTR)Ajout T3t64(RedirectingNb) valorise avec redirectNumTR
##############################################################
SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t64","")
  erreur_660004671 = i_dup_chp_1val(g_iartout, g_iartout, $Tdpvgsm::LastCallingNb, $Tdpvgsm::RedirectingNb)
FINSI

#/G3R3 lot2 Ajout T3t64(RedirectingNb)

#G3R3 Curling Free Ajout de T3t69
SI (i_strcmp (pt_ITInerant_660004671,g_inull) != 0)
ALORS
  trace2("<<__LINE__ ====ITINERANT DETECTE (PrefItinerance) ITInerant = <%s>=====",pt_ITInerant_660004671,"")
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t69","")
  longueur_660004671 = i_conv_ascii_dcb (pt_ITInerant_660004671, pt_ITInerantDCB_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefItinerance,pt_ITInerantDCB_660004671, longueur_660004671)
  #trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur)
  erreur_660004671 = i_resize_tlv( g_iartout, "T3t69", "PrefItinerance", longueur_660004671 * 8)
FINSI

#G3R4 lot1 Prefix sva
#G3R4 lot1 prefix SVA ajout du champ T3t70 p
SI (i_strcmp (pt_PrefixeSVA_660004671,g_inull) != 0)
ALORS
  trace2("<<__LINE__ ==== MSOTR sva DETECTE (T3t70) sva = <%s> =====",pt_PrefixeSVA_660004671,"")
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004671 = i_conv_ascii_dcb (pt_PrefixeSVA_660004671, pt_PrefixesvaDCB_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixesvaDCB_660004671, longueur_660004671)
  #trace1("<<__LINE__ << ------longueur = <%d> -------------",longueur)
  erreur_660004671  = i_resize_tlv( g_iartout, "T3t70", "PrefixeSVA", longueur_660004671 * 8)
FINSI


##########################################################
#G3R8 lot2 Ajout du champ T3t70 si joignabilite detecte
########################################################

SI (PREFIXJoig_660004671==1)
ALORS
  trace2("<<__LINE__>>---------pt_PrefixJoing=%s prefix joignabilite detecte---------",pt_PrefixJoing_660004671,"")
  erreur_660004671  = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004671 = i_conv_ascii_dcb(pt_PrefixJoing_660004671,pt_PrefixJoingDCB_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004671, longueur_660004671)
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t70","PrefixeSVA",longueur_660004671 * 8)
FINSI




#####################################################################
#         Stockage
#####################################################################
POINT STOCKE_DPV_MSOTR
trace("Tcomp_nss9/MSOTR - STOCKE_DPV")

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "MSOTR", 0)
  SAUT STOCKE_ERRONE
FINSI

SAUT FIN_DISTRIB


#G2R6 ###########################################################################
POINT DISTRIB_TRTR
#================================================================
#   $$$$$$$    $$$$     $$$$$$$    $$$$
#      $       $   $       $       $   $
#      $       $ $         $       $ $
#      $       $    $      $       $    $
#================================================================


#####################################################################
# Traitement d'un eventuel prefixe Zone Blanche
# dans le champ calledNumber_TR2
#####################################################################
##############################################################################################################
#   PRE NORMALISATION
# Traitement d'un eventuel prefixe Zone Blanche entrant, valorisera le champ DPV V3t34
# dans le champ Tcomp_nss9::calledNumberTR3 = calledNumber_TR2, xx 600DOT ZABPQMCDU ou 11 33 600DOT 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
##############################################################################################################
ZBPrefixValTRTR_660004671=-1
erreur_660004671 = i_get_art_str(g_iartin, $Tcomp_nss9::calledNumberTR3, pt_champ_660004671)
longueur_660004671=i_strlen(pt_champ_660004671)
SI (longueur_660004671 >= 8)
ALORS
  SI  ( (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,0)<12)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,1)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,2)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,3)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,4)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,5)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,6)<10)
    && (i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,7)<10) )
  ALORS

    Flag_ZB_660004671 = 0
    SI (i_strplcmp(pt_champ_660004671,"1133600",0,7) == 0)
    ALORS
      ZBPrefixDigitTRTRD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,7)
      ZBPrefixDigitTRTRO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,8)
      ZBPrefixDigitTRTRT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,9)
      Flag_ZB_660004671 = C_ZB_1133600DOT_660004671
    SINON
      SI (i_strplcmp(pt_champ_660004671,"11",0,2) != 0 && i_strplcmp(pt_champ_660004671,"600",2,3) == 0)
      ALORS
        ZBPrefixDigitTRTRD_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,5)
        ZBPrefixDigitTRTRO_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,6)
        ZBPrefixDigitTRTRT_660004671=i_get_art_fieldtab(g_iartin,$Tcomp_nss9::calledNumberTR3,7)
        Flag_ZB_660004671 = C_ZB_XX600DOT_660004671
      FINSI
    FINSI

    # Si  (zb = 600<7|8|9><7|8|9><1|2|4|9>)
    SI (  (Flag_ZB_660004671 == C_ZB_1133600DOT_660004671 || Flag_ZB_660004671 == C_ZB_XX600DOT_660004671) &&
      ZBPrefixDigitTRTRD_660004671 >= 7 && ZBPrefixDigitTRTRD_660004671 <= 9 &&
      ZBPrefixDigitTRTRO_660004671 >= 7 && ZBPrefixDigitTRTRO_660004671 <= 9 &&
      (ZBPrefixDigitTRTRT_660004671 == 1 || ZBPrefixDigitTRTRT_660004671 == 2 || ZBPrefixDigitTRTRT_660004671 == 4 || ZBPrefixDigitTRTRT_660004671 == 9) )
    ALORS
# QC1432 rajout booleen ZBPrefixTR1_8
      SI (ZBPrefixValTRTR_660004671 == -1)
      ALORS
        ZBPrefixValTRTR_660004671=600*1000 + ZBPrefixDigitTRTRD_660004671*100 + ZBPrefixDigitTRTRO_660004671*10 + ZBPrefixDigitTRTRT_660004671
        ZBPrefixTR1_8_660004671 = 1
      FINSI
#/QC1432 rajout booleen ZBPrefixTR1_8
      SI (Flag_ZB_660004671 == C_ZB_XX600DOT_660004671)
      ALORS
        ZBPrefixLong_660004671 = 6
      SINON
        ZBPrefixLong_660004671 = 8
      FINSI

      Prefix_index_660004671 = 2

      # Suppression de [33] eventuel et du prefixe ZB avant normalisation
      POINT BOUCLE_ZBSKIP_TRTR_1
      erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, Prefix_index_660004671, 0x0f)
      erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
      ZBPrefixLong_660004671 = ZBPrefixLong_660004671 - 1
      SI (ZBPrefixLong_660004671 != 0)
      ALORS
        SAUT BOUCLE_ZBSKIP_TRTR_1
      FINSI

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

  FINSI
FINSI

#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ calledNumberTR3
#####################################################################
SI (Flag_ZBTR3_660004671 == 0)
ALORS
  RoutingNumberVal_660004671 = -1
  RoutingNumberError_660004671 = 0
  RoutingNumberLong_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR3 - 2 )

  SI (RoutingNumberLong_660004671 >= 8)
  ALORS
    RoutingNumberTON_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 0)
    RoutingNumberNPI_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 1)

    SI ((RoutingNumberTON_660004671 == 1) && (RoutingNumberNPI_660004671 == 1))
    ALORS
      RoutingNumberCC1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2)
      RoutingNumberCC2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 3)

      SI ((RoutingNumberCC1_660004671 == 3) && (RoutingNumberCC2_660004671 == 3))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 5)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 6)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 7)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)

        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_porta_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_porta_660004671,"porta") == 0)
        ALORS
# --- Suppression du prefixe pour 11 33 RN *
          RoutingNumberVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
        FINSI
      FINSI
    SINON
      SI ((RoutingNumberTON_660004671 == 4) && (RoutingNumberNPI_660004671 == 1))
      ALORS
        RoutingNumberTmpVal_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2)*1000
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 3)*100
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4)*10
        RoutingNumberTmpVal_660004671=RoutingNumberTmpVal_660004671+i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 5)
        # Debut G1R6 : appel table externe pour determiner le RN
        #SI ((RoutingNumberTmpVal >= 6001) && (RoutingNumberTmpVal <= 6003))
        erreur_660004671 = i_set_art_field(g_iartout9, $Conv_URS::NumHex4, RoutingNumberTmpVal_660004671)
        erreur_660004671 = i_get_art_str(g_iartout9, $Conv_URS::NumHex4, pt_CleRoutingNumberSAC_660004671)
        #SI (i_get_tab_field(RNSAC, date_fin, pt_CleRoutingNumberSAC)!= g_inull)
        i_strcpy(pt_porta_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_CleRoutingNumberSAC_660004671))
        SI (i_strcmp(pt_porta_660004671,"porta") == 0)
        ALORS
          # ---            Suppression du prefixe pour 41 RN *
          RoutingNumberVal_660004671=RoutingNumberTmpVal_660004671
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
          erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2, 0x0f)
          erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
        SINON
          ############################################################
          # G3R8 Lot2 TRTR
          # Traitement d'un eventuel prefixe de joignabilite
          # dans le champ calledNumberTR3
          ###########################################################
          Length_calledNumberTR_660004671  = i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR3 - 2)
          erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR3,pt_calledNumberTR_660004671)
          Prexf1_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 0)
          Prexf2_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 1)
          Prexf3_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2)
          Prexf4_660004671=i_get_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 3)
          trace2("<<__LINE__>> ============== pt_calledNumberTR = %s ================",pt_calledNumberTR_660004671,"")

          # numero national
          SI ((Prexf1_660004671 == 4 && Prexf2_660004671 == 1) && Length_calledNumberTR_660004671 > 6)
          ALORS
            FlagNat_660004671 = 1
            trace("<<__LINE__>> ============NAT======================")
            i_get_sub_str(pt_calledNumberTR_660004671, 2, -1, pt_calledNumberTR_660004671)
            i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
          SINON
            # numero inter
            SI ((Prexf1_660004671 == 1 && Prexf2_660004671 == 1 && Prexf3_660004671 == 3 && Prexf4_660004671 == 3) && Length_calledNumberTR_660004671 > 7)
            ALORS
              FlagInter_660004671 = 1
              trace("<<__LINE__>>==============INTER==================")
              i_get_sub_str(pt_calledNumberTR_660004671, 4, -1, pt_calledNumberTR_660004671)
              i_get_sub_str(pt_calledNumberTR_660004671, 0, -10, pt_PrefixJoing_660004671)
            FINSI
          FINSI

          i_strcpy(pt_portjoing_660004671,i_get_tab_field(RNSAC_660004671, date_fin_660004671, pt_PrefixJoing_660004671))
          SI (i_strcmp(pt_portjoing_660004671,"joig") == 0)
          ALORS
            PREFIXJoig_660004671 = 1
          FINSI
          #########################################
          #Suppression du prefix de joignabilite
          ##########################################
          SI (PREFIXJoig_660004671)
          ALORS
            SI (FlagInter_660004671)
            ALORS
              #Cas Inter
              long_660004671 = i_strlen(pt_PrefixJoing_660004671)
              indice_660004671 = long_660004671
              #trace1 ("<<__LINE__>> ============ indice=%d ===============",indice)
              POINT BOUCLE9
              SI (indice_660004671 > 0)
              ALORS
                indice_660004671=indice_660004671 - 1
                erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 4, 0x0f)
                erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
                SAUT BOUCLE9
              FINSI
              #erreur = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberCF,pt_calledNumberCF)
              #trace2 ("<<__LINE__>>=============pt_calledNumberCF=%s====================", pt_calledNumberCF,"")
            FINSI
            SI (FlagNat_660004671)
            ALORS
              #Cas National
              long_660004671 = i_strlen(pt_PrefixJoing_660004671)
              indice_660004671 = long_660004671
              trace1 ("<<__LINE__>> ============ indice=%d ===============",indice_660004671)
              POINT BOUCLE10
              SI (indice_660004671 > 0)
              ALORS
                indice_660004671=indice_660004671 - 1
                erreur_660004671 = i_set_art_fieldtab(g_iartin, $Tcomp_nss9::calledNumberTR3, 2, 0x0f)
                erreur_660004671 = i_skip_f_in_field_n(g_iartin, $Tcomp_nss9::calledNumberTR3)
                SAUT BOUCLE10
              FINSI
              erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::calledNumberTR3,pt_calledNumberTR_660004671)
              trace2 ("<<__LINE__>>=============pt_calledNumberTR=%s====================", pt_calledNumberTR_660004671,"")
            FINSI
          FINSI
        FINSI
      FINSI
    FINSI
  FINSI
FINSI
#trace1("__FILE__:__LINE__ ##################### ======> Valeur de RoutingNumberVal : <%d> ", RoutingNumberVal)

####################################################################
# Creation DPV
# Duplication en DPV TLV
#####################################################################

# Duplication avec choix de la table
ic_660004671 = i_dup_art_tab_choix(g_iartin,g_iartout,"Tdpvgsm", 22)

SI (ic_660004671 != 0)
ALORS
  ERREUR_660004671 = ERR_DUPL_660004671
  code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
  erreur_660004671=i_PlvMessEmettre(8518 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "TRTR", 22)
  SAUT STOCKE_ERRONE
FINSI

##################################################################
# QC396, QC1292
# T3t1.3 idemet
##################################################################
# QC1444
i_strcpy(str_exchasciiTR_660004671,"")
i_strcpy(str_exchDCBTR_660004671,"")
erreur_660004671 = i_get_art_str(g_iartin,$Tcomp_nss9::exchasciiTR,str_exchasciiTR_660004671)
trace2("################# str_exchasciiTR = %s ################",str_exchasciiTR_660004671,"")
position_660004671 = RECHERCHE_CARACTERE_660004265(str_exchasciiTR_660004671," ")
trace1("############ position= %d ###########",position_660004671)
SI ( position_660004671 > -1)
ALORS
  i_get_sub_str (str_exchasciiTR_660004671, 0, position_660004671 - 1 ,str_exchasciiTR_660004671)
  trace2("################# str_exchasciiTR = %s ################",str_exchasciiTR_660004671,"")
FINSI
longueur_660004671 = i_conv_ascii_dcb (str_exchasciiTR_660004671,str_exchDCBTR_660004671 )
SI (longueur_660004671 > 9)
ALORS
	longueur_660004671 = 9
FINSI
erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idemet, str_exchDCBTR_660004671, longueur_660004671)

#####################################################################
# T3t1.12 : origine (Si T3t5TR1/T4t5.10/ intIncomCallTR present et egal a 0x01, alors 0x01, sinon 0x00)
# origine   :-  :-  :MSET :00
# QC544
#####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::intIncomCallTR:0))
ALORS
  SI (i_get_art_field(g_iartin,$Tcomp_nss9::intIncomCallTR:0) == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout,$Tdpvgsm::origine,1)
  FINSI
FINSI

#####################################################################
# QC1232 evolution champ tterm pour FREE
# T3t1.14 (tterm)
# tterm   :-  :-  :MSET :FF
# avec Tcomp_nss9/disconnPartyTR:2 (3eme TR)
#####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::disconnPartyTR:2))
ALORS
  res_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::disconnPartyTR:2)
  SI (res_660004671 == 0 || res_660004671 == 1)
  ALORS
    erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 0)
  SINON
    SI (res_660004671 == 2)
    ALORS
      erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::tterm, 1)
    FINSI
  FINSI
FINSI

#####################################################################
# V3t2 (idpart) ; idpart absent dans la table de duplication
#QC549 : choix automate roamers2 au lieu de roamers
SI (i_valid_field_n(g_iartin, $Tcomp_nss9::CallingNumTR))
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t2","")
  ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR
  SI (i_get_art_field(g_iartin, ic_idpartTransit_660004671 - 1) == 2) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
    (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f)
  ALORS
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:MET_ASN1_410,0)
  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::idpart,-$NORM:ROAMERS2,0)
  FINSI

  # Erreur de normalisation
  SI erreur_660004671
  ALORS
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671 = i_PlvMessEmettre(8519,2,g_iartout12,"",3, code_rejet_660004671, "TRTR", "idpart")
    SAUT STOCKE_ERRONE
  FINSI
FINSI

#####################################################################
# V3t3 (local), V3t38.1 (origCallpartId)

SI (i_get_art_field(g_iartin, $Tcomp_nss9::calledNumberTR3 - 2) > 0)
ALORS
  # V3t3 (local)
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t3","")
  erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::calledNumberTR3,$Tdpvgsm::local,-$NORM:MET_ASN1_NEW,0)
  SI erreur_660004671
  ALORS
    ERREUR_660004671 = ERR_NORM_660004671
    code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
    erreur_660004671 = i_PlvMessEmettre(8519,2,g_iartout12,"",3, code_rejet_660004671, "TRTR", "local")
    SAUT STOCKE_ERRONE
  FINSI
  # V3t38.1 (origCallpartId)
  erreur_660004671 = i_ajout_tlv(g_iartout, "T4t38.1", "")
  erreur_660004671 = i_get_art_str(g_iartout, $Tdpvgsm::local, pt_temp1_660004671)
  erreur_660004671 = i_set_art_str(g_iartout, $Tdpvgsm::origCallpartId, pt_temp1_660004671)
  erreur_660004671 = i_resize_tlv(g_iartout, "T4t38.1","origCallpartId", i_strlen(pt_temp1_660004671))
FINSI

#####################################################################
# V3t4 (MSISDN) avec (Tcomp_nss9::globalTitle_IC modif G3R9)
# G3R9 lot1 avec Tcomp_nss9::globalTSSNum_IC

SI (i_get_art_field(g_iartin, $Tcomp_nss9::globalTSSNum_IC - 1) > 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t4", "")
  taille_chp_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::globalTSSNum_IC - 1)
# QC490
  SI (taille_chp_660004671 > 19)
  ALORS
    taille_chp_660004671 = 19
  FINSI
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t4","MSISDN", taille_chp_660004671 * 8)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MSISDN, i_get_art_fieldptr(g_iartin, $Tcomp_nss9::globalTSSNum_IC), taille_chp_660004671)
FINSI

#####################################################################
# Traitement du champ portOrigNet (T3t6)
#
# Entree : T3t1MO1/T4t1.14/origLocNumber_MO, sortie : V3t6 (portOrigNet)
# Si numero impacte present et  commence par 41, Normalisation avec automate CIT_IDENT (suppression  TON + NPI) Sinon champ absent
#####################################################################

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

# --- Si le champ est absent le T3t6 du DPV sera absent
SI (origLocNum_present_660004671)
ALORS
  taille_660004671 = i_get_art_field(g_iartin, $Tcomp_nss9::origLocNumTR:0 -1)
  SI (taille_660004671 >= 2)
  ALORS
    TON_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 0)
    NPI_origLocNum_660004671 = i_get_art_fieldtab(g_iartin, $Tcomp_nss9::origLocNumTR:0, 1)

    # --- portOrigNet sera absent du DPV si en entree le champ
    # --- origLocNumber a un TON NPI different de 41 (E///)
    # --- ou A1 (alcatel)  et si le
    # --- numero ne commence pas par 61 ou 62 ou 63
    SI ( (TON_origLocNum_660004671 == 4) && (NPI_origLocNum_660004671 == 1) )
    ALORS
# --- On normalise le champ origLocNumber vers le champ V3t6 du DPV (portOrigNet)
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t6","")
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin, g_iartout, $Tcomp_nss9::origLocNumTR:0,$Tdpvgsm::portOrigNet, -$NORM:CIT_IDENT, 0)
      SI erreur_660004671
      ALORS
        trace("MSOTR : Erreur dup_chp_rnis - T3t6")
        ERREUR_660004671 = ERR_NORM_660004671
        code_rejet_660004671 = MODULE_660004671 + ERREUR_660004671 + EFFICACE_660004671
        erreur_660004671=i_PlvMessEmettre(8519 ,2 , g_iartout12, "" , 3, code_rejet_660004671, "TRTR", "portOrigNet")
        SAUT STOCKE_ERRONE
      FINSI
    FINSI
  FINSI
FINSI


####################################################################
## T3t12 : portpref
####################################################################
SI ( RoutingNumberVal_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t12", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t12","portpref",16)
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 0,(RoutingNumberVal_660004671 / 1000) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 1,(RoutingNumberVal_660004671 / 100) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 2,(RoutingNumberVal_660004671 / 10) % 10 )
  erreur_660004671 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::portpref, 3,(RoutingNumberVal_660004671 % 10 ))
FINSI


####################################################################
## T3t16 : TrSortant (g_iartin,$Tcomp_nss9::outgoingRouteTR:2)
####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::outgoingRouteTR:2))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::outgoingRouteTR:2 - 1))
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t16", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t16","TrSortant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::outgoingRouteTR:2)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrSortant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI

####################################################################
## T3t17 : TrEntrant (g_iartin,$Tcomp_nss9::incomingRoute:0)
####################################################################
SI (i_valid_field_n(g_iartin,$Tcomp_nss9::incomingRoute:0))
ALORS
  tailleChpTrans_660004671=i_get_art_field(g_iartin,($Tcomp_nss9::incomingRoute:0 - 1))
  SI    (tailleChpTrans_660004671 > 7 )
  ALORS
    tailleChpTrans_660004671 = 7
  FINSI
  erreur_660004671 = i_ajout_tlv(g_iartout, "T3t17", "")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t17","TrEntrant",tailleChpTrans_660004671)
  pt_outgoingRouteTR_660004671 = i_get_art_fieldptr(g_iartin,$Tcomp_nss9::incomingRoute:0)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::TrEntrant, pt_outgoingRouteTR_660004671, tailleChpTrans_660004671)
FINSI

###################################################################
#  V4t30.1 (timeInCE) et V4t30.2 (eec)
###################################################################

########### timeInCE=Date_Audit
erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE,  i_DHgetLocalTime(4, 7, i_date_audit()))
########### eec
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004671 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

####################################################################
## T3t34 : ZBprefix (g_iartin,$Tcomp_nss9::calledNumberTR1)
####################################################################
SI (ZBPrefixVal_660004671 != -1)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t34","")
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t34","ZBprefix",3*8)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 0, 6)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 1, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 2, 0)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 3, ZBPrefixDigitD_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 4, ZBPrefixDigitO_660004671)
  erreur_660004671 = i_set_art_fieldtab(g_iartout,$Tdpvgsm::ZBprefix, 5, ZBPrefixDigitT_660004671)
FINSI

####################################################################
# G3R3 lot2 TRTR ajout T3T63 (LastCallingNb) valorise
# par  T3t5TR1/T4t5.11/redirectNumTR ou  T3t5TR1/T4t5.13/CallingNumTR
###################################################################
#####################################################################
# Traitement d'un eventuel prefixe de portabilite
# dans le champ redirectNumTR:0
#####################################################################
#G3R8 Lot 3 reiterer la normalisation avec les champs candidats
#####################################################################

redirectNumTR_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumTR:0 - 1))
SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
  SI (RoutingNumberLong_660004671 == 2)
  ALORS
    SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f))
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication TRTR du champ LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      SAUT RedirectNorma1
    FINSI
  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_NEW_2242,0)
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication TRTR du champ LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
      SAUT RedirectNorma1
    FINSI
  FINSI
SINON

  POINT RedirectNorma1
  SI (i_valid_field_n(g_iartin, $Tcomp_nss9::CallingNumTR:0))
  ALORS
    SI (!i_valid_field_n(g_iartout, $Tdpvgsm::LastCallingNb))
    ALORS
      erreur_660004671 = i_ajout_tlv(g_iartout,"T3t63","")
    FINSI
    ic_idpartTransit_660004671 = $Tcomp_nss9::CallingNumTR:0
    SI ((i_get_art_field(g_iartin, ic_idpartTransit_660004671 - 1) == 2) &&
      (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, ic_idpartTransit_660004671, 3) == 0x0f))
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:MET_ASN1_410,0)
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,ic_idpartTransit_660004671,$Tdpvgsm::LastCallingNb,-$NORM:ROAMERS2,0)
    FINSI
    #QC925
    SI ( erreur_660004671 != 0)
    ALORS
      trace("Tcomp_nss9: Erreur de duplication TRTR du champ LastCallingNb")
      #erreur = i_retrait_tlv(g_iartout, "T3t63", "")
    FINSI
  FINSI
FINSI
################################################################
# G3R3 lot2 TRTR ajout T3t64 (RedirectingNb) valorise
# par T3t5TR1/T4t5.11/redirectNumTR
################################################################
#QC861 correction alimentation de T3t64(RedirectingNb) - MAIL du 28/04/11 17:49
redirectNumTR_present_660004671 = i_valid_field_n(g_iartin, $Tcomp_nss9::redirectNumTR:0)
RoutingNumberLong_660004671 = i_get_art_field(g_iartin,($Tcomp_nss9::redirectNumTR:0 - 1))
SI (redirectNumTR_present_660004671 && RoutingNumberLong_660004671 != 0)
ALORS
  erreur_660004671 = i_ajout_tlv(g_iartout,"T3t64","")
  SI (RoutingNumberLong_660004671 == 2)
  ALORS
    SI ((i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 0) == 4) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 1) == 1) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 2) == 0) &&
      (i_get_art_fieldtab(g_iartin, $Tcomp_nss9::redirectNumTR:0, 3) == 0x0f))
    ALORS
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_410,0)
    SINON
      erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)
    FINSI

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

  SINON
    erreur_660004671 = i_dup_chp_rnisGSM(g_iartin,g_iartout,$Tcomp_nss9::redirectNumTR:0,$Tdpvgsm::RedirectingNb,-$NORM:MET_ASN1_NEW_2242,0)

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

  FINSI
FINSI

##########################################################
#G3R8 lot2 Ajout du champ T3t70 si joignabilite detecte
########################################################

SI (PREFIXJoig_660004671==1)
ALORS
  trace2("<<__LINE__>>---------pt_PrefixJoing=%s prefix joignabilite detecte---------",pt_PrefixJoing_660004671,"")
  erreur_660004671  = i_ajout_tlv(g_iartout,"T3t70","")
  longueur_660004671 = i_conv_ascii_dcb(pt_PrefixJoing_660004671,pt_PrefixJoingDCB_660004671)
  erreur_660004671 = i_memcpy_art_field_n(g_iartout,$Tdpvgsm::PrefixeSVA,pt_PrefixJoingDCB_660004671, longueur_660004671)
  erreur_660004671 = i_resize_tlv(g_iartout,"T3t70","PrefixeSVA",longueur_660004671 * 8)
FINSI



#####################################################################
#         Stockage
#####################################################################
POINT STOCKE_DPV_TRTR
trace("Tcomp_nss9/TRTR - STOCKE_DPV")

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

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

erreur_660004671 = aiguillage2_660004590 (g_iartout12, g_iartout, DISTRIBUTION_INCONNU_660004671, Multidistribution_Non_660004671)
# QC1005
SI (erreur_660004671 == TRAI_KO_660004671)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
# ERREUR = ERR_DISTR
# code_rejet = MODULE + ERREUR + EFFICACE
# erreur=i_PlvMessEmettre(8523 ,2 , g_iartout12, "" , 2, code_rejet, "TRTR", 0)
  SAUT STOCKE_ERRONE
FINSI

SAUT FIN_DISTRIB

# /G2R6 ###########################################################################

# Fin G1R5 FO607 le type TR n'est plus genere
##############################################################
POINT FIN_DISTRIB
trace("**** Tcomp_nss9 : Fin creation article dans le format pivot OK")

RETOUR TRAIT_OK

#
# stockage des errones
#
POINT STOCKE_ERRONE
trace("Tcomp_nss9: Stockage en ERRONE")
erreur_660004671 = i_make_art_rej(g_iartout12, g_iartout11, code_rejet_660004671)
erreur_660004671 = i_stocke_art(g_iartout11, 0, PT_ERRONE, 0)
RETOUR TRAIT_OK
#----------------------Fin Tcomp_nss9_dis.src --------------
