Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
ADD CORRESPONDING, SUBTRACT CORR, MULTIPLY CORR

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
kappurajesh
Currently Banned

New User


Joined: 03 Apr 2004
Posts: 4
Location: India

PostPosted: Sat Apr 03, 2004 1:22 am    Post subject: ADD CORRESPONDING, SUBTRACT CORR, MULTIPLY CORR
Reply with quote

How do work with ADD CORRESPONDING,SUBTRACT CORRE,MULTIPLY Corres?

Can I accept value for Comp -1 from user using accept command
Back to top
View user's profile Send private message
References
PostPosted: Sat Apr 03, 2004 1:22 am    Post subject: Re: ADD CORRESPONDING, SUBTRACT CORR, MULTIPLY CORR Reply with quote

priya

Moderator


Joined: 24 Jul 2003
Posts: 630
Location: Bangalore

PostPosted: Sun Apr 04, 2004 9:40 pm    Post subject: Re
Reply with quote

For corresponding,

Use the same variable name and structure.

You CAN'T ACCEPT COMP-1 from input console.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1474

PostPosted: Mon Apr 05, 2004 3:48 am    Post subject:
Reply with quote

Hey K,

I've never worked w/comp-1/2 fields, but you might be able to do what you're asking. I's ugly, but might be do-able if the compiler allows redefinition of comp-1/2 fields.

Prompt your your terminal user to enter the exponent and the mantissa. Store them in separate fields and convert the values to COMP. Define the comp-1 field and redefine it as follows:

05 comp-1-fld.
05 constructed fld redefines comp-1-fld.
10 cpic x(001).
10 cf-mantissa pic x(003).

05 accept-exp pic 9(002).
05 accept-man pic 9(004).

05 comp-exp pic 9(001) comp.
05 comp-man pic 9(001) comp.


display 'enter 2 digit exp with leading zeros'
accept accept-exp
display 'enter 4 digit man with leading zeros'
accept accept-man

move accept-exp to comp-exp
move accept-man to comp-man
move comp-exp(2:1) to cf-exponent
move comp-man(2:3) to cf-mantissa

If you have to handle negative values too, it gets even stickier.

Regards, Jack.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1474

PostPosted: Mon Apr 05, 2004 3:53 am    Post subject:
Reply with quote

Something went awry. That 1st pic x field s/b:

10 cf-exponent pic x(001).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1