gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Please double check my tutorial


From: Patrick
Subject: [open-cobol-list] Please double check my tutorial
Date: Sun, 15 Sep 2013 10:29:11 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8

Hi Everyone

I want to practice my Cobol and I want to study how each construct ends up as C code, to help me better understand libcob and cobc from a output-backwards approach, this will supplement my study of the source code that is an input-forwards approach.

I am making a tutorial that can be shared with others later.

It will have some programs and a directory for each reserved word.

Here is the naming conventions and strategy.

In the topmost directory I want to make a bunch of programs. They will be named with short names as this will be reused later to indicate the relations between various programs later.

I have a program at the bottom of this email that is in the topmost directory, simply named P001.cob for program 1.

I will then copy and past it into the ACCEPT directory, it is now commented beside the ACCEPT statement.

I will then remove this comment from P001.cob, re-comment it and copy it into another folder concerning another reserved word. In the ACCEPT folder I am going to rename it ACCEPT-P001.cob to show that it is just copied from P001.

This would be a stupid strategy for writing code, copying the same code all over the place but I think it will be suitable for a tutorial and will create a sort of dictionary that people could use to look up the use of code in a full program, not just a snippet.

 what do you guys think?

I am using SOURCE is FREE for my examples, is there a reason not to?

BTW I also like to write reserved words in capitals but I will mention somewhere that this is not required.

Thanks-Patrick





            >> SOURCE is FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. P001.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 nothing PIC X VALUE IS SPACE .

SCREEN SECTION.
01 simple-screen .
   05 LINE 5 COLUMN 5 VALUE "Type anything, then enter to exit" .

   05 LINE 5 COLUMN 40 TO nothing .

PROCEDURE DIVISION.
  DISPLAY simple-screen

    PERFORM UNTIL nothing  NOT = SPACE

ACCEPT simple-screen *> Here ACCEPT is used to pass the screen information to the program

    END-PERFORM


STOP RUN.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]