View previous topic :: View next topic
|
Author |
Message |
ideas
New User
Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
Dear experts.
Can you please tell me how to calculate a record size of a file thru a cobol program..
Thanks! |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Could you be more specific? A COBOL program has to know the length of the records as defined in the FD Section before it can ever use a file and before it can ever be compiled. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
The compiler output includes a DMAP (you may need to set the compiler parm) which has every field length in hex. Note that positions of subfields therein are also shown, but as zero-based, meaning first byte is zero, which is the norm in hex addressing.
If you convert a position to decimal, remember to +1 to get the 1-based position. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
If you mean calculating size of record structure then use
LENGTH OF operator.
Code: |
WORKING-STORAGE SECTION.
01 REC-ST.
05 VAR1
05 VAR2
......
compute var-len = length of rec-st + 4
|
LENGTH OF REC-ST will return size of REC-ST in bytes. |
|
Back to top |
|
|
|