Skip to content

cannot compile with using complex-odo #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tsh-hashimoto opened this issue Feb 5, 2025 · 1 comment
Open

cannot compile with using complex-odo #585

tsh-hashimoto opened this issue Feb 5, 2025 · 1 comment

Comments

@tsh-hashimoto
Copy link
Contributor

If there are variable-length data items (e.g. OCCURS ~ DEPENDING ON) in WORKING-STORAGE SECTION (not at the end, but in the middle), we can compile source file with complex-odo: yes in configuration file.

But, for example, the following cannot compile.

        WORKING-STORAGE SECTION.
        01  A.
            02  B               PIC 9(8) BINARY.
            02  FILLER01        OCCURS 227 DEPENDING ON B
                                PIC X(1).
            02  C               PIC S9(004) COMP.

The generated Java source code appears to contain C source code as is (b_C__A + 4 + 227.fillBytes(0, 2);).

/* Initialize program */
if (!this.initialized) {
  module.setProgramId("TEST01");

  b_RETURN_CODE.set((int)0);
  b_B__A.fillBytes(0, 4);
  b_FILLER01__A.getSubDataStorage(0).fillBytes(' ', 227);
  b_C__A + 4 + 227.fillBytes(0, 2);
  this.initialized = true;
}

This should be b_C__A.getSubDataStorage(4 + 227).fillBytes(0, 2);.

@tsh-hashimoto
Copy link
Contributor Author

tsh-hashimoto commented Feb 5, 2025

In version 1.0.7, this way of writing was not a problem, but in latest version, it seems to cause a runtime error.
By writing b_PPLEN__MY_REC.fillBytes(0, 2);, the runtime error was resolved.
I don't know if this is the ideal way.

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

No branches or pull requests

1 participant