Skip to content

Conversation

@yutaro-sakamoto
Copy link
Contributor

@yutaro-sakamoto yutaro-sakamoto commented Oct 30, 2025

This pull request introduces support for a program status register in the code generation logic. The program status register is enabled when the value of enable-program-status-register in the configuration file is yes. It also includes minor test adjustments to accommodate these changes.

Program status register support and variable visibility:

  • In cobj/codegen.c, the code now checks if the program status register feature (cb_enable_program_status_register) is enabled. If so, it generates code to instantiate the program module, initialize it, and, after execution, exit using the value of the RETURN-CODE field. ([cobj/codegen.cR6248-R6259](https://github.com/opensourcecobol/opensourcecobol4j/pull/735/files#diff-92e09701bd613a805e09be47306909e3e3abb869c44ad69ad4695ba84bb0c421R6248-R6259))
  • The visibility of the generated CobolDataStorage member for RETURN-CODE is set to public instead of private, allowing external access when the program status register is enabled. ([cobj/codegen.cL5548-R5559](https://github.com/opensourcecobol/opensourcecobol4j/pull/735/files#diff-92e09701bd613a805e09be47306909e3e3abb869c44ad69ad4695ba84bb0c421L5548-R5559))

Test adjustments:

  • In tests/jp-compat.src/job-date.at,
    • this modification which fixes the bug of program status uncovered an existing bug in this test case. The changes to this file are intended to prevent test failures caused by the existing bug. Specifically, there is a bug where the status code after calling the SYSTEM function differs from what is expected. With this modification, the status code after SYSTEM execution in this test code becomes the exit status of the COBOL program, which causes the test to fail. Therefore, these changes were made to address this issue. After merging this pull request, I will post a new issue that reports this problem.
    • (日本語での解説)今回の改修によりこのテストケースで既存バグを発見した。このファイルへの修正は既存バグによるテストの失敗を防ぐためのものである。具体的にはSYSTEM関数の呼び出し後のステータスコードが想定と子なるものになる不具合がある。今回の修正によりこのテストコード中のSYSTEM実行後のステータスコードが、COBOLプログラムの終了ステータスとなり、結果としてテストが失敗するため、このような変更を加えた。このPull Requestがマージされたら、この問題はIssueに投稿します。
  • In tests/jp-compat.src/spl-registers.at, the test for PROGRAM-STATUS is now enabled, allowing it to run and validate the new feature. ([tests/jp-compat.src/spl-registers.atL2](https://github.com/opensourcecobol/opensourcecobol4j/pull/735/files#diff-4714d38b00e36f9fafc1a07f9009dba6621c95dd48f6f14f22e18cd3bfea4067L2))

@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review October 30, 2025 14:45
Copilot AI review requested due to automatic review settings October 30, 2025 14:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables PROGRAM-STATUS register support by making RETURN-CODE accessible as a public field when the program status register feature is enabled, allowing the exit code to be read after program execution.

  • Removed skip test directive to enable PROGRAM-STATUS test case
  • Changed RETURN-CODE field visibility from private to public when cb_enable_program_status_register is enabled
  • Added logic to capture module instance and exit with RETURN-CODE value when program status register is enabled
  • Added fallback handling for Java test execution

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/jp-compat.src/spl-registers.at Removed AT_CHECK([${SKIP_TEST}]) to enable PROGRAM-STATUS test
tests/jp-compat.src/job-date.at Added `
cobj/codegen.c Modified member variable declaration to make RETURN-CODE public and added exit code handling in main method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yutaro-sakamoto yutaro-sakamoto merged commit a20956e into opensourcecobol:develop Oct 31, 2025
145 checks passed
@tsh-hashimoto tsh-hashimoto mentioned this pull request Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants