IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Can i use renamed data item in the arithmetic operations?

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
View previous topic :: View next topic  
Author Message
maridawson



Joined: 24 Jun 2008
Posts: 25
Location: chennai

Posted: Thu Aug 21, 2008 11:02 am    Post subject: Can i use renamed data item in the arithmetic operations?  

hi,
Can i use renamed data item in arithmetic operations?
Back to top  
guptae



Joined: 14 Oct 2005
Posts: 1025
Location: Bangalore,India

Posted: Thu Aug 21, 2008 11:12 am    Post subject:  

Hello maridawson,

What do u mean by renaming data item ?
Can you provide an example?
Back to top  
maridawson



Joined: 24 Jun 2008
Posts: 25
Location: chennai

Posted: Thu Aug 21, 2008 11:26 am    Post subject:  

suppose if i rename a data item like in the following ex:

01 ws00-input.
05 ws-in1.
10 ws-in11 pic x(2).
10 ws-in12 pic x(2).
05 ws-in2.
10 ws-in21 pic x(2).
10 ws-in22 pic x(2).
05 ws-in3 pic x(1).
66 ws-ren renames ws-in12 thru ws-in22.

now can i use ws-ren in arithmetic operations like add,sub,multiply,divide?
Back to top  
Sambhaji



Joined: 16 Feb 2007
Posts: 267
Location: Pune, India

Posted: Thu Aug 21, 2008 12:02 pm    Post subject:  

if you try it will give error
Code: Receiving operand "WS-REN (GROUP)" of an arithmetic statement was neither
numeric nor numeric-edited.

maxcc 12



are you sure the fields are alphanumeric??
Back to top  
dbzTHEdinosauer



Joined: 20 Oct 2006
Posts: 1639
Location: germany

Posted: Thu Aug 21, 2008 12:27 pm    Post subject:  

66 items are one of those cobol things that 'is suggested not to use'. It is only slightly less dangerous than MOVE CORR.

Look at your compile listing and you will see that:
1) RENAMES creates a Group item with an ALPHANUMERIC attribute.

2) The length will be equal to that of all the elementary items referenced in the RENAMES clause.

The basic use of RENAMES is to allow MOVEs of elementary items as a group.

As Sambhaji showed, not applicable for arithmetic functions.
Back to top  
maridawson



Joined: 24 Jun 2008
Posts: 25
Location: chennai

Posted: Fri Aug 22, 2008 3:39 pm    Post subject:  

can we use renamed elementary data item for arithmetic operations ?
Back to top  
Robert Sample



Joined: 06 Jun 2008
Posts: 943
Location: Atlanta, GA

Posted: Fri Aug 22, 2008 4:43 pm    Post subject:  

According to the manual, a renamed elementary numeric item remains a numeric item and hence could be used for arithmetic operations. Renamed group items are alphanumeric, however.
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM