My orginal post was cocerned compatibility problems with the DEC
Cobol compiler and Cobol compilers on other platforms. I was also looking
for sample code. Although I only received 1 reply, it was enough to solve
my problem. Many thanks to Peter Milnes (milnes_p_at_darwin.ntu.edu.au).
I've include his reply below.
---------- Forwarded message ----------
From: PETER MILNES <p_milnes_at_BANKS.NTU.EDU.AU>
Hi,
This is a example one of our lectueres use here. We use cobol for
teaching purposes only. This example will only use sequential files as
DEC COBOL does not come automatically with ISAM file support. If you need
that we use INFORMIX cisam. If you want more details of that I can supply
it.
The file is also on our anonymous ftp server pellew.ntu.edu.au
in pub/UNIX/example.cob
Hope this helps
Peter Milnes
Multi-User Systems Support Officer
NTU Information Tech Support
-----------------
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM2.
* This program indicates the use of the record structure and
conditions * in cobol . * This program is 1985 ansi standard and
should work on any compiler. * Full stops can be used to
terminate any statement in all standards. * Since 1985 end-if,
end-perform, end-read etc are available.
AUTHOR. Barbara Tuck.
INSTALLATION. Banda.
DATE-WRITTEN. 13-9-96.
DATE-COMPILED. DATE.
SECURITY. None.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. VAX.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
Select output-file assign to "output2.dat".
* If a file has been created with a text editor it is line
sequential * not sequential.
Select input-file assign to "input2.dat"
organization is line sequential.
DATA DIVISION.
FILE SECTION.
FD output-file
label records are omitted.
01 output-line.
* Numeric editing has been used on some of the lines of output
here. * You cannot use numeric edited numbers in any arithmetic
calculation.
05 customer-number-out pic x(6).
05 filler pic x(5).
05 customer-surname-out pic x(20).
05 filler pic x(5).
05 customer-given-name-out pic x(20).
05 filler pic x(5).
05 customer-amount-out pic zzz9.99.
05 filler pic x(5).
05 customer-limit-out pic zzz9.99.
05 filler pic x(5).
05 message-line pic x(40).
FD input-file
label records are omitted.
01 input-line.
05 customer-number pic x(6).
05 customer-surname pic x(20).
05 customer-given-name pic x(20).
05 customer-amount pic 9999v99.
05 customer-limit pic 9999v99.
05 filler pic x(22).
WORKING-STORAGE SECTION.
01 temporary-variables.
05 limit-exceeded pic x(40) value
"This client has exceeded his limit".
05 invalid-data pic x(40) value
"The data in this record is not numeric".
01 flags.
05 more-data pic x value "y".
88 no-more-data value "n".
05 validity-flag pic x value "n".
88 valid value "y".
PROCEDURE DIVISION.
MAIN.
* This paragraph is the controlling paragraph for this
* program. It opens the files, does the priming read and
* controls the main paragraph. It closes files and
* stops the program when the input files records have all
* been read.
Open input input-file
output output-file.
Move spaces to output-line.
Read input-file
at end
set no-more-data to true.
Perform read-and-process
until
no-more-data.
Close input-file output-file.
Stop run.
READ-AND-PROCESS.
Perform check-validity.
If valid
perform process-limit
else
perform an-error-in-data
end-if
Move spaces to input-line.
Read input-file
at end
set no-more-data to true.
CHECK-VALIDITY.
* This paragraph checks the validity of data.
Move "n" to validity-flag.
If customer-amount is numeric
and customer-limit is numeric
move "y" to validity-flag.
PROCESS-LIMIT.
* This paragraph checks the customer limit for each customer *
and moves the appropriate message to the report.
If customer-amount is greater than customer-limit
move limit-exceeded to message-line.
Perform produce-output-line.
AN-ERROR-IN-DATA.
* This paragraph produces the report line for data
* with a numeric error in it.
Move invalid-data to message-line.
Move customer-number to customer-number-out.
Move customer-surname to customer-surname-out.
Move customer-given-name to customer-given-name-out.
Write output-line after advancing 1 line.
Move spaces to output-line.
PRODUCE-OUTPUT-LINE.
* This paragraph produces the normal report line.
Move customer-number to customer-number-out.
Move customer-surname to customer-surname-out.
Move customer-given-name to customer-given-name-out.
Move customer-amount to customer-amount-out.
Move customer-limit to customer-limit-out.
Write output-line after advancing 1 line.
Move spaces to output-line.
------------------------------------------------------------------------------
Peter Milnes !email: milnes_p_at_darwin.ntu.edu.au
Multi-User Systems Support Officer !phone +61 8 89 46 6116 (wk)
Information Technology Support !
Northern Territory University !
____________________________________________________________________
Tom Leffingwell Office: SBA 211
Systems Manager Office Phone: (305) 284-1771
Network Security Email: sysman_at_homer.bus.miami.edu
Pseudo DNS/IP Coordinator
School of Business
University of Miami
____________________________________________________________________
Received on Sat Sep 14 1996 - 09:49:04 NZST