For Programmers: Free Programming Magazines  


Home > Archive > Cobol > November 2004 > Program templates as Object Classes (was: Non-Cobol person getting er)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Program templates as Object Classes (was: Non-Cobol person getting er)
Lueko Willms

2004-11-25, 3:55 pm

.. On 23.11.04
wrote jjgavan@shaw.ca (James J. Gavan)
on /COMP/LANG/COBOL
in XVxod.310652$nl.309168@pd7tw3no
about Re: Non-Cobol person getting error code


JJG> You are no doubt well versed in other OO languages,

unfortunately not

JJG> and I think I'm correct in saying that COBOL is the only language
JJG> with an in-built file system (????).

mh. Maybe the only one, or most used one, which has syntax for
these three different file organizations, sequential, relative, and
indexed.

JJG> I struck lucky; although cobolreport.com no longer appears to be
JJG> accessible,

It was just the portal to the site objectz.com, as you found out.
So instead of calling www.cobolreport.com, go straight to
www.objectz.com

JJG> using a google search on 'Gene Webb' I got the following
JJG> link, (which is a part of cobolreport.com) :-
JJG> .
JJG> http://objectz.com/oocobol/tutorial/

Thanks for the link, I will have a look at it.


I was thinking more about that class which you presented the other
day, and which was capable of getting the NEXT record in some file
with sequential access. Although I think it is not wise to replicate
what the COBOL compiler does at any rate, it prompted my imagination
to find a better concept based on OO-programming.

You might remember that I presented this simple model for
processing a sequential file, or indexed file in sequential access,
with a READ-FIRST and a loop over "process-available-record, and try-
to-get-next" and that I was thinking about writing a script to
generate a program skeleton of a COBOL program (I would have done it
in REXX).

Like this:


--------- schnipp -----------------------------------------
OPEN INPUT input-file
IF is-not-present-file in status-input-file
THEN *> minor filestat = '5'
DISPLAY "input-file is not present"
ELSE
READ input-file
IF has-reached-EOF in status-input-file
THEN *> Major filestat = '1'
DISPLAY "input-file is empty"
ELSE
OPEN OUTPUT output-file
INITIATE output-report
PERFORM WITH TEST AFTER
UNTIL has-reached-EOF in status-input-file
*> do something useful with the input record
PERFORM process-available-record
*> whose presence is asserted here
GENERATE report-detail-item
READ input-file
END-PERFORM
TERMINATE output-report
CLOSE output-file
END-IF
CLOSE input-file
END-IF
STOP RUN
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com