REBOL for COBOL programmers

Go to table of contents Go to feedback page
Table of contents

Generalities
Introduction
Reserved words
What you may/must say
Right-to-left evaluation
Programming by side effects
Code is data
The Global Context
Coding REBOL like COBOL
IDENTIFICATION DIVISION
ENVIRONMENT DIVISION
FILE SECTION
WORKING-STORAGE SECTION
SCREEN SECTION
PROCEDURE DIVISION
COPY statement
Printing
Your own mezzanine
Module testers
Module documentation idea
Program structure suggestion
List of all code samples

Some useful equivalencies
ACCEPT
ADD
COMPUTE
DISPLAY
DIVIDE
EXIT
INSPECT
MOVE
MULTIPLY
IF
OCCURS
PERFORM
READ
REMAINDER
ROUNDED
SEARCH
SET
TODAYS-DATE
TIME
VALUE

What's in your head, Boy?
Introduction
Similar but not the same
Colon is not assignment
Be careful defining
A shorter letter
On punctuation
Why so dense?

Doing COBOLish things
Fixed-format file

Sample applications
Introduction
Source code as corporate asset
NACHA list
Introduction
Global services modules
Start writing

SCREEN SECTION

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

This explains the REBOL equivalent of the SCREEN SECTION (if there is one).


COBOL SCREEN SECTION

At one point, COBOL screens were defined in a section labeled the SCREEN SECTION. This is where data on the screen was laid out, using row and column numbers for terminals that displayed 24 lines of 80 characters. That is where my personal knowledge of COBOL GUI programming stopped. Things have advanced, and it would not be productive for me to try to learn enough to explain something that everyone else knows better, just so that I can contrast it to REBOL. The relevant point is that screens were laid out in a special area.

The REBOL equivalent

In REBOL there is no special spot for putting screen definitions, but there is a special way of doing screen definitions. It is called the Video Interface Dialect (VID) and it is a set of keywords and attributes used to describe a screen.

In sample code, you see a lot of examples like this:

view layout [
    screen-description-code
]
The screen-description-code is keywords like "button," "text," "field," keywords that you correctly would expect would define things like buttons, text, and fields. There also are some procedure-division-like things going on in this code. The word "view" is a function that displays a screen that has been constructed in some sort of internal format. The word "layout" is a function that operates on the screen-description-code and makes that internal format.

You can make your screen coding a little more COBOL-like by setting up an area in your source code file where you define all your screens. Instead of using the "view layout [vid-code]" model, you could try the following.

In you pseudo-screen-section, put the VID code in named blocks, like this:

MAIN-WINDOW: [
    main-window-vid-code
]
ANOTHER-WINDOW: [
    another-window-vid-code
]
Code like the above would be your equivalent of the SCREEN SECTION. Then, at the appropriate place in the program where you wanted to display the screen, code
view layout MAIN-WINDOW

The above suggestion is not any sort of requirement of REBOL. It is a way of organizing your source code that might feel familiar to you and help you get started in writing a program in a language that does not have the structure that you are used to.