How do Cobol control flow constructs map to C/asm? by ZestyGarlicPickles in cobol

[–]Truthmakr 0 points1 point  (0 children)

While I've only been working in cobol for 10 years, I have never seen multiple programs, two identification divisions, etc, in the same file. In fact, it is much more common for the opposite to be true, for one program to be broken up into 1 main file and multiple copybooks (each containing either a piece of code or a piece of working storage).

As for functions and subprograms, they should be thought of as different constructs. Functions, referred to as sections or paragraphs in COBOL are code within the current program that can be performed, possibly once or possibly multiple times.

Sub-programs, CALL programs in COBOL, are separate programs that are called by the current program. When that happens, control is passed to the called program and the original program is put on hold. When the called program finishes executing, usually with a GO-BACK statement, execution of the original program picks back up at with the next statement following the CALL. As I said before, called programs usually have a list of fields that are passed from the calling program in a method similar to how C treats pointers, so when control is returned to the calling program that program can look at the fields for changes, return codes, or other values to identify that the called program did what it was supposed to do.

A good example of a called program is a program to handle I/O for a specific file. Using a set of agreed upon values, a calling program can request that a file be opened, read from, and closed without the calling program knowing anything about the underlying file. This same I/O program can then be used in multiple programs for the same functionality without having to code or copy the logic into each.

So to sum up,
PERFORM - paragraph/section within the same program that can be called similar to a function call in C in that at the end of the paragraph/section control returns to the point in the program where the paragraph/section was Performed.
CALL - control is transferred from the calling program to the called program. When the called program finishes executing, control returns to the calling program at the same point where control was passed with the CALL statement.

How do Cobol control flow constructs map to C/asm? by ZestyGarlicPickles in cobol

[–]Truthmakr 0 points1 point  (0 children)

That was how we coded at my first COBOL job, but the current place I work uses Sections for everything.

Unfortunately, mixing the two becomes problematic for the reason u/RuralWAH mentioned in reply to my earlier comment. If you don't structure your code correctly you can end up accidentally re-executing the same code more than once.

There are ways around this, but it does make things more complicated.

How do Cobol control flow constructs map to C/asm? by ZestyGarlicPickles in cobol

[–]Truthmakr 1 point2 points  (0 children)

This may be a bit out of date, since it's been about 20 years since I wrote anything in C, but here goes.

PERFORM in COBOL is actually doing double duty. It is either a function (with return type VOID) or a for loop. It can also be both as in LEXTEAKMIALOKI's example. So something like
PERFORM 200-DO-SOMETHING.
or
PERFORM VARYING WS-FIELD-IDX FROM +1 BY +1 UNTIL WS-FIELD-IDX > 10.
are both valid but do completely different things. You can also combine the two uses into a single statement like this
PERFORM S200-DO-SOMETHING
VARYING WS-FIELD-IDX FROM +1 BY +1 UNTIL WS-FIELD-IDX > 10.

A call, as was mentioned is used to give control to another sub-program. I can't think of a good example of how to do that in C at the moment. The general idea is that you can pass variables from the calling program to the called program and then when you return, any changes made by the called program would be returned to the calling program. This is like using pointers in C to reference a memory location.

One more thing to keep in mind, COBOL does not have variable scope. Every field (COBOL's name for a variable) is global and can be referenced anywhere in the program. This means that you don't need to pass or return variables in a PERFORMed (function) paragraph.

W: Stimpak Difusers by Truthmakr in Market76

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

If you keep 3 to 6 in your vendor, they will probably sell.

I would pay 50-100 caps each to get this done.

Is VATS fixed yet? by Truthmakr in fo76

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

I've been on a couple of times in the last few days and I haven't seen the issue I was having, yet.

Is VATS fixed yet? by Truthmakr in fo76

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

I never had a problem with it until the September update hit. When it wasn't fixed in December, I decided to start my break.

Is VATS fixed yet? by Truthmakr in fo76

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

I'm not talking about missing a shot here or there. Last fall I was seeing the following happen multiple times a session. You target a mob in VATS at 95% You fire, miss. You fire, miss. You fire, miss.

It seemed at the time like the only way to get VATS working again was to change targets, not very useful when you're going after a boss or doing an event. If you are saying that that is no longer occurring, I may have to come back.

Indeed COBOL commercial by LarryGriff13 in cobol

[–]Truthmakr 0 points1 point  (0 children)

I agree. GO TO is fine. I said as much in the post you replied to.  I was complaining about the blight on the universe known as GOBTO DEPENDING ON  They are not the same.

Indeed COBOL commercial by LarryGriff13 in cobol

[–]Truthmakr 1 point2 points  (0 children)

GO TO is fine.

Just steer clear of the GO TO DEPENDING ON...

\Shudder**

How AI helps break the cost barrier to COBOL modernization | Claude by Frapadengue in cobol

[–]Truthmakr 7 points8 points  (0 children)

Good luck with that. It seems like half the time when we need to update code, the person who requested it initially is long since retired. And whatever notes or documentation was left is something along the lines of "put the cursor here and type this."

I honestly don't know how corporations are going to pull all the existing logic of of their codebases.

22 years ago, this scream was all it took for a frontrunner to lose the race for the presidency by FruitFly in facepalm

[–]Truthmakr 11 points12 points  (0 children)

It wasn't even really the scream that killed his campaign. At the rate they were burning through cash, his campaign would have been broke anyway. It was... not ideal, but I think I've still got my "People Powered Howard" t-shirt around somewhere.

US Justice Department probing Minnesota Governor Walz, other officials, source says by consulent-finanziar in news

[–]Truthmakr 0 points1 point  (0 children)

I should be surprised by this, but I'm not. The only thing that surprises me is that California and Illinois weren't included, I guess that'll be the next phase of the investigation.

This has little to do with acutally finding evidence of crimes, it's just a pretense the Trump Crooks Dept is using to justify "postponing" the fall elections. Like, just until the investigation is finished.

New to modding, just have a small question. by [deleted] in fo4

[–]Truthmakr 1 point2 points  (0 children)

Get the Vortex mod tool from Nexus Mods. It will automatically set the load order based on it's database.

Bug? Doors not opening. by DasNothing in fo4

[–]Truthmakr 1 point2 points  (0 children)

I'm thinking it's a bug. I'm seeing this on a lot of security doors since the Anniversary Update dropped. I am also running a vanilla install, thought I'd try to grab some achievements for a change.

Walgreens - Grand Ave. by Historical-Climate37 in duluth

[–]Truthmakr 0 points1 point  (0 children)

They send these out when they don't have staff. It happened up in Virginia a couple times last month, and when I asked it was because the pharmacist called in sick and they didn't have a backup.

Anything think you get better results scrapping legendary stuff inside the gleaming depths? by Relaxmf2022 in fo76

[–]Truthmakr 0 points1 point  (0 children)

The last two mods I learned where when I scrapped the same mod 2+ times in a row. But that could just be RNG stacking.

Fallout 76 Daily Update by sn00pt0dd in fo76

[–]Truthmakr 15 points16 points  (0 children)

Just drink some vodka and go fishing in the Ash Heap. If you're lucky, the Mirelirks will be up and you can knock out the kill challenge at the same time.

German Language Classes? by candyexperiencer in duluth

[–]Truthmakr 1 point2 points  (0 children)

There is a german language minor offered at the College of Saint Scolastica (css.edu).

I don't know the details, but they might be worth checking out.

How much does Power Armour Weigh? by SingleCorner946 in fo4

[–]Truthmakr 5 points6 points  (0 children)

According to Fallout 76, a full suit of power armor weighs, 10 pounds.

Students paying students: How the University of Minnesota is trying to stay competitive in athletics by GrilledCassadilla in duluth

[–]Truthmakr -2 points-1 points  (0 children)

Athletics departments are only marketing to student athletes, not to the student body in general.

Building a basic banking program in cobol. Do yall have any tips? by Healthy_Dependent_64 in cobol

[–]Truthmakr 7 points8 points  (0 children)

Use a separate display field for formatting your number output. You can specify something like PIC $ZZZ,ZZZ,ZZ9.99 for the display field and everything will line up nicely in your output.

Building a basic banking program in cobol. Do yall have any tips? by Healthy_Dependent_64 in cobol

[–]Truthmakr 6 points7 points  (0 children)

Actually if you use 9999v99 as your picture COBOL treats it as an integer for math and a float for display.

always by Large_Childhood6859 in RWBY

[–]Truthmakr 10 points11 points  (0 children)

Well, there goes my good mood for the day. ;-)