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
 
assigning value in Comp-3 Variable in procedure division

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

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Sun Jan 14, 2007 6:17 pm    Post subject: assigning value in Comp-3 Variable in procedure division
Reply with quote

Hi All,

I am declaring a variable as comp-3.
I want to pass value into that.
Suppose the value is 123456. how can I pass the value into that in the procedure division.
please let me know the answer.
Back to top
View user's profile Send private message

hey_its_me
Warnings : 1

New User


Joined: 23 Aug 2006
Posts: 14
Location: USA

PostPosted: Sun Jan 14, 2007 6:32 pm    Post subject: Re: assigning value in Comp-3 Variable in procedure division
Reply with quote

Hi Kiran,

If a variable is declared as comp-3, such that the case given below.

01 A pic 9(05) comp-3.

This variable A uses [(5+1)/2] bytes amount of space for storing information.

If you have to store a value of 123,456 into this variable, this declaration is just sufficient.
This is because 3bytes of space means it can have a maximum value of (2^24)= 17*10^6 in it.

After all comp, binary and comp-3 values are used mathematical calculations. Since it speeds up the calculations.


With Regards,
Anil Kumar
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Jan 14, 2007 6:43 pm    Post subject: Re: assigning value in Comp-3 Variable in procedure division
Reply with quote

Hi
kiran_65 wrote:
I am declaring a variable as comp-3.
I want to pass value into that.
Suppose the value is 123456. how can I pass the value into that in the procedure division.
Are you refering to the MOVE verb? A simple "MOVE 123456 to variable-name" should work just fine.
Does this answer your question?

Bill
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 Handling result sets in the calling N... Rusikesh DB2 7 Fri Apr 13, 2018 12:25 am
No new posts COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

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