Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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: 8466
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: 981
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 Header and trailer for a PS file kumara kanthirava JCL & VSAM 5 Mon Aug 19, 2019 3:54 pm
No new posts Select based on a range from a differ... sergeyken SYNCSORT 2 Fri Aug 16, 2019 12:37 am
This topic is locked: you cannot edit posts or make replies. Select based on a range from a differ... vamsimul SYNCSORT 13 Tue Aug 13, 2019 12:36 pm
No new posts Compare duplicate records in same file pshongal DFSORT/ICETOOL 3 Fri Aug 09, 2019 9:37 am
No new posts Move a particular line from a PS file... Jitesh Kumar CLIST & REXX 7 Mon Aug 05, 2019 2:48 am

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