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 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 -> COBOL Programming
View previous topic :: :: View next topic  
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

priya

Moderator


Joined: 24 Jul 2003
Posts: 568
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: 1592

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: 1592

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
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 Sort to subtract constant from variab... drarem DFSORT/ICETOOL 9 Wed Oct 21, 2015 1:08 am
No new posts JCL SORT - Subtract 2 Months from Cur... srinathds83 SYNCSORT 12 Mon May 12, 2014 12:57 pm
No new posts How to subtract 100 days from current... Logeshwari.Bai DFSORT/ICETOOL 3 Mon Mar 17, 2014 3:40 pm
No new posts Syncsort - subtract and copy using JO... ramsri JCL & VSAM 1 Fri Oct 18, 2013 5:38 pm
No new posts Group records based on key and Multip... Saravana Manikandan DFSORT/ICETOOL 12 Thu Sep 19, 2013 11:42 am


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