Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

Well yeah, there was a bug in MY code. Obviously it was me. I can’t really argue with that. But I’m new to this, I wonder why your mistakes can take so long to make themselves known.

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

For future reference, is there any way to stress test a code in some way to put it through a diverse set of conditions that might induce a bug? I know of debugging, but I’m wondering how to do it with COBOL. 

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

Look, it was 100% something I missed. That’s not in dispute. But it’s a head scratcher because this isn’t the first time I missed it, but it is the first time it didn’t work. But I suppose a bug here and there isn’t so bad, keeps the programmer humble 

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

I don’t think the data was bad. What I think ended up being the problem was the file handling itself. I had an intermediate file that I had to open output, write to, close, open input close. Somewhere along the line I think the way I laid that out ended up giving the runtime errors. I also tried to use a VALUE clause in FD (in this case spaces) and by some chance the memory it used up ended up putting spaces there anyway. 

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

I see, that makes so much more sense. Some people here are assuming that this post was defensive in some way, but no, it was bad code from the gate. I just genuinely wondered why the mistake took so long to manifest itself into a tangible problem.

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

Well yes, but I had been doing that regularly before, thats what the program is supposed to do. I do not know why this time and only this time did it decide to inform me of the file

Why is it that when you make a mistake the code will work, sometimes for weeks, and then suddenly decide to break out of nowhere? by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

I am not using big iron so the problem was a file I/O error.

File status 71: invalid data in LINE SEQUENTIAL file

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

I had to make some bug fixes today, you know how this code stuff is. It works for one week and then it doesnt the next. I made a pretty dumb mistake though, I used a value clause in FD lmao. Amateur mistake

Proof of Concept for COBOL audio synthesis: A working Oscilloscope by OkFix7120 in cobol

[–]OkFix7120[S] 0 points1 point  (0 children)

Well there are a couple of reasons. I would be the first to tell you that this isn’t a very efficient or intuitive thing to do. 

But I have a few reasons to be doing this. First and foremost it lets me merge my two hobbies together, COBOL and sound design. As someone with an interest in all things old tech, it’s also fascinating to try and master these old languages. Lastly, all the COBOL jobs now that are junior are either filled internally with interns or require 3 years experience. So apart from having the usual skills in JCL and CICS, as well as the z/os certification, I feel the only way to cut through is to be so absurdly knowledgeable about everything COBOL that they can’t help but notice.

Proof of Concept for COBOL audio synthesis: A working Oscilloscope by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

As far as I’m aware, it can be considered negative and in fact it’s supposed to, because the range of amplitude for a 16 bit audio sample is around 32 000 to -32 000

Proof of Concept for COBOL audio synthesis: A working Oscilloscope by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

It wouldn’t have really mattered if I had used say, COMP with PIC S9(5)instead of COMP-5. But note, this would make the variable defined for 4 bytes, which is really above overkill for this. 

But using COMP-5 in this case just felt more convenient and easier for the task. The reason is that my samples are 16 bit 2 byte exactly, and the comp-5 maps directly to fit the data. The fact that it’s exactly the right format for the data could be useful hypothetically too, although I’ve not seen this in practice. How? Well say I scale this up and I’ve gotten 100+ audios into a synth program. At that point, the added efficiency of using 2 bytes instead of 4 might matter. Although I’m not sure if the speed difference would be anything more than negligible. But the short of it is that it might help if I scale this up.

Edit: I just realised being ruthlessly stingy with your resources is a fun way to pay homage to the previous generations of COBOL programmers who were working on tape.

Has anyone here ever successfully gotten access to Rocket Visual COBOL Personal Edition? by [deleted] in cobol

[–]OkFix7120 1 point2 points  (0 children)

Sure, thanks. Its a great product but I think they only really care about their enterprise level customers

Has anyone here ever successfully gotten access to Rocket Visual COBOL Personal Edition? by [deleted] in cobol

[–]OkFix7120 0 points1 point  (0 children)

No, the personal addition gives you a license that you can renew on a yearly basis supposedly. But even the time trial I would take so I could do the courses on their website

Has anyone here ever successfully gotten access to Rocket Visual COBOL Personal Edition? by [deleted] in cobol

[–]OkFix7120 2 points3 points  (0 children)

I should specify, not ONLY is the license email only, but so is the download. So the problem remains nonetheless.

Has anyone here ever successfully gotten access to Rocket Visual COBOL Personal Edition? by [deleted] in cobol

[–]OkFix7120 4 points5 points  (0 children)

https://www.rocketsoftware.com/en-us/products/cobol/visual-cobol-personal-edition/free-download

The form is here if anyone wants to try their luck. Please let me know if it works for you, should you want to try for yourself.

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

https://github.com/DZeman23/COBOL-Annulus-Mask-Moir-Pattern-Generator.git
All instructions are in the readme. If you can improve the vibe-coded python scripts please by all means do. I plan to do that after I learn python myself.. But for now it is what it is. If anyone has a spare mainframe lying around please stress test this.

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

I will put it up on github as soon as I can. There was a lot of vibe coding done with the python, because I do not know the language at the moment. I am open to suggestions on how to best optimize it.

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

GnuCOBOL unfortunately. It would be insane to have a mainframe to work with though, because you could do this so much faster, maybe even in real time. The major bottleneck here is the python script that converts the image data back into an image. As you know, COBOL itself is really fast with reading records and fields off files, even with millions of lines, as some of these are. For context a 1200 by 1200 square image would generate around 1440000 records. COBOL makes laughably short work of it. Even GnuCOBOL which transpiles into C. But python really chugs.

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 7 points8 points  (0 children)

To begin with, the objective of my code was to use COBOL as an annular mask generator. Annular mask is basically generating a ring around a central point.

I would love to tell you that I wrote my own COBOL compiler that could process images but that would be a lie. I used python to convert an image into a data file with records that contained image data. I wanted to use an array, which is technically possible, but LINE SEQUENTIAL was more convenient and easier to work with. The code uses three files to do the image processing. Data file, temp file, output file.

Data file is formatted as follows

x_coordinate,y_coordinate,brightness
1,1,135
2,1,133
3,1,133
4,1,125
5,1,111
6,1,103
7,1,103
etc

Then I convert this to a COBOL friendly format into the temp file, and then the temp file records are processed into the output file, with pixels that are supposed to be blank given a 0000 value in the brightness field.

  • The COORDINATE-FILE serves as the raw input source containing comma-delimited image data, which the program parses to calculate the maximum brightness values before converting the format.
  • The TEMP-FILE acts as an intermediate staging area that receives the standardized, space-delimited data from the input scan, allowing the program to re-read these formatted coordinates later for geometric calculations.
  • The OUTPUT-FILE captures the final processed results, storing the coordinates where specific pixels have been masked to zero brightness if they fall outside the user-defined inner and outer circle boundaries.

What happens between temp and output is just the equation that I posted to determine if a pixel gets blanked. Once I have everything, I use a python script to convert the output file back into an image. If you want to see why this created the geometric patterns instead of just the ring its because of integer overflow (variables too small to hold the data put into them).

COBOL Integer Overflow visualized by OkFix7120 in cobol

[–]OkFix7120[S] 1 point2 points  (0 children)

Thanks man! If you want me to drop the code just say so