IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol program with sequence number randomly generates spaces


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Wed May 31, 2023 1:58 am
Reply with quote

Hi,

I have a COBOL program which generates 2 byte sequence numbers and writes to a file.
It basically adds only sequence numbers to already existing file.
In roughly 1 in 30 runs, it generates spaces instead of proper sequence in one of the rows. I tried with same input data and parms. Unable to find out the cause for this random behaviour. Any leads would be appreciated
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed May 31, 2023 3:22 am
Reply with quote

With the limited information available, I suspect table overflow. You might want to turn on the subscript range checking for a few runs to determine if it is the problem.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Thu Jun 01, 2023 6:26 pm
Reply with quote

Two things -
1. Add proper displays and rerun to see the pattern of the path it takes to executes the code and find the bug.
2. If you can’t reproduce then have proper displays i the code before it happens again to know the cause.

Point #1 would help you to solve though.
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 34
Location: USA

PostPosted: Fri Jun 02, 2023 8:25 am
Reply with quote

I tried adding multiple displays.
The record just before Rewrite statement has the correct sequence number. However, the file has it missing.

File is opened in I-O mode, recording mode is V
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Jun 02, 2023 5:24 pm
Reply with quote

shreya19 wrote:
I tried adding multiple displays.
The record just before Rewrite statement has the correct sequence number. However, the file has it missing.

File is opened in I-O mode, recording mode is V

If you really want some help or advice, please present the exact examples of your code, and data.

Otherwise it sounds like:
Quote:
I do everything right, but the result is wrong.
Please help me to fix my problem!
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Jun 02, 2023 5:27 pm
Reply with quote

Use Debug Tool, and single-step through your code.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top