19 SEPTEMBER 2025
Multithreading: Running multiple parts of a program (threads) at the same time, within a single process.
• A thread is like a lightweight sub-process.
• Each thread shares the same memory/resources of the program but executes independently.
• This allows better parallelism (doing multiple tasks simultaneously).
Multithreading Modes in T24
• Online: Runs during day-to-day, immediate processing (e.g., FT input).
Executed in real-time, user-initiated.
• Batch: Runs during COB (Close of Business).
COB Stages Batch env
• A → Application • F = Foreground (run online/browser)
• S → System wide • B = Background (Phantom mode) runs via tRun [Link].
• R → Reporting
• D → Date change (Start of Day) Frequency
• → Online
• D = Daily
Process status/Job status • M = Monthly
• W = Weekly
• 0 = Ready • Dnn = every nn days
• 1 = Running
[Link]: e.g., [Link], [Link] (routine names)
• 2 = Completed
Verification: if multiple routines are attached, the second one verifies
• 3 = Error
Multithread Routine Flow
Load → initialise all objects/resources (initialise() – optional).
Select → define selection criteria (getIds() / getTableName()).
Process → update (updateRecord(), postUpdateRequest()).
Service Routine
• Superclass: ServiceLifecycle
Agents setup
In [Link] → set Agents Required = (2,3,4,… for multithread, 1 for singlethread).
If the service has more records and agents working are less, then we can increase the agents by setting req agents.
22 SEPTEMBER 2025
Updating all CUSTOMER records by prefixing "Test-" to the short name, running in
multithreaded mode (parallel execution) during service/COB.
Short name : Test-Vero07
public class shortnameprefix extends ServiceLifecycle {
DataAccess da = new DataAccess(this);
@Override
public List<String> getIds(ServiceData serviceData, List<String> controlList)
{
// TODO Auto-generated method stub
List<String> rec = null;
rec = [Link]("BNK", "CUSTOMER", "","");
return rec;
}
@Override
public void postUpdateRequest(String id, ServiceData serviceData, String
controlItem,List<TransactionData> transactionData, List<TStructure> records)
{
// TODO Auto-generated method stub
CustomerRecord cusRec = new CustomerRecord([Link]("CUSTOMER", id));
String mne = [Link]().getValue();
[Link]("Test-" + mne,0);
[Link]([Link]());
TransactionData txdata = new TransactionData();
[Link]("INPUT");
[Link]("0");
[Link](id);
[Link]("[Link]");
[Link]("CUSTOMER");
[Link](txdata);
}
Routine sent as syntax in encrypted format.
Steps for creating/attaching multithread routine
1. [Link] (3): For multithread routines methods. 2. [Link]: (To introduce routine to t24)
Id is same as [Link] Process id.
initialise() → setup (optional)
getIds() → selection Type → B (batch multithread routine)
Batch Job: @[Link]
(core routine that separates the job).
Product: EB
updateRecord() → processing
3. BATCH: (ID must match [Link]) 4. [Link]
Example: BNK/[Link] (start with BNK/)
Description = (Small info)
Batch env = F User = User id
Job name = [Link] ID Service control → start
Freq = D
5. Check for the [Link] >> TSM : SERVICE CONTROL IS IN START
(If not, change it to start)
6. Login the DBTools >> JQL 7. Start the TSM to pick agent
tRun [Link] -DEBUG
CLEAR-FILE [Link]
The agents tSA will launch.
CLEAR-FILE [Link]
Exit using: x
8. Pick up one of the agents and run the service.
tRun tSA 2
The routine should be tiggered and the records should be selected.
So the output will be reflected in the host after this process is successfull .
Workout until this.
SINGLE THREAD
Example with CSVs
Multi-thread: Single-thread:
• tsa1 works on [Link], • Only tsa1 runs.
• tsa2 works on [Link], • Reads [Link] → writes to [Link].
• tsa3 works on [Link]. • Then [Link] → appends.
• Then [Link] → appends.
→ They all run in parallel and write to [Link] at the • Finally [Link] → appends.
same time. mixed / interleaved records.
→ Clean, ordered output.
Why Single Thread?
• Order matters: If you let multiple agents pick records in parallel, order will get mixed
up (some Account rows may appear before all Customer rows are finished).
• Consistency: For sequential processing or cumulative calculations (like building one
consolidated file, running accruals, or applying balances in sequence), only one agent
should handle the flow.
• Deterministic output: Single thread guarantees that every run produces the same file
structure and record sequence.
Superclass Used: ServiceLifecycle.
Method Used: processSingleThreaded
Steps to Create Single Thread
Write routine and follow the same steps as in MultiThread.
• Create [Link], (3)
• Create [Link],
➢ Batch job → [Link] id (process). >> Difference between the multi and single thread
• Create BATCH, & [Link],
• Check for [Link] :: TSM start
• Login the DBTools >> JQL
➢ CLEAR-FILE [Link]
➢ CLEAR-FILE [Link]
• Start the TSM :: tRun [Link] -DEBUG
• Pick up one of the agents and run the service :: tRun tSA 2
In T24 multithreaded routines, the TransactionData object is the bridge between your Java code and
the OFS layer:
TransactionData:
• It packages up the function, version, transaction ID, and source into an OFS request.
1. TransactionData (asynchronous) →
o The routine prepares the transaction.
o Control immediately returns.
o Actual commit happens later by [Link].
o Best for bulk updates during COB.
2. SynchronousTransactionData (synchronous) →
o Your routine waits until the transaction is processed.
o You can check success/failure immediately.
o Useful when you must ensure the update happened before moving on.
OFS in java
1. Synchronous >> source (optional)
2. Asynchronous >> source (mandatory)