Runtime enhancements
The runtime 2024 R1 has been enhanced with new configuration options and a new library routine.
New configurations
When a COBOL application employs thread programming, leveraging statements like CALL THREAD or PERFORM THREAD, it becomes challenging to track the program's execution flow due to multiple threads running concurrently. While it is feasible to navigate through threads step by step in a debugger, there are instances when it is crucial to observe the simultaneous execution of all threads. This reflects the actual scenario when the program is running in a live production environment.
Analyzing runtime execution has been simplified with the introduction of a new configuration, namely iscobol.logfile.thread=true. This configuration enables the tracking of thread numbers at the end of each log line.
For example, a code such as:
           perform thread DO-CHECK
           perform thread DO-CHECK
           ...
       DO-CHECK.
           call "C$SLEEP" using 1
           set environment "myevn" to varx
           ...
when running using the following configuration settings:
iscobol.logfile=isc.log
iscobol.tracelevel=1039
produces the following content in the log file:
...
12... INFO: ENTER PARAGRAPH 'DO-CHECK' [PROGA]
12... INFO: ENTER PARAGRAPH 'DO-CHECK' [PROGA]
12... INFO: ENTER isCOBOL LIB 'C$SLEEP' {
12... INFO: ENTER isCOBOL LIB 'C$SLEEP' {
12... INFO: SET ENVIRONMENT [users] 'iscobol.myevn=cust2'
12... INFO: SET ENVIRONMENT [users] 'iscobol.myevn=cust1'
...
It’s possible to see that the paragraph DO-CHECK has been executed 2 times, but it’s unclear if it has been executed by the same thread or two different threads.
Adding the new configuration:
iscobol.logfile.thread=true
the output becomes:
...
12... INFO: ENTER PARAGRAPH 'DO-CHECK' [PROGA] [PROGA Thread=4]
12... INFO: ENTER PARAGRAPH 'DO-CHECK' [PROGA] [PROGA Thread=5]
12... INFO: ENTER isCOBOL LIB 'C$SLEEP' { [com.iscobol.lib.C$SLEEP Thread=4]
12... INFO: ENTER isCOBOL LIB 'C$SLEEP' { [com.iscobol.lib.C$SLEEP Thread=5]
12... INFO: SET ENVIRONMENT [users] 'iscobol.myevn=cust2' [PROGA Thread=5]
12... INFO: SET ENVIRONMENT [users] 'iscobol.myevn=cust1' [PROGA Thread=4]
...
The log file now contains the thread ID that executed a statement, making it easier to follow the program flow.
A new configuration, iscobol.terminal.paste_key, allows users to customize the key used for pasting in character-based accept statements. By default, pasting is accomplished through a mouse right-click. With the new configuration, it is now possible to modify the key combination or add additional keys for the same action. For instance, by setting:
iscobol.terminal.paste_key=mrdw,*p
Ctrl+P can be used for pasting in addition to the mouse right click.
New routine
A new routine named C$PARAMNAME has been implemented to retrieve the name of the parameter passed from the caller program. This information can be useful if specific code needs to be executed based on the parameter.
The called program, if needed, could use the output generated by the new external DataMap using the -edm compiler option and apply custom logic based on the name, level, or structure of the parameter received by the calling program.
For example, if a caller program executes this code
       77  MY-VAR          PIC X(20).
       01  MY-GROUP.
           03 MY-VAR-1     PIC X(10).
           03 MY-VAR-2     PIC 9(6)V99.
           03 MY-VAR-3     PIC X(5).
           ...
             CALL "PRCUST" USING MY-VAR, MY-GROUP
In the called program, the following code:
       77  paramName  pic x(30).
       ...
           move 1 to paramNum
           CALL "C$PARAMNAME" USING paramNum, paramName
                             GIVING ret-code
           ...
           add 1 to paramNum
           CALL "C$PARAMNAME" USING paramNum, paramName
                             GIVING ret-code
can be used to retrieve the string “MY-VAR” and “MY-GROUP”, the parameter names specified in the caller program, in the paramName variable. The ret-code variable specified in the giving clause will contain 1 if the paramName can be set correctly, and will contain 0 if the specified parameter is a constant or was omitted.