Subject: | |
From: | |
Reply To: | |
Date: | Thu, 19 Dec 2002 11:13:26 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
David writes
I need some help with Cobol...
I am writing a program that is going to read in data
files. However, I the record size (ie; width) of the
data files will vary from run to run. How can I ensure
that my program can cope with this variable record
width.
For example, none of my data files will exceed
1200bytes, so I have initially defined my FD area
thus...* Identify the external files to be used
SELECT F1-INFILEA ASSIGN TO "INFILEA".
SELECT F2-INFILEB ASSIGN TO "INFILEB".
SELECT F3-OUTFILE ASSIGN TO "OUTFILE".
DATA DIVISION.
FILE SECTION.
* Define the layout of the INFILEA input file
* INFILEA
FD F1-INFILEA.
01 F1-RECORD PIC X(1200).
* Define the layout of the INFILEB input file
* INFILEB
FD F2-INFILEB.
01 F2-RECORD PIC X(1200).
...however, when I read in a datafile, say, that is
702bytes wide, my program gives a file error tombstone
complaining about the difference of 702 to my defined
1200.
Can this situation be resolved with something as simple
as a file equation? I've tried a few, but without
success.
All help gratefully received.
----------------------------------------------------------------
Assuming you are running the COBOL 85 entry point, add a $CONTROL STAT74 to
the first line of your COBOL source code. COBOL 74 doesn't do the extensive
checking of files sizes that 85 does. An alternative if you don't need
COBOL 85 features is to compile with the COBOL 74 entry point.
Mike Berkowitz
Guess? Inc.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|