REENTRANT

Syntax:

>>-.---.-.-----REENTRANT---"n"--.-------><
   +-/-+ +-NO--REENTRANT--------+

Parameters:

n
One of:
1
All compiler-generated temporary work areas are allocated on a per thread basis. All user data and FD file areas allocated in the Environment and Data Divisions will be shared by all threads. It is the responsibility of the programmer to ensure serialization to the program's data by use of the CBL_ synchronization calls.
2
All user data and FD file areas allocated in the Environment and Data Divisions are allocated on a per thread basis. EXTERNAL data and files will always be shareable by all threads.

Properties:

Default: NOREENTRANT
Phase: Syntax check
$SET: Initial

Comments:

Use REENTRANT"1" wherever possible for any program you wish to be reentrant. Use REENTRANT"2" only as the first step towards converting an existing program to be reentrant.

Note:
  • The Compiler rejects the REENTRANT directive if you use it with programs that use:
    • ALTER statements
    • Debug facility (SOURCE-COMPUTER... WITH DEBUGGING)
    • ON statements
    • Segmentation
    • Any of the following directives:
      • STICKY-LINKAGE
      • STICKY-PERFORM
  • If you are using the PROGRAM-ID. … IS INITIAL statement, you cannot use REENTRANT”1”, and can only use REENTRANT “2” if the program does not contain nested programs.
  • Do not use the REENTRANT directive in a ThreadPool environment such as that used by ASP.NET. You must use the multiple run units model instead. See the chapter Multiple User COBOL Applications in .NET in your User's Guide and MicroFocus.Cobol.RuntimeServices.RunUnit Class Reference.