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

Calculation of record size thru a cobol program


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

New User


Joined: 25 May 2005
Posts: 52
Location: India

PostPosted: Wed Feb 28, 2007 7:19 pm
Reply with quote

Dear experts.

Can you please tell me how to calculate a record size of a file thru a cobol program..

Thanks!
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Feb 28, 2007 7:22 pm
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Wed Feb 28, 2007 7:24 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 8:07 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top