IFDTHRD (HLI function)
The conventions used on this page are described in Function call notation conventions.
Summary
- Description
- The IFDTHRD call (DETACH THREAD) detaches the current thread and activates the specified IFSTRT thread.
- Thread type
- multiple cursor IFSTRT, single cursor IFSTRT
- IFCALL function number
- 42
Syntax
IFDTHRD|IFDTRD(RETCODE,NEW_ID,OLD_ID)
- Compile-only form
- Not available
- Execute-only form
- Not available
Specify the parameters in the syntax order shown above.
Parameter | Description |
---|---|
RETCODE | [O,i,r] The Model 204 return code is a required output parameter. The code is a binary integer value. |
NEW_ID | [I,i,r] The new thread identifier is a required input parameter that identifies the thread to be made current. This is the thread identifier previously assigned by the IFSTRT or IFSTRTN call that started the thread. (See the THRD_ID parameter for IFSTRT (IFAM2/IFAM4).) Specify an integer value. |
OLD_ID | [O,i,r] The old thread identifier is a required output parameter that identifies the thread that is being detached. Model 204 returns the integer value that identifies the current thread. |
Usage notes
Use the IFDTHRD call to switch from the current thread to another, while freeing the old thread. IFDTHRD entails low overhead. You cannot use IFDTHRD to detach the current thread without specifying a new thread.
Note: Update units must begin and end on the same thread. To assure that any in-progress update unit ends on the current thread, issue an IFCMMT or IFCMTR on the current thread before the call to IFDTHRD.
The IFDTHRD call is useful for switching threads in a multithreaded IFAM2 or IFAM4 transaction using single cursor IFSTRT threads. IFDTHRD is not valid for use with an IFAM1 thread.
Note: IFDTHRD is valid for use only with an IFSTRT thread. If your job started both IFSTRT and IFDIAL threads and you use the IFDTHRD call to detach threads, IFDTHRD releases an IFSTRT thread without disconnecting the IFDIAL thread.
Completion return code (RETCODE)
If the IFDTHRD call is unsuccessful, Model 204 returns one of the following error codes:
Code | Error condition |
---|---|
95 | Nonexistent new thread specified. Call ignored. |
96 | New thread is already the current thread and is not detached. |
Coding example (COBOL)
WORKING-STORAGE SECTION. 01 ARGS-FOR-CALL. 05 RETCODE PIC 9(5) COMP SYNC. 05 NEWID PIC 9(5). 05 OLDID PIC 9(5). . . . PROCEDURE DIVISION. . . . CALL "IFDTHRD" USING RETCODE, NEWID, OLDID.