REBOL for COBOL programmers

Go to table of contents Go to feedback page

IDENTIFICATION DIVISION

Date written: October 3, 2012
Date revised:
Date reviewed:

This explains the REBOL equivalent of the IDENTIFICATION DIVISION (if there is one).


COBOL IDENTIFICATION DIVISION

The COBOL IDENTIFICATION DIVISION is where the programmer indicates the name of the program, the owner, the date written, various remarks. It is required at the front of the program. If you are not a COBOL programmer, it looks something like this.

IDENTIFICATION DIVISION.
PROGRAM-ID.                TESTPROGRAM.
AUTHOR.                    JOHN SMITH.
INSTALLATION.              ABCD CORPORATION.
DATE-WRITTEN.              OCTOBER 2012.
DATE-COMPILED.             
SECURITY.                  TOP SECRET.      
REMARKS.
This area can contain any comments.  One does not, as I recall
need the comment indicator (*) in column seven in this remarks
area.  Comments outside the remarks area DO need a comment
indicator in column seven.

REBOL header

REBOL does not have an indentification division per se, but it does have a required area where optional identifying information can be written. In other words, every REBOL script must start with a minumum header that looks like this:

REBOL []

Notice the brackets after the key word REBOL. This is a block, and within that block you can code identifying information, which would be words followed by their values. You can put anything you want there, but the REBOL web site has recommendations, as shown in this sample harvested from the REBOL script library:

REBOL [
   Title:   "Full REBOL Header"
   Date:    29-Apr-1999
   Name:    'Full-Header
   Version: 0.1.2
   File:    %headfull.r
   Home:    http://www.rebol.com/
   Author:  "Carl Sassenrath"
   Email:   carl@sassenrath.com
   Owner:   "REBOL Headquarters"
   Rights:  "Copyright (C) Carl Sassenrath 1997"
   Tabs:    4
   Need:    0.1.4
   Language: 'English
   Charset: 'ANSI
   Purpose: {
      Shows the optional definitions that can be
      used within a REBOL header.
   }

   Comment: {
      The purpose or general reason for the script
      should go above and important comments or notes
      about the script can go here.
   }

   History: [
      0.1.0 [5-Nov-1997 "Created this example" "Carl"]
      0.1.1 [8-Nov-1997 { Moved the header up, changed
         comment on extending the header, added advanced
         user comment.} "Carl"]
   ]

   Example: {Show how to use it.}
   Category: [script 1]
]
You may put other comments BEFORE the REBOL header, but it is not commonly done in the code samples on the REBOL web site. You will find that the vim editor has color coding for REBOL, and if you put too many comments in front of the REBOL header, it messes up the vim color coding.

A suggestion

Some people, when they write a program, like to start by writing some of the relatively meaningless stuff just to get some momentum going. I suggest you make your own header and keep it in a distinct file, and then when you are about to write a program, bring up that file in your editor, save it under a new name, and then fill in the blanks. You could try something like this:

REBOL [
   Title:   
   Date:    
   Name:    
   Version: 
   File:    
   Author:  
   Email:   
   Owner:   
   Purpose: {

   }
   Comment: {

   }
]

Code samples

Left-clicking a link below will give a result that will depend on your computer, your browser, and maybe in whether or not you have REBOL installed. You should get either a new window with the code displayed, or a dialog box for saving the file on your own computer, or "opening" the file which makes no sense in this situation. Right-clicking should give you a menu from which you can save it to your own computer.

Sample full header

This is sample full header from the rebol.org site, as shown above.

Your own IDENTIFICATION DIVISION header

This is the idea script shown above, which it a skeleton header with the fields most similar to the COBOL IDENTIFICATION DIVISION items.