export data file line break

Database
Highlighted
Tourist

export data file line break

Hi,

 

I use the script PRE-060-CTL-010-GET-QUERIES.sql joined which paste the result of the query in a file with .export data file = $LIST_REQUETE.tmp    .set width 10000
The result of the query in SQL Assistant are 2 text files.


In some case we observe in the final file which is a paste of the tet files one after the other a line break between the paste of the two files in the final file, I need to understand why, because this line break causes problems.
Final file ok and not ok are joined.


How can I delete this line break ?


Thanks for your help

 

PRE-060-CTL-010-GET-QUERIES.sql

--> Macro début : Ecriture des traces dans la table de traces
.os $PERL_DIRECTORY $current_path/PRE-000-CFG-020-PERROR.pl "func-1-6-1010-2" ;

--------------------------------------------------------------------------------
-- ** Extraction du référentiel des requêtes de contrôle **
--------------------------------------------------------------------------------
.export data file = $LIST_REQUETE.tmp

.set width 10000

Select 	'$separator_req'||Case When Ord_id = 0 And Ord_id <> Txt_Count-1 Then 
		'
Insert Into $DB_TECH_AP.TRT_CTRL_QUERY_TRACE 
(
   TS_ID_TRT_CTRL    , 
   Query_Id          , 
   ProcessDt         , 
   ExecTm            , 
   NEXEC             , 
   TS_START_TRT_CTRL , 
   STATE_TYP_ID
) 
Select Current_TimeStamp(0) ,
       '''||Trim(sto.Query_Id)||''',
       ini.ProcessDt        ,
       ini.ExecTm           ,
       ini.NEXEC            ,
       Current_TimeStamp(0) ,
       2 

From $DB_TECH_AP.INI_BATCH_START ini
;
		
.Set ErrorLevel 3807 Severity 00; 
Drop Table $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||' ; 
.Set ErrorLevel 3807 Severity 08; 

Create MultiSet Table $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||'
(
   EVENT_ID   Char(12)      Not Null ,
   NFOY       Decimal(18,0) Not Null ,
   CCLI       Decimal(18,0) Not Null ,
   NOCIKAC    Decimal(14,0)          ,
   ITECHEVT   Decimal(18,0)      
) Primary Index ( CCLI )
;
.if errorcode <> 0 then .goto err_create
 
Insert Into $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||' (EVENT_ID, NFOY, CCLI, NOCIKAC, ITECHEVT) 
Select '''||Trim(lnk.Event_id)||''' , 
       tmp.NFOY     , 
       tmp.CCLI     ,
       '||
       Case When ctl.Typ_Cd = 'C' Then '0' 
            When ctl.Typ_Cd = 'D' Then 'tmp.NOCIKAC'
            When ctl.Typ_Cd = 'E' Then '0'
       End ||' , 
       '||
       Case When ctl.Typ_Cd = 'C' Then '0' 
            When ctl.Typ_Cd = 'D' Then '0'
            When ctl.Typ_Cd = 'E' Then 'tmp.ITECHEVT'
       End ||' 

From ('||sto.Txt_Value || '$separator_req'

When Ord_id = 0 And Ord_id = Txt_Count-1 Then 
		'
Insert Into $DB_TECH_AP.TRT_CTRL_QUERY_TRACE 
(
   TS_ID_TRT_CTRL    , 
   Query_Id          , 
   ProcessDt         , 
   ExecTm            , 
   NEXEC             , 
   TS_START_TRT_CTRL , 
   STATE_TYP_ID
) 
Select Current_TimeStamp(0) ,
       '''||Trim(sto.Query_Id)||''',
       ini.ProcessDt        ,
       ini.ExecTm           ,
       ini.NEXEC            ,
       Current_TimeStamp(0) ,
       2 

From $DB_TECH_AP.INI_BATCH_START ini
;
		
.Set ErrorLevel 3807 Severity 00; 
Drop Table $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||' ; 
.Set ErrorLevel 3807 Severity 08; 

Create MultiSet Table $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||'
(
   EVENT_ID   Char(12)      Not Null ,
   NFOY       Decimal(18,0) Not Null ,
   CCLI       Decimal(18,0) Not Null ,
   NOCIKAC    Decimal(14,0)          ,
   ITECHEVT   Decimal(18,0)      
) Primary Index ( CCLI )
;
.if errorcode <> 0 then .goto err_create
 
Insert Into $DB_WORK.wk_QUERY_CTL_'||Trim(sto.Query_Id)||' (EVENT_ID, NFOY, CCLI, NOCIKAC, ITECHEVT) 
Select '''||Trim(lnk.Event_id)||''' , 
       tmp.NFOY     , 
       tmp.CCLI     ,
       '||
       Case When ctl.Typ_Cd = 'C' Then '0' 
            When ctl.Typ_Cd = 'D' Then 'tmp.NOCIKAC'
            When ctl.Typ_Cd = 'E' Then '0'
       End ||' , 
       '||
       Case When ctl.Typ_Cd = 'C' Then '0' 
            When ctl.Typ_Cd = 'D' Then '0'
            When ctl.Typ_Cd = 'E' Then 'tmp.ITECHEVT'
       End ||' 

From ('||sto.Txt_Value ||' ) tmp   
; 
.if errorcode <> 0 then .goto err_ctrl
.if ActivityCount = 0 then .goto err_war
 
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 0 , 
       ERR_CTRL_DESC = ''''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_create
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = ''Erreur lors de la création de la table de travail contrôle''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_ctrl
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = ''Erreur lors de l exécution de la requête de contrôle''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_war
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 4 , 
       ERR_CTRL_DESC = ''La requête de contrôle ne renvoie aucune donnée''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
 
.label exit_ctrl $separator_ctl$separator_req '




When Ord_id = Txt_Count-1 Then sto.Txt_Value||' ) tmp  
; 
.if errorcode <> 0 then .goto err_ctrl
.if ActivityCount = 0 then .goto err_war
 
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 0 , 
       ERR_CTRL_DESC = ''''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_create
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = ''Erreur lors de la création de la table de travail contrôle''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_ctrl
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = ''Erreur lors de l exécution de la requête de contrôle''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
.goto exit_ctrl

.label err_war
Update $DB_TECH_AP.TRT_CTRL_QUERY_TRACE
From $DB_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 4 , 
       ERR_CTRL_DESC = ''La requête de contrôle ne renvoie aucune donnée''
       
Where $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And $DB_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = '''||Trim(sto.Query_Id)||'''
;
 
.label exit_ctrl $separator_ctl$separator_req '
 
 Else sto.Txt_Value || '$separator_req' End (Varchar(21000)) (Title '')

From $DB_TECH_MT.CTL_QUERIES_STORAGE sto 
     
     Inner Join $DB_TECH_MT.CTL_QUERIES ctl
     On sto.Query_Id = ctl.Query_Id
     
     Inner Join $DB_TECH_MT.CTL_LINK_EVENT lnk
     On  ctl.Query_Id = lnk.Query_Id
     And lnk.Event_Id In (
     		                Select Event_id
     		                
     		                From $DB_META.CM_COMMUNICATION_EVENT cce
     		                
     		                	 Inner Join $DB_LEAD.LH_CURRENT_LEAD lcl
     		                     On lcl.communication_id = cce.communication_id
     		                Where Not Exists ( 
     		                                   Select 1
     		                				   From $DB_LEAD.RT_CHANNEL_RESPONSE   rcr
     		                				   
     		                				   Inner Join $DB_META.CM_RESPONSE        cmr
     		                				   		On  cmr.Response_Id    = rcr.Response_Id
     		                				   		And cmr.Action_Type_Cd Not In (6,7)
     		                				   		
     		                				   Where
     		                				   		lcl.NFOY                  = rcr.NFOY               
     		                				   	And lcl.CCLI                  = rcr.CCLI               
     		                				   	And lcl.Selection_Dttm        = rcr.Selection_Dttm     
     		                				   	And lcl.Selection_Group_Ord   = rcr.Selection_Group_Ord
     		                				   	And lcl.Communication_id      = rcr.Communication_id   
     		                				   	And lcl.Comm_plan_id          = rcr.Comm_plan_id       
     		                				   	And lcl.Message_Id            = rcr.Message_Id              
     		                				   	And lcl.Step_Id               = rcr.Step_Id                    
     		                				   	And lcl.Step_Dttm             = rcr.Step_Dttm 
     		                				  )               
     		                Group By Event_id 
     	                 )                
                                                              
-- Where sto.Query_Id In ('111','222')

Order By sto.Query_Id, sto.Ord_id
;
.if errorcode <> 0 then .os $PERL_DIRECTORY $current_path/PRE-000-CFG-020-PERROR.pl "1015"    ; 
.if errorcode <> 0 then .quit 9 
.if activitycount = 0 then .os $PERL_DIRECTORY $current_path/PRE-000-CFG-020-PERROR.pl "1020" ; 

.os $PERL_DIRECTORY $current_path/PRE-000-CFG-020-PERROR.pl "1010" ; 


.export reset

-- Renommage du fichier temporaire
.os $PERL_DIRECTORY $current_path/ACT-001-Action-Move.pl -o $LIST_REQUETE.tmp -n $LIST_REQUETE


--> Macro début : Début exécution des contrôles
.os $PERL_DIRECTORY $current_path/PRE-000-CFG-020-PERROR.pl "func-1-6-1060-2" ;

Final file

$separator_req
Insert Into DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE 
(
   TS_ID_TRT_CTRL    , 
   Query_Id          , 
   ProcessDt         , 
   ExecTm            , 
   NEXEC             , 
   TS_START_TRT_CTRL , 
   STATE_TYP_ID
) 
Select Current_TimeStamp(0) ,
       'GCMCTL000361',
       ini.ProcessDt        ,
       ini.ExecTm           ,
       ini.NEXEC            ,
       Current_TimeStamp(0) ,
       2 

From DB_GCM_TECH_AP.INI_BATCH_START ini
;
		
.Set ErrorLevel 3807 Severity 00; 
Drop Table DB_GCM_WORK.wk_QUERY_CTL_GCMCTL000361 ; 
.Set ErrorLevel 3807 Severity 08; 

Create MultiSet Table DB_GCM_WORK.wk_QUERY_CTL_GCMCTL000361
(
   EVENT_ID   Char(12)      Not Null ,
   NFOY       Decimal(18,0) Not Null ,
   CCLI       Decimal(18,0) Not Null ,
   NOCIKAC    Decimal(14,0)          ,
   ITECHEVT   Decimal(18,0)      
) Primary Index ( CCLI )
;
.if errorcode <> 0 then .goto err_create
 
Insert Into DB_GCM_WORK.wk_QUERY_CTL_GCMCTL000361 (EVENT_ID, NFOY, CCLI, NOCIKAC, ITECHEVT) 
Select 'GCM1LLM2KGV7' , 
       tmp.NFOY     , 
       tmp.CCLI     ,
       0 , 
       0 

From (SELECT DISTINCT  B.NFOY, B.CCLI
FROM 
DBBMDP2_VUE.VBRCBPPMC_0 B INNER JOIN 
DBBMDP2_VUE.VQLFBPPMC_0 Q ON Q.CCLIKPI = B.CCLIKPI
WHERE
B.NFOY IS NOT NULL AND
(B.ISAR = 1 OR 
B.ICLIDECE = 1 OR 
B.IING = 1  OR
B.ISUR = 1 OR
B.IINB = 1  OR
B.II$separator_req
HERE IS A LINE BRAK
$separator_reqNJ = 1 OR
B.ICSG = 1 OR
B.IOCI = 1  OR
Q.CCLTFICP > 0 OR
B.CRISSAGE IN ('R9','R6') OR
B.ICER = 1 OR
B.IEDX = 1 OR
B.INEIE = 1 ) ) tmp  
; 
.if errorcode <> 0 then .goto err_ctrl
.if ActivityCount = 0 then .goto err_war
 
Update DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE
From DB_GCM_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 0 , 
       ERR_CTRL_DESC = ''
       
Where DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = 'GCMCTL000361'
;
.goto exit_ctrl

.label err_create
Update DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE
From DB_GCM_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = 'Erreur lors de la création de la table de travail contrôle'
       
Where DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = 'GCMCTL000361'
;
.goto exit_ctrl

.label err_ctrl
Update DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE
From DB_GCM_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 9 , 
       ERR_CTRL_DESC = 'Erreur lors de l exécution de la requête de contrôle'
       
Where DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = 'GCMCTL000361'
;
.goto exit_ctrl

.label err_war
Update DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE
From DB_GCM_TECH_AP.INI_BATCH_START ini
Set    TS_END_TRT_CTRL = Current_TimeStamp(0) ,
       TRT_CTRL_DURATION = ((Current_Timestamp(0) - TS_START_TRT_CTRL) Hour(3) To Second(0)) ,
       STATE_TYP_ID  = 4 , 
       ERR_CTRL_DESC = 'La requête de contrôle ne renvoie aucune donnée'
       
Where DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ProcessDt = ini.ProcessDt
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.ExecTm    = ini.ExecTm   
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.NEXEC     = ini.NEXEC
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.TS_END_TRT_CTRL Is Null
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.STATE_TYP_ID = 2
  
  And DB_GCM_TECH_AP.TRT_CTRL_QUERY_TRACE.Query_Id  = 'GCMCTL000361'
;
 
.label exit_ctrl $separator_ctl$separator_req