Page 1 of 1

COBOL Newbie requires help displaying data read from a file

PostPosted: Sun May 10, 2020 12:24 am
by torrind
Hi All,

My first time here! :-)

I'm a student seconded to a Large bank in the UK as part of my course and I'm learning COBOL in my spare time (GNU COBOL). As a project, I'm writing a simple airline booking program and have got quite far. The help I need now is as follows:

If I have a 100 seater aeroplane setup as 4 rows of 25 seats, I want to be able to read the seat numbers in from a file and display where they are booked on a grid as per the following example:

row1: xxxxxxxxx*xxxxx*xxxxxxx*x
row2: xxxxxxxxxxxxxxxxxxxxxxxxx

row3: xxxxxxxxxxxxxxxx**xxxxxxx
row4: xxxxxxxxxx*xxxxxxxxxxxxx*

In this example row 1 shows seats 10, 16 and 24 as booked
row 3 - seats 67 & 68 are booked
row 4 - seats 86 & 100 are booked (x's are empty seats)

Can anyone help with a simple way of doing this? I've been at this for weeks with no real success.

Thanks in advance,

Darren

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Sun May 10, 2020 8:20 am
by dneufarth
Hint = ARRAY

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Sun May 10, 2020 2:44 pm
by Robert Sample
If you have been working on this for weeks, either you need to learn more COBOL or you need to acknowledge that programming is not for you.

Define a variable PIC X OCCURS 100. Initialize all 100 table elements to x. Loop reading the input file and for each input set that element value to asterisk. Loop through table, displaying 25 elements each time.

Or define a 100-byte variable PIC X value all X and use reference modification to change values as input is read. Display 25 bytes at a time.

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Sun May 10, 2020 3:22 pm
by enrico-sorichetti
where are You facing problems, the logic or the coding ?

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Tue May 12, 2020 7:25 pm
by Robert Sample
Can anyone help with a simple way of doing this? I've been at this for weeks with no real success.
We provide assistance on this forum -- we don't write code for you. And if you want help, you need to post what you're having problems with as well as the code you're having trouble with (using the Code button to preserve spacing).

Your problem is trivial -- I coded it in COBOL in 20 minutes (total) doing it with an array as well as with reference modification.

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Tue May 12, 2020 11:38 pm
by torrind
Firstly, I wasn't expecting anyone to write the code for me and I thought that I had posted enough info for help which TBH I've not yet received. Typical for programmers (with no social skills) all I've received are number of piss-taking comments about my coding ability which to be honest are not helpful.

So its a trivial problem which you coded in 20 mins - good for you! Things are always easier when you know what you're doing.

I will probably take me 20 months to solve as I've decided not to rely on this unhelpful forum - I'll eventually do it on my own.

Not that you'll care, but thanks for nothing.

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Tue May 12, 2020 11:47 pm
by Robert Sample
I had posted enough info for help which TBH I've not yet received
How is this not help?
Hint = ARRAY
Define a variable PIC X OCCURS 100. Initialize all 100 table elements to x. Loop reading the input file and for each input set that element value to asterisk. Loop through table, displaying 25 elements each time.

Or define a 100-byte variable PIC X value all X and use reference modification to change values as input is read. Display 25 bytes at a time.
I told you not one, but TWO different ways to code the problem. It is NOT our fault if you didn't bother to tell us what the specifics of the problem(s) you're having -- you didn't respond to the question about if you're having problems with the logic or the coding, for example. We gave you plenty of help AT THE LEVEL YOU ASKED THE QUESTION -- if you wanted different help, you should have asked something different.

Not that you'll care, but thanks for nothing.
Well, on this as every forum, you get back proportionate to what you put in. You gave us nothing, you got nothing, and you complained bitterly about it. It's probably good you've decided not to ask more questions since with that attitude your chances of getting help with any further questions is extremely small.

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Wed May 13, 2020 6:04 am
by dneufarth
Darren - and not a single example of your coding efforts to date. You were provided with avenues of attack, but showed nothing of your work.

I too cringe at some of the comments posted. Then I say to myself "so what." I just don't interact on those individual posts.

Some on this forum do indeed critique and/or proffer opinions. You need to toughen up and deal with those that provide you with workable suggestions as Mr Sample has pointed out.

There are quite a few posters here that have vast experience and skills you can not fathom yet. They, over many trying years, acquired them with help from others or put considerable time of their own scouring references/manuals and trial/error (creating amazing solutions to difficult business needs or tool creation) or both. Getting aid from them is a gift.

Your departure is, of course, your choice. I hope you get a solution.

Re: COBOL Newbie requires help displaying data read from a f

PostPosted: Wed May 13, 2020 6:43 pm
by Terry Heinze
Well stated, dneufarth.