[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] cobol source converter
From: |
John R. Culleton |
Subject: |
Re: [open-cobol-list] cobol source converter |
Date: |
Mon Sep 12 12:40:50 2005 |
User-agent: |
KMail/1.7.2 |
On Monday 12 September 2005 06:27 pm, Kevin Hatfield wrote:
> Anyone know where there is a python script or something handy to remove
> line numbers, change 'assign to disk' statements, etc. to make existing
> mf-cobol code compilations less tedious?
No, but I have a handy dandy COBOL program to fill in the line numbers and
renumber the program. Of course I prefer legacy format because
it is more readable. And when an error message references line
number soandso line numbers are surely handy. Adding code to
change ASSIGN statements should not be too difficult given the
newer features of COBOL.
Here is my handy-dandy:
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. RENUM.
000030 ENVIRONMENT DIVISION.
000040 CONFIGURATION SECTION.
000050 SOURCE-COMPUTER.
000060 Linux.
000070 OBJECT-COMPUTER.
000080 Linux.
000090 INPUT-OUTPUT SECTION.
000100 FILE-CONTROL.
000110 SELECT INPUT-FILE ASSIGN TO
000120 "infile"
000130 ORGANIZATION IS LINE SEQUENTIAL.
000140 SELECT OUTPUT-FILE ASSIGN TO
000150 "outfile"
000160 ORGANIZATION IS LINE SEQUENTIAL.
000170 DATA DIVISION.
000180 FILE SECTION.
000190 FD INPUT-FILE
000200 BLOCK CONTAINS 1 RECORDS.
000210 01 INREC.
000220 05 SEQNO PICTURE 9(6).
000230 05 FILLER PIC X(65).
000240 FD OUTPUT-FILE
000250 BLOCK CONTAINS 1 RECORDS.
000260 01 OUTREC PICTURE X(72).
000270 WORKING-STORAGE SECTION.
000280 77 LINE-CNT PICTURE S9(6).
000290 PROCEDURE DIVISION.
000300 OPEN INPUT INPUT-FILE OUTPUT OUTPUT-FILE.
000310 MOVE 10 TO LINE-CNT.
000320 LOOP.
000330 READ INPUT-FILE AT END GO TO STOPIT.
000340 MOVE LINE-CNT TO SEQNO.
000350 ADD 10 TO LINE-CNT.
000360 WRITE OUTREC FROM INREC.
000370 GO TO LOOP.
000380 STOPIT.
000390 CLOSE INPUT-FILE OUTPUT-FILE.
000400 STOP RUN.
Of course the program source is not conveniently named INFILE. So I
have this little script to run the above program (in Linux of course)
-----------------------
mv $1 infile
/usr/local/ledger/renum
mv outfile $1
-----------------------
My technique when writing or modifying a program is to just skip
the first six columns (usually the first seven.) Then when I am
done I run my little script with the name of the program and then
compile.
Obviously you don't like the old ways. You can reverse my
little program to make it take out line numbers in about 30 seconds.
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf
Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf