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

To find the size of variable?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karamveer hooda

New User


Joined: 03 Apr 2008
Posts: 3
Location: India

PostPosted: Mon Apr 21, 2008 1:04 pm
Reply with quote

HI,
Is their is any way to display out the length of variable we use through cobol program ? eg s9(11) comp-3.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Apr 21, 2008 2:40 pm
Reply with quote

you can always use:
DISPLAY LENGTH OF NUM-FIELD-1

What is your reason to display the length of a variable?

It will not change, unless you make a change to the pic clause and recompile the program.

If you generally need to know the length of fields, look at the compile listing.
Back to top
View user's profile Send private message
karamveer hooda

New User


Joined: 03 Apr 2008
Posts: 3
Location: India

PostPosted: Mon Apr 21, 2008 2:45 pm
Reply with quote

Thanks dbz,
Actually i want to know the variable length of those group variable having sub variable of sync, comp-3 like variables.
I want to know actual byte taken by variable. for eg.
s9(4) comp takes 2 byte.
I want to display this 2 byte in my spool through display or what so ever is the syntax. Looking forward for your reply.
thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Apr 21, 2008 3:06 pm
Reply with quote

I would suggest that you look at the object map generated by the compiler.

Otherwise, the display statement that I provided will function.
Back to top
View user's profile Send private message
karamveer hooda

New User


Joined: 03 Apr 2008
Posts: 3
Location: India

PostPosted: Tue Apr 22, 2008 9:49 am
Reply with quote

Thanks dbz..
i have implemented your suggestion
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top