IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL file declaration


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jithinraghavan

New User


Joined: 15 Apr 2018
Posts: 4
Location: United States

PostPosted: Fri Nov 16, 2018 10:54 pm
Reply with quote

I've declared a sequential file in file section as follows.
FD TEST-EXTRACT-FILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
DATA RECORD TEST1-EXTRACT-RECORD.
*
01 TEST2-EXTRACT-RECORD.
05 TRANS-CTL-NUM PIC X(17).
05 RPT-LINE PIC X(26).

Though I didn't declare the variable TEST1-EXTRACT-RECORD anywhere in my program, it compiled successfully without any error icon_eek.gif Any reason behind this? Or is it a bug in COBOL compile?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 16, 2018 11:28 pm
Reply with quote

From the Enterprise COBOL Language Reference manual:
Quote:
DATA RECORDS clause
The DATA RECORDS clause is syntax checked but serves only as documentation for the names of data records associated with the file.
data-name-4
The names of record description entries associated with the file.
The data-name need not have an associated 01 level number record description with the same name.
So the behavior you are seeing is normal and expected.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1015
Location: Richmond, Virginia

PostPosted: Sun Nov 18, 2018 10:16 am
Reply with quote

As a presumably new programmer, at least in COBOL, you're probably wondering why this is so.

COBOL was developed during the 1960's (by a committee actually!), and there have been hundreds of versions and associated compilers. The early ones might have performed stricter syntax checking, and of course had features that have not survived to the present.

Newer compilers (in any language) should try to maintain compatibility where possible so that installations can upgrade without modifying programs. There are COBOL programs that have been running in essentially their original form for decades.

I'm sure others experienced users can give interesting details here, but suffice it to say that, whatever else one may say or think about COBOL, it has been supremely successful in a constantly and rapidly changing technological world.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
This topic is locked: you cannot edit posts or make replies. Write Character to Hexadecimal file w... COBOL Programming 8
No new posts Checking the total counts inside a re... JCL & VSAM 5
No new posts File-aid batch how to repeat a line... Compuware & Other Tools 2
Search our Forums:

Back to Top