LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-27-2023, 08:39 PM   #1
dchmelik
Senior Member
 
Registered: Nov 2008
Location: USA
Distribution: Slackware, FreeBSD, Illumos, NetBSD, DragonflyBSD, Plan9, Inferno, OpenBSD, FreeDOS, HURD
Posts: 1,068

Rep: Reputation: 147Reputation: 147
Question GNU COBOL?


Typed (then erased and) copied in and ran this but (on Slackware-stable) got many errors and (on Slackware-current compiled but ran and got) segmentation fault: http://gnucobol.sourceforge.io/histo...lo-World-.html ... never though I'd try because dislike suits, but like BASIC & FORTRAN (similar) and heard one can get high wages with COBOL.

hello.cob
Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
PROCEDURE DIVISION.
DISPLAY "Hello World!".
STOP RUN.
Code:
d@0.vanaheim:~$ cobc hello.cob 
hello.cob:1: error: invalid indicator 'F' at column 7
hello.cob:2: error: invalid indicator 'M' at column 7
hello.cob:3: error: invalid indicator 'U' at column 7
hello.cob:4: error: invalid indicator 'Y' at column 7
hello.cob:5: error: invalid indicator 'U' at column 7
hello.cob:6: error: PROGRAM-ID header missing
If I can get this working, then I want to try '1+1' so I can know some bare minimum basics... would be good to learn subroutines/etc. but so far I tried just 'hello, world' and '1+1' in many languages and COBOL might not be first choice to go further.

Last edited by dchmelik; 12-28-2023 at 12:36 AM.
 
Old 12-27-2023, 09:16 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,746

Rep: Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925Reputation: 5925
Old school cobol code formatting was specified by column number (as in 80 column punch card). If you notice in the example the actual code does not start at the beginning of the line. To remove that syntax requirement use the -free compiler option.
Quote:
cobc -free -x -o hello hello.cob
./hello
https://www.tutorialspoint.com/cobol...sic_syntax.htm

Last edited by michaelk; 12-27-2023 at 09:33 PM.
 
3 members found this post helpful.
Old 12-28-2023, 12:23 AM   #3
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 619

Rep: Reputation: 299Reputation: 299Reputation: 299
I programmed professionally in the 1980's on Cobol. I would rather cut my wrists with a blunt spoon than do it again.
 
2 members found this post helpful.
Old 12-28-2023, 01:25 AM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
I coded in both FORTRAN (IV) and COBOL, before I learned to grok Pascal. Code starts in character position 8, 7 is for flags, 1-6 is for labels with certain characters in position 1 having special meaning to some compilers. (Yeah, based on punchcards. Used those as well.)

Small machine COBOL is not where the money is. The opening is for Mainframe COBOL, especially on reverse endian EBCDIC systems. IT also helps to understand a bit of MF networking and DASD, and JES2 never hurts.

Be warned: the money is good, the opportunities are rare, and you will never have a manager who understands what it is you really do!
 
5 members found this post helpful.
Old 12-28-2023, 02:20 PM   #5
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by wpeckham View Post
reverse endian EBCDIC systems
I used to code in COBOL and Assembly Language on EBCDIC mainframe computers, and I fully agree with your post. Just one little detail got me confused, though: your use of the term “reverse endian”; I guess you refer to the “big-endian” system, where the most significant byte of a numeric value is stored at the lowest memory address and the least significant byte is at the highest address. While this is “reversed” as compared to how the x86 family does it, it corresponds more naturally to how the digits of a number are written in, say, English: from most significant to least significant, left-to-right.

To me at least, “big-endian” (as the mainframe does it) feels like the natural order, while “litte-endian” (e.g., x86) feels reversed.
 
1 members found this post helpful.
Old 12-28-2023, 05:16 PM   #6
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
Quote:
Originally Posted by luvr View Post
I used to code in COBOL and Assembly Language on EBCDIC mainframe computers, and I fully agree with your post. Just one little detail got me confused, though: your use of the term “reverse endian”; I guess you refer to the “big-endian” system, where the most significant byte of a numeric value is stored at the lowest memory address and the least significant byte is at the highest address. While this is “reversed” as compared to how the x86 family does it, it corresponds more naturally to how the digits of a number are written in, say, English: from most significant to least significant, left-to-right.

To me at least, “big-endian” (as the mainframe does it) feels like the natural order, while “litte-endian” (e.g., x86) feels reversed.
We agree. I did not want to go down the rabbit hole of explaining that whole thing to the PC crowd. You could make a 50 page thread on that alone without it actually serving any purpose. I spend a week of free time trying to prove to someone that there were other text options than ASCII and alphabet that took more bits than 7 once. ONCE! Never again. (Tech managers with only an MBA! )
 
3 members found this post helpful.
Old 12-29-2023, 05:05 AM   #7
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by wpeckham View Post
ONCE! Never again.
I hear you… I once attempted to explain that “char” in C is just an integer type, and that you could do arithmetic on it just like on integers. (If I remember correctly, the discussion was a consequence of some code I had written that converted between numeric values and digits—I don’t even remember if it was about decimal or hexadecimal digits.) Even though I could demonstrate how trivial it was to “convert” between integers and characters, my code just couldn’t be correct, could it?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
differences+between+mainframe+cobol+and+AIX+cobol+data+type ssrividhya AIX 1 08-09-2004 09:13 AM
Cobol Complier JROCK1980 Programming 1 06-11-2004 05:23 AM
Cobol help jpc82 Programming 2 03-19-2004 05:45 AM
suitable version of MF COBOL to work on LINUX inguva Linux - Software 0 01-15-2002 07:27 AM
Cobol compilers manlinux Linux - Software 1 12-04-2001 09:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration