Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
COBOL file declaration

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: COBOL file declaration
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: 8410
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 16, 2018 11:28 pm    Post subject: Reply to: COBOL file declaration
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

Active Member


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

PostPosted: Sun Nov 18, 2018 10:16 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts COBOL D2 program execution without us... dipsybaby DB2 3 Mon Dec 10, 2018 2:08 pm
No new posts Transferring file to Mainframes Shinoj Vijayakumar IBM Tools 3 Thu Dec 06, 2018 2:35 pm
No new posts Convert VBA file to FB! Vignesh Sid SYNCSORT 5 Mon Dec 03, 2018 1:27 pm
No new posts calling java code(on mainframe from c... elixir1986 COBOL Programming 1 Fri Nov 30, 2018 1:57 am
No new posts Another 39 File Status on VB file socker_dad COBOL Programming 5 Tue Nov 27, 2018 6:11 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us