View previous topic :: View next topic
|
Author |
Message |
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
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 |
|
|
cooldebi
New User
Joined: 19 Apr 2006 Posts: 18 Location: mumbai
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Value clauses are "allowed" but ignored by the compiler; i.e. no vals are put into the fields to init them. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
I think we cannot use REDEFINE and VALUE Clause in the FD Section. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
|