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 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: 4650
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: 965
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: 686
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
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm

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