REBOL for COBOL programmers
Date written: October 5, 2012
This explains the REBOL equivalent of the PROCEDURE DIVISION (if there is one).
COBOL PROCEDURE DIVISION
In COBOL, all code that is statements that do things is clustered in one place. The exeuction of the program "starts" at the PROCEDURE DIVISION header. You can have straight-line code and paragraphs that you PERFORM. Usually, the code at the beginning is sort of an overview of the whole program because it PERFORMs paragraphs that are defined later in the program.
The REBOL equivalent
In REBOL, all its words are functions, so in effect every statement is a "procedure division" statement. Even if you pseudo-define data by setting an initial value, like
FILE-NAME: %testfile.txtthat is a function that assigns a value to a word. So everything is "procedure" and you can put it in your program wherever you like.
However, there are some things you can do that are not required but are helpful in organizing your thoughts. These are things you have done in COBOL, and can do in REBOL in similar ways. The biggest thing probably would be to locate those procedures that you would peform several times, or that logically could be encapsulated, and put them into functions. You would do this same thing in COBOL. You would group code in paragraphs and PERFORM it. In REBOL, you group code into functions and call the functions by just saying the name. It is assumed that you have looked over the REBOL documentation, or looked some samples, enough that you know what a function is.
When you organize your program, put the functions at the beginning with some comments to mark them visually. Later in the program, identify what is in effect the "first executable instruction" (a concept from assembler language), where your program actually "starts" running, and call those functions as needed. Later examples will show this.