Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Calculation of record size thru a cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ideas

New User


Joined: 25 May 2005
Posts: 53
Location: India

PostPosted: Wed Feb 28, 2007 7:19 pm    Post subject: Calculation of record size thru a cobol program
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

Moderator Team Head


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

PostPosted: Wed Feb 28, 2007 7:22 pm    Post subject: Re: Calculation of record size
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

Active Member


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

PostPosted: Wed Feb 28, 2007 7:24 pm    Post subject:
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: 685
Location: Earth

PostPosted: Wed Feb 28, 2007 8:07 pm    Post subject: Do you mean size of the record-structure?
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    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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us