> For the complete documentation index, see [llms.txt](https://docs.editran.onesait.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.editran.onesait.com/documentacion-editran/ibm-editran-v5.3-ims-en/recuperacion-transmisiones-ims/proceso-batch-de-recuperacion-de-ficheros.md).

# Batch file recovery process

The recovery (and sending or loading) is executed in a special ZTBEPRE process that is launched by the transmission engine's batch process interface. The execution consists of an EXEC PROC of this procedure under the JCL cards of the presentation session of the presentation engine.

The process has several steps that are executed conditionally according to the chosen option and whether the load was performed using macrofiles or not.

The first step determines whether the load used macrofiles. This is inferred from the existence of APL PARAMETERS in the presentation session. If the session contains this field, even if the load was performed normally, the macrofiles path will be followed.

The second step retrieves the list of file names.

If the load is ordinary, it will search the presentation history file for the files that were loaded in that transmission. The reference it uses is the record key supplied by the monitoring transaction that launched the process, so it must find it (unless the transmission was deleted from the history between launch and process execution)

If the load used macrofiles, it will search the macrofile log file for a presentation that was loaded between the presentation start and end dates. If the presentation was loaded without using this log, or the log has been initialized (or wrapped around), the presentation will not be found. If it finds the load, it will call the macrofile load program so that it fills the output file with the data from the macrofile used in that load. For the process to be correct, the macrofile must exist and contain the original data. Each load must use a macrofile with a different name.

The result in both cases is a list of files for the following steps.

The next step displays the files by writing to DDNAME ZTBEFL03 the contents of the first 10 records of each file. In the case of macrofiles, the file listed is the output file with the previously loaded data.

The last step executes the load, load and output, or initialization and output of the session. If a macrofile was used, the load is performed through the macrofile load process, which makes it possible to recover a session that was loaded by recovery. With the 'V' display option, this step is not executed.

## ZTBEPRE recovery procedure

The steps described above are identified as

* ZTBEBRE1 for data capture.
* ZTBEBRE2 for obtaining the list of files.
* ZTBEBRE5 for obtaining the list by macrofiles.
* ZTBEBRE3 for listing the files.
* ZTBEBRE4 for their load / output.

```cobol
//             PROC FU=,L0=,L1=,L2=,R1=,R2=,AP=,ER=,FHI=,FHF=,CL=              
//*--------------------------------------------------------------------        
//*   TRANSMISSION RECOVERY PROCEDURE V4.0                              *        
//*--------------------------------------------------------------------        
//* RETURNS 0 IF IT IS AN ORDINARY LOAD, 1 IF IT IS A MACROFILE                     
//ZTBEBRE1  EXEC PGM=ZTBEBRE1,REGION=4M,                                        
//          PARM='&FU&L1&L2&R1&R2&AP&ER&FHI&FHF&CL'                           
//ZTBGFPER  DD DSN=KI.EGDI.ZTBG.PERFILES,DISP=SHR                              
//ZTBEFPAR  DD DSN=&&PAR,DISP=(NEW,PASS,DELETE),                               
//          UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),                                
//          DCB=(RECFM=FB,LRECL=109,BLKSIZE=0,DSORG=PS)                       
//   IF (RC = 0) THEN ORDINARY LOAD                                          
//* OBTAINS LIST OF STATISTICS FILES                                  
//ZTBEBRE2  EXEC IMSBATCH,MBR=ZTBEBRE2,                                         
//          PSB=ZTBEE002,IMSID=IMSP,PREFIX=IMS510P                             
//ZTBEFPAR  DD DSN=&&PAR,DISP=(OLD,PASS)                                       
//ZTBGFCAR  DD DSN=&&CAR,DISP=(NEW,PASS,DELETE),                               
//             UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),                              
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)                      
//    ELSE  LOAD BY MACROFILES                                             
//* OBTAINS LIST OF FILES FROM THE MACROFILE LOAD LOG               
//ZTBEBRE5  EXEC PGM=ZTBEBRE5,REGION=4M,COND=(1,NE,ZTBEBRE1),                   
//          PARM='&FU&L1&L2&R1&R2&AP&ER&FHI&FHF&CL'                           
//STEPLIB   DD DSN=IMS510P.RESLIB,DISP=SHR                                     
//          DD DSN=KI.EGDI.LOAD,DISP=SHR                                       
//*ZTBGFEST DD DSN=KI.EGDI.ZTBG.ESTADOS,DISP=SHR                               
//ZTBGFPER  DD DSN=KI.EGDI.ZTBG.PERFILES,DISP=SHR                              
//ZTBGFLOG  DD DSN=KI.EGDI.ZTBG.LOG,DISP=SHR                                   
//ZTBGF032  DD DSN=KI.EGDI.ZTBG.ZTBGF032,DISP=SHR                              
//ZTBGFERR  DD DSN=KI.EGDI.ZTBG.ZTBGFERR,DISP=SHR                              
//ZTBEFLOG  DD DSN=KI.EGDI.ZTBE.LOG,DISP=(SHR)                                 
//ZTBGFCAR  DD DSN=&&CAR,DISP=(NEW,PASS,DELETE),                               
//             UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),                                
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160)                              
//ZTBEFPAR  DD DSN=&&PAR,DISP=(OLD,PASS)                                       
//    ENDIF                                                                    
//*                                                                            
//* LISTS FILE CONTENT                                                
//*                                                                            
//ZTBEBRE3  EXEC PGM=ZTBEBRE3,REGION=4M,COND=(1,LT)                             
//STEPLIB   DD DSN=KI.EGDI.LOAD,DISP=SHR                                       
//ZTBGFCAR  DD DSN=&&CAR,DISP=(OLD,PASS)                                       
//ZTBEFL03  DD SYSOUT=*                                                        
//* LOAD EMITS FILES                                                       
//ZTBEBRE4  EXEC PGM=ZTBEBRE4,REGION=4M,COND=(1,LT),                            
//          PARM='&FU&L1&L2&R1&R2&AP&ER&FHI&FHF&CL'                           
//*ZTBGFEST DD DSN=KI.EGDI.ZTBG.ESTADOS,DISP=SHR                               
//ZTBGFPER  DD DSN=KI.EGDI.ZTBG.PERFILES,DISP=SHR                              
//ZTBGF032  DD DSN=KI.EGDI.ZTBG.ZTBGF032,DISP=SHR                              
//ZTBGFTCO  DD DSN=KI.EGDI.ZTBG.ZTBGFTCO,DISP=SHR                              
//ZTBGFERR  DD DSN=KI.EGDI.ZTBG.ZTBGFERR,DISP=SHR                              
//ZTBGFCAR  DD DSN=&&CAR,DISP=(OLD,PASS)                                       
//* WE USE LOCAL0 SO THAT JCL DOES NOT ERROR, BUT IT IS FICTITIOUS            
//  SET LOCAL0=&L0        
```

The execution produces the following output.

```
                   J E S 2  J O B  L O G  --  S Y S T E M  C P U B  --  N O D E  N O D O M V S B
 
20.10.11 JOB01805 ---- THURSDAY,  07 FEB 2025 ----
20.10.11 JOB01805  IRR010I  USERID KIIMSPR  IS ASSIGNED TO THIS JOB.
20.10.11 JOB01805  ICH70001I KIIMSPR  LAST ACCESS AT 20:10:10 ON THURSDAY, FEBRUAR
20.10.11 JOB01805  $HASP373 KI05AF1I STARTED - INIT 7    - CLASS A - SYS CPUB
20.10.11 JOB01805  IEF403I KI05AF1I - STARTED - TIME=20.10.11
20.10.11 JOB01805  -                                                --TIMINGS (M
20.10.11 JOB01805  -JOBNAME  STEPNAME PROCSTEP    RC   EXCP   CONN    TCB    SRB
20.10.11 JOB01805  -KI05AF1I PASO1    ZTBEBRE1    00     34     46    .00    .00
20.10.12 JOB01805  -KI05AF1I ZTBEBRE2 G           00     98    273    .00    .00
20.10.12 JOB01805  -KI05AF1I PASO1    ZTBEBRE5 FLUSH      0      0    .00    .00
20.10.12 JOB01805  -KI05AF1I PASO1    ZTBEBRE3    00     55     89    .00    .00
20.10.15 JOB01805  -KI05AF1I PASO1    ZTBEBRE4    00    530   1305    .00    .00
20.10.15 JOB01805  IEF404I KI05AF1I - ENDED - TIME=20.10.15
20.10.15 JOB01805  -KI05AF1I ENDED.  NAME-EDITRAN              TOTAL TCB CPU TIM
20.10.15 JOB01805  $HASP395 KI05AF1I ENDED
------ JES2 JOB STATISTICS ------
.
.
FILE NAME  :KI.EGDI.F01
RECORD NUMBER : 1
abcdefghijklmnopqrstuvwxyz                                            
Editran/G: 07/02/205 20:10:12. Ses-ZTG=000099980/000000010/PRUEBA.
ZTG0020: PRESENTATION OUTPUT REQUEST
+--                                                                         --+
Editran/G: 07/02/2025 20:10:14. Ses-ZTG=000099980/000000010/PRUEBA.Ses-Editran=000099980/000000010/PRUEBA
ZTG0015: AN OUTPUT REQUEST IS ASKED OF EDITRAN  (A1R)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.editran.onesait.com/documentacion-editran/ibm-editran-v5.3-ims-en/recuperacion-transmisiones-ims/proceso-batch-de-recuperacion-de-ficheros.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
