View previous topic :: View next topic
|
Author |
Message |
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
hi,
Can i use renamed data item in arithmetic operations? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hello maridawson,
What do u mean by renaming data item ?
Can you provide an example? |
|
Back to top |
|
|
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
can we use renamed elementary data item for arithmetic operations ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|