Skip to content
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

Issue: NoSuchElementException #59

Open
acurat opened this issue Nov 6, 2024 · 6 comments
Open

Issue: NoSuchElementException #59

acurat opened this issue Nov 6, 2024 · 6 comments
Assignees

Comments

@acurat
Copy link

acurat commented Nov 6, 2024

Ran into this error trying to summarize a program. Please let me know if you need any other info.

[2024-11-06 14:17:23] [FINER] Setting value for 01WS-END-LITERALPICX(29)VALUE'END WORKING STORAGE - OLWS810'. 
[2024-11-06 14:17:23] [FINER] Setting value for 01DFHCOMMAREAPICX(99999). 
java.util.NoSuchElementException
	at java.base/java.util.List.getFirst(List.java:825)
	at org.smojol.common.vm.structure.Format1DataStructure.typeSpecForSingle(Format1DataStructure.java:207)
	at org.smojol.common.vm.structure.Format1DataStructure.calculateMemoryRequirements(Format1DataStructure.java:200)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.smojol.common.vm.structure.Format1DataStructure.typeSpecForSingle(Format1DataStructure.java:209)
	at org.smojol.common.vm.structure.Format1DataStructure.calculateMemoryRequirements(Format1DataStructure.java:200)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.smojol.common.vm.structure.Format1DataStructure.typeSpecForSingle(Format1DataStructure.java:209)
	at org.smojol.common.vm.structure.Format1DataStructure.calculateMemoryRequirements(Format1DataStructure.java:200)
	at org.smojol.common.structure.CobolDataStructureBuilder.build(CobolDataStructureBuilder.java:41)
	at org.smojol.toolkit.analysis.validation.DataStructureValidation$1.run(DataStructureValidation.java:31)
	at org.smojol.toolkit.analysis.pipeline.ParsePipeline.parse(ParsePipeline.java:155)
	at org.smojol.toolkit.analysis.pipeline.ParsePipeline.parse(ParsePipeline.java:81)
	at org.smojol.toolkit.analysis.task.analysis.BuildSeedModelTask.run(BuildSeedModelTask.java:30)
	at org.smojol.toolkit.task.SmojolTasks$15.run(SmojolTasks.java:169)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
	at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
	at org.smojol.toolkit.task.SmojolTasks.run(SmojolTasks.java:64)
	at org.smojol.toolkit.analysis.task.analysis.CodeTaskRunner.runForProgram(CodeTaskRunner.java:154)
	at org.smojol.toolkit.analysis.task.analysis.CodeTaskRunner.runForPrograms(CodeTaskRunner.java:95)
	at org.smojol.cli.MultiCommand.processPrograms(MultiCommand.java:105)
	at org.smojol.cli.MultiCommand.call(MultiCommand.java:92)
	at org.smojol.cli.MultiCommand.call(MultiCommand.java:30)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.smojol.cli.MultiCommandCLI.main(MultiCommandCLI.java:10)
[2024-11-06 14:17:23] [FINE] Runtime.exit() called with status: 1 ```
@avishek-sen-gupta
Copy link
Owner

could you paste the space-separated version of the line 01DFHCOMMAREAPICX(99999) here?

@acurat
Copy link
Author

acurat commented Nov 6, 2024

Pasting that part of the code...

       LINKAGE SECTION.
       
       
       
       
       
       
       01  DFHCOMMAREA              PIC X(99999).
       
       
       PROCEDURE DIVISION USING DFHCOMMAREA.
       
       
       
       
       0000-MAINLINE.
       
           STRING WS-THIS-PROGRAM
                   '0000-MAINLINE'
           DELIMITED BY SIZE INTO TDQMSG
           PERFORM 9988-CSMT-LOG

@avishek-sen-gupta
Copy link
Owner

I'm unable to reproduce this issue from this code fragment. Could I ask you to do two things?

  • I've added a debugging log for this specific issue in commit 97b7bd3f8900b608a19687fe42a6381f293db558. Could you run the program with this build, and paste the resulting log just before the exception?
  • If possible, could you reduce the problematic program to its smallest possible size and post it here? This seems to be specifically an issue with processing the record sections, so I think you can omit everything in the PROCEDURE DIVISION, and reduce the size of the data sections to the minimum size where you still see the problem.

@avishek-sen-gupta avishek-sen-gupta self-assigned this Nov 6, 2024
@acurat
Copy link
Author

acurat commented Nov 9, 2024

The logs now print

[2024-11-08 23:55:39] [FINER] Setting value for 01DFHCOMMAREAPICX(99999). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-BCKT-ORD-TIMEPICX(26). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-AREA-IPICS9(9)USAGECOMP. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-AREA-JPICS9(9)USAGECOMP. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-DATE-LOAD-ERLYPICX(10). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-DATE-LOAD-LATEPICX(10). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-MILE-TOTPICS9(5)VUSAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-FEET-CUBE-TOTPICS9(5)VUSAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-WGHT-TOTPICS9(7)VUSAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CNT-ORD-TOTPICS9(3)VUSAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-NBR-AGT-OWNR-VANPICS9(5)VUSAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CODE-SUB-OWNR-VANPICX(1). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-NBR-VANPICX(7). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CODE-SUB-CMPY-VANPICX(1). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CODE-STAT-LOADPICX(1). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-INDT-VIEW-AGTPICX(1). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-IDEN-LOADPICX(8). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-NAME-BEGN-CITYPICX(20). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CODE-BEGN-STPICX(2). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-NAME-END-CITYPICX(20). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-CODE-END-STPICX(2). 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-AMT-REV-TOTPICS9(7)V9(2)USAGECOMP-3. 
[2024-11-08 23:55:39] [INFO] Calculating type spec for single data structure: 10LOADBUCKET-LAT-BEGNUSAGECOMP-1. 
java.util.NoSuchElementException
	at java.base/java.util.List.getFirst(List.java:825)
	at org.smojol.common.vm.structure.Format1DataStructure.typeSpecForSingle(Format1DataStructure.java:208)
	at org.smojol.common.vm.structure.Format1DataStructure.calculateMemoryRequirements(Format1DataStructure.java:200)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.smojol.common.vm.structure.Format1DataStructure.typeSpecForSingle(Format1DataStructure.java:210)
	at org.smojol.common.vm.structure.Format1DataStructure.calculateMemoryRequirements(Format1DataStructure.java:200)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

The program includes this in the working storage section

           EXEC SQL
              INCLUDE LOADBUCK
           END-EXEC.    

And this is the relevant part in LOADBUCK

      *                       AMT_REV_TOT
           10 LOADBUCKET-AMT-REV-TOT
              PIC S9(7)V9(2) USAGE COMP-3.
      *                       LAT_BEGN
           10 LOADBUCKET-LAT-BEGN  USAGE COMP-1.
      *                       LAT_END
           10 LOADBUCKET-LAT-END   USAGE COMP-1.
      *                       LONG_BEGN
           10 LOADBUCKET-LONG-BEGN
              USAGE COMP-1.
      *                       LONG_END
           10 LOADBUCKET-LONG-END  USAGE COMP-1.

Hope that gives you enough info.

@avishek-sen-gupta
Copy link
Owner

Thanks, that helps. The library currently does not recognise COMP-1 records. I have opened issue #64 to track and work on this. I'll keep this issue open till then.

@avishek-sen-gupta
Copy link
Owner

This should be fixed in commit 00a0f8bb495ce0dee67c5260a42a9fb22cbc0963. Could you check?

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

2 participants