Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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: 967
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
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us