Same module is compiled in both environments except for the below differences (no difference in code logic)
| Environment where the module is working correctly |
Environment where we are getting 153 Subscript out of range error for the same module |
| Micro Focus COBOL V6.0 (with Patch Update 18 and Patch Update 20) |
Micro Focus COBOL V7.0 |
| PANVALETIGNORECOMMENT setting is set |
PANVALETIGNORECOMMENT setting is set |
| NOEXECSQLFLAG EXITPROGRAM"ANSI" NORM-FILE-ERRORS settings are set |
These settings are not set in this environment |
Attached all the settings of the module in normal Linux region (V6.txt) and also from Docker environment (V7.txt). Could you please provide inputs to resolve this issue
community.microfocus.com/.../V7.txtcommunity.microfocus.com/.../V6.txt
#COBOL#VisualCOBOL#Linux#subscriptoutofrangeTypo in above information in the above table, please refer the below table for the differences in version and settings
| Environment where the module is working correctly |
Environment where we are getting 153 Subscript out of range error for the same module |
| Micro Focus COBOL V6.0 (with Patch Update 18 and Patch Update 20) |
Micro Focus COBOL V7.0 |
| PANVALETIGNORECOMMENT setting is set |
PANVALET-INCLUDES-IN-COMMENTS setting is set |
| These settings are not set in this environment |
NOEXECSQLFLAG EXITPROGRAM"ANSI" NORM-FILE-ERRORS settings are set |
Typo in above information in the above table, please refer the below table for the differences in version and settings
| Environment where the module is working correctly |
Environment where we are getting 153 Subscript out of range error for the same module |
| Micro Focus COBOL V6.0 (with Patch Update 18 and Patch Update 20) |
Micro Focus COBOL V7.0 |
| PANVALETIGNORECOMMENT setting is set |
PANVALET-INCLUDES-IN-COMMENTS setting is set |
| These settings are not set in this environment |
NOEXECSQLFLAG EXITPROGRAM"ANSI" NORM-FILE-ERRORS settings are set |
Hi,
This is a subscript out of bounds error.
At what point do you get the error?
On what statement is the error occuring?
Are you testing with the same data?
Have you tried running the 7.0 version of your application outside of Docker to see if the change in versions may be causing the error?
What Micro Focus product do you have installed in both environments? Is this DevHub or COBOL Server?
Are you using the Micro Focus DevHub or COBOL Server for Docker images or did you simply install the standard product onto your own image?
Hi,
This is a subscript out of bounds error.
At what point do you get the error?
On what statement is the error occuring?
Are you testing with the same data?
Have you tried running the 7.0 version of your application outside of Docker to see if the change in versions may be causing the error?
What Micro Focus product do you have installed in both environments? Is this DevHub or COBOL Server?
Are you using the Micro Focus DevHub or COBOL Server for Docker images or did you simply install the standard product onto your own image?
Hi
Thanks for your reply. Please find the requested information below
1) & 2) Below is code snippet for your reference. We are getting the subscript out of range error on the highlighted line when the value of JJ is 21 (printed display statement to get the value of JJ at the point of error)
05 JJ PIC S9(04) BINARY.
.....
......
10 MIR-STMP-DUTY-AMT-G.
15 MIR-STMP-DUTY-AMT-T OCCURS 20 TIMES
PIC X(017).
..
...
.....
......
PERFORM
VARYING JJ FROM 1 BY 1
UNTIL JJ > RPOL-POL-CVG-REC-CTR-N (Note: Value of RPOL-POL-CVG-REC-CTR-N is 99)
PERFORM 9220-MOVE-STMP-DUTY-TO-MIR
THRU 9220-MOVE-STMP-DUTY-TO-MIR-X
END-PERFORM.
:
Para - 9220-MOVE-STMP-DUTY-TO-MIR
MOVE WCVGS-STMP-DUTY-AMT (JJ) TO L0290-INPUT-V02.
MOVE 2 TO L0290-PRECISION.
MOVE LENGTH OF MIR-STMP-DUTY-AMT-T (JJ)
TO L0290-MAX-OUT-LEN.
PERFORM 0290-2000-FORMAT-FOR-MIR
THRU 0290-2000-FORMAT-FOR-MIR-X.
MOVE L0290-OUTPUT-DATA TO MIR-STMP-DUTY-AMT-T (JJ).
3) We tested with the same data and same program (no changes in data or program in both the environments)
4) Version 7 installed environment is not available outside the docker so we cannot run this test scenario in a normal environment
5) Micro Focus Visual COBOL Development Hub 6.0 (with patch 18 and 20) in normal environment where it is working fine without any error and Micro Focus Visual COBOL Development Hub 7.0 (docker micro focus version)
6) We are using the Micro Focus DevHub in docker. We used the docker file provided along with the Devops binaries to build the image
NOBOUND and SSRANGE directive are set in both the environments, but the error is being encountered in Docker environment only, I have attached all the settings for both the environment in my previous post. could you please help us to know if we need to change any directive setting for Version 7?
Hi
Thanks for your reply. Please find the requested information below
1) & 2) Below is code snippet for your reference. We are getting the subscript out of range error on the highlighted line when the value of JJ is 21 (printed display statement to get the value of JJ at the point of error)
05 JJ PIC S9(04) BINARY.
.....
......
10 MIR-STMP-DUTY-AMT-G.
15 MIR-STMP-DUTY-AMT-T OCCURS 20 TIMES
PIC X(017).
..
...
.....
......
PERFORM
VARYING JJ FROM 1 BY 1
UNTIL JJ > RPOL-POL-CVG-REC-CTR-N (Note: Value of RPOL-POL-CVG-REC-CTR-N is 99)
PERFORM 9220-MOVE-STMP-DUTY-TO-MIR
THRU 9220-MOVE-STMP-DUTY-TO-MIR-X
END-PERFORM.
:
Para - 9220-MOVE-STMP-DUTY-TO-MIR
MOVE WCVGS-STMP-DUTY-AMT (JJ) TO L0290-INPUT-V02.
MOVE 2 TO L0290-PRECISION.
MOVE LENGTH OF MIR-STMP-DUTY-AMT-T (JJ)
TO L0290-MAX-OUT-LEN.
PERFORM 0290-2000-FORMAT-FOR-MIR
THRU 0290-2000-FORMAT-FOR-MIR-X.
MOVE L0290-OUTPUT-DATA TO MIR-STMP-DUTY-AMT-T (JJ).
3) We tested with the same data and same program (no changes in data or program in both the environments)
4) Version 7 installed environment is not available outside the docker so we cannot run this test scenario in a normal environment
5) Micro Focus Visual COBOL Development Hub 6.0 (with patch 18 and 20) in normal environment where it is working fine without any error and Micro Focus Visual COBOL Development Hub 7.0 (docker micro focus version)
6) We are using the Micro Focus DevHub in docker. We used the docker file provided along with the Devops binaries to build the image
NOBOUND and SSRANGE directive are set in both the environments, but the error is being encountered in Docker environment only, I have attached all the settings for both the environment in my previous post. could you please help us to know if we need to change any directive setting for Version 7?
Hello,
I am not sure I understand. If the table has an occurs of 20 and you are trying to reference it with a subscript of 21, the subscript error should occur. If it doesn't then that is a problem.
Are you saying that when the subscript is 21 for this statement in 6.0 outside of docker the error does not occur? That sounds like the problem here to me, not the behavior of 7.0.
Turning on the SSRANGE directive also turns on the BOUND directive so checking should be done.
Am I missing something here?
Hello,
I am not sure I understand. If the table has an occurs of 20 and you are trying to reference it with a subscript of 21, the subscript error should occur. If it doesn't then that is a problem.
Are you saying that when the subscript is 21 for this statement in 6.0 outside of docker the error does not occur? That sounds like the problem here to me, not the behavior of 7.0.
Turning on the SSRANGE directive also turns on the BOUND directive so checking should be done.
Am I missing something here?
Thanks for the reply
Yes u are right, the table has an occurs of 20 since NOBOUND directive is set we are expecting the subscript error should not be thrown. This behavior is as same as above in version 6 (patch update 18 and 20) i.e. no error is thrown even though the subscript range is going beyond the table occurs value but in version 7 we are getting the Subscript out of range with the same code and directive settings
As per your comments, understanding is that when SSRANGE is set it also turns on BOUND directive. Point to be noted is - In both environments (Version 6 & 7) NOBOUND and SSRANGE are set but the error is being thrown only in version 7 so are there any changes done related to these directives in version 7?
does removing the directive SSRANGE and keeping only NOBOUND directive in version 7 will have the same behavior as seen in version 6 (i.e. not throwing the out of subscript range error) ?
Thanks for the reply
Yes u are right, the table has an occurs of 20 since NOBOUND directive is set we are expecting the subscript error should not be thrown. This behavior is as same as above in version 6 (patch update 18 and 20) i.e. no error is thrown even though the subscript range is going beyond the table occurs value but in version 7 we are getting the Subscript out of range with the same code and directive settings
As per your comments, understanding is that when SSRANGE is set it also turns on BOUND directive. Point to be noted is - In both environments (Version 6 & 7) NOBOUND and SSRANGE are set but the error is being thrown only in version 7 so are there any changes done related to these directives in version 7?
does removing the directive SSRANGE and keeping only NOBOUND directive in version 7 will have the same behavior as seen in version 6 (i.e. not throwing the out of subscript range error) ?
There looks like there was a problem in 6.0 where if both NOBOUND and SSRANGE were specified then the NOBOUND would be in effect even if SSRANGE was specified after NOBOUND.
This was changed in 7.0 so that if SSRANGE was specified after NOBOUND then BOUND would be in effect.
Try changing the order that these directives are being set or remove SSRANGE.
There looks like there was a problem in 6.0 where if both NOBOUND and SSRANGE were specified then the NOBOUND would be in effect even if SSRANGE was specified after NOBOUND.
This was changed in 7.0 so that if SSRANGE was specified after NOBOUND then BOUND would be in effect.
Try changing the order that these directives are being set or remove SSRANGE.
Thanks for the reply
We removed the SSRANGE directive in version7 and executed the same test scenario again, it processed now without throwing the subscript error
My understanding is that removing the SSRANGE in version 7 and keeping only NOBOUND directive will have the same behavior as in Version 6 with both NOBOUND and SSRANGE directives set. I hope we won't encounter any other impact due to removal of SSRANGE directive in version 7
Thanks for your support