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

Can we use VALUE Clause in the FD Section Copybook.


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

New User


Joined: 23 Aug 2006
Posts: 93
Location: chennai

PostPosted: Thu Mar 29, 2007 8:32 pm
Reply with quote

Hi All,
1.While writing the output File from the FD Section copybook , we use value clause in the copybook, It is not working .

2. Can we use REDEFINE Clause in the FD Section of Cobol Program?

Can anyone answer the above Question...
Back to top
View user's profile Send private message
cooldebi

New User


Joined: 19 Apr 2006
Posts: 18
Location: mumbai

PostPosted: Thu Mar 29, 2007 8:55 pm
Reply with quote

1. I think Value clause is not allowed at record definition level except for 88 level in that record.

2. Yes, Redefine it just after defining the record.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Mar 29, 2007 9:24 pm
Reply with quote

I would like to add one point.
IF we declare more than one 01 level records in FD section then it is considered implicitely redefined to first 01 level record. icon_smile.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Mar 30, 2007 3:55 am
Reply with quote

Value clauses are "allowed" but ignored by the compiler; i.e. no vals are put into the fields to init them.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Mar 30, 2007 1:52 pm
Reply with quote

Abhijit,

Quote:
more than one 01 level records in FD section then it is considered implicitely redefined to first 01 level record


I dont think it is true. In my project, few of the copybooks has three 01 levels.

For example:

Code:

01  BTRN-PARAMS.
       02  ....
       02  ....
       02  ....

01  BTRN-DATA-LIST.
       02  ....
       02  ....
       02  ....

01  BTRN-DATA-AREA.
       02  ....
       02  ....
       02  ....
            04 ....
            04 ....
            04 ....
       02  ....

Length:
 BTRN-PARAMS= 42,
 BTRN-DATA-LIST = 52  &
 BTRN-DATA-AREA= 400


Do you think (implicit) redefine of 42 byte record to 400 length is possible? Curuious to see your reply.
Back to top
View user's profile Send private message
ramfrom84

New User


Joined: 23 Aug 2006
Posts: 93
Location: chennai

PostPosted: Fri Mar 30, 2007 5:30 pm
Reply with quote

I think we cannot use REDEFINE and VALUE Clause in the FD Section.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Fri Mar 30, 2007 6:00 pm
Reply with quote

If you include this copybook after the FD as the records for a file, then that is in fact what you are telling the compiler to do.

If your request to do this has an error, then you'll get an error message.

A copybook means nothing until it is included in your program.

There is only one active record at a time in each open file's buffer, and multiple 01's are in fact, as said above, all valid descriptions. It's up to the programmer to use them correctly.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 6:01 pm
Reply with quote

ramfrom84 wrote:
I think we cannot use REDEFINE and VALUE Clause in the FD Section.
Why not? I do with perfect success:
Code:
01 record-name
   05 data-area pic x(10).
   05 numeric area redefines
      date-area pic s9(7).

and it works... icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 31, 2007 12:14 am
Reply with quote

Hello,

Multiple level 01s in an FD are always a redefinition. Regardless of the record layouts, they all start at the same memory location. If you have multiple 01s of different lengths in an FD what you have defined is a variable length file.

Many, many files have fields/groups successfully redefined in the FD.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Sat Mar 31, 2007 2:11 pm
Reply with quote

Murali Said:
Quote:
Do you think (implicit) redefine of 42 byte record to 400 length is possible? Curuious to see your reply.

YES!
See the manual/reference book.
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Trying to change copybook in online c... CICS 4
Search our Forums:

Back to Top