IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can i use renamed data item in the arithmetic operations?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Aug 21, 2008 11:02 am
Reply with quote

hi,
Can i use renamed data item in arithmetic operations?
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Thu Aug 21, 2008 11:12 am
Reply with quote

Hello maridawson,

What do u mean by renaming data item ?
Can you provide an example?
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Aug 21, 2008 11:26 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 21, 2008 12:02 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 21, 2008 12:27 pm
Reply with quote

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
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Fri Aug 22, 2008 3:39 pm
Reply with quote

can we use renamed elementary data item for arithmetic operations ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 22, 2008 4:43 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top