000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400 DISPLAY “ “ LINE 1 POSITION 1 ERASE EOS.
100500 DISPLAY “Hello world!” LINE 15 POSITION 10.
100600 STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800 EXIT.
10 goto 10
Programming is fun.
A guy in our fortran class made this interesting comment (Which I agree with):
The difference between Fortran , Cobol, and Assembler is...
In Assembler you tell the machine what to do.
In Fortran you ask it.
And in Cobol, you get on your knees and beg.
and it is as easy as that
and Hello back at ya
About 27 years ago I bumped into McFarland while on vacation in Australia. (The M of RM-COBOL).
Nice guy.
COBOL?
My god, what’s next? BAL?
Now that I think about it, COBOl should be taught. With global warming, all those Y2K programmers frozen in time will be long thawed out and dead by Y3K.
**************************************************************
** HELLO - Program to print "Hello, World" on device 009 **
**************************************************************
HELLO | CSECT | ||
STM | R14,R12,12(R13) | Save Registers | |
LR | R12,R15 | Load Base Register | |
USING | HELLO,R12 | Establish Addressability | |
SSM | =X'00' | Disable Interrupts | |
SPKA | 0(0) | Disable storage protection | |
LA | R2,CCWS | Store pointer to CCW chain | |
ST | R2,CAW | ... in Channel Address Word | |
LA | R2,9 | Put device address in R2 | |
CLEARIO | TIO | 0(R2) | Test for device busy |
BC | CC1+CC2,CLEARIO | Wait until device not busy | |
BC | CC3,IOERROR | Abort if device error | |
STARTIO | SIO | 0(R2) | Start I/O to the console |
BC | CC1,CSWSTORE | A CSW Has been stored | |
BC | CC2,CLEARIO | Device busy. Wait until clear | |
BC | CC3,IOERROR | Abort if device error | |
TESTIO | TIO | 0(R2) | Wait for I/O completion |
BC | CC2,TESTIO | Busy, Wait for completion | |
BC | CC3,IOERROR | Abort if device error | |
CSWSTORE | CLI | CSW+4,CE | Channel End w/o Device End? |
BE | TESTIO | Yes - wait for Device End too | |
TM | CSW+4,BY | Channel Busy? | |
BO | TESTIO | Yes - Keep Waiting | |
TM | CSW+4,DE | Device End? | |
BNO | IOERROR | No - The CSW is bad | |
SUCCESS | SSM | =X'FF' | Reenable Interrupts |
LM | R14,R12,12(R13) | Restore Caller's Registers | |
XR | R15,R15 | Clear Return Code | |
BR | R14 | Return to Caller | |
IOERROR | SSM | =X'FF' | Reenable Interrupts |
LM | R14,R12,12(R13) | Restore Caller's Registers | |
LA | R15,4 | Set Return Code 4 | |
BR | R14 | Return to Caller | |
DS | 0D | CCW must be doubleword aligned | |
CCWS | CCW | X'09',MESSAGE,X'20' | ,L'MESSAGE |
MESSAGE | DC | C'Hello, World' | |
CSW | EQU | X'40' Addre | ss of Channel Status Word |
BY | EQU | X'10' Chann | el Busy |
CE | EQU | X'08' Chann | el End |
DE | EQU | X'04' Devic | e End |
CAW | EQU | X'48' Addre | ss of Channel Address Word |
R2 | EQU | 2 Regis | ter 2 |
R12 | EQU | 12 Regis | ter 12 |
R13 | EQU | 13 Regis | ter 13 |
R14 | EQU | 14 Regis | ter 14 |
R15 | EQU | 15 Regis | ter 15 |
CC0 | EQU | 8 Condi | tion Code 0 |
CC1 | EQU | 4 Condi | tion Code 1 |
CC2 | EQU | 2 Condi | tion Code 2 |
CC3 | EQU | 1 Condi | tion Code 3 |
END |
oh sweet lord baby Jesus...have not seen Cobol for years! LOL
never ever did get the whole envorinment division bit...always seemed to be more free text...
thanks for the trip down memory lane!!!