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

Doubt reg Ref. Modification


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

New User


Joined: 17 Feb 2004
Posts: 19
Location: pune

PostPosted: Wed Oct 26, 2005 10:09 am
Reply with quote

Hi,
I have to fields with the following format
05 WS-IN-STRING PIC X(13)
05 PV-TOT-OOP-AMT PIC S9(11)V99

1. So here my doubt is if i say
MOVE WS-IN-STRING(2:11) TO PV-TOT-OOP-AMT(2:11)
What would be the Result?

2. In the same way if i say

MOVE PV-TOT-OOP-AMT(2:11) TO WS-IN-STRING(2:11)
What wud b the result?

3. Can i move WS-IN-STRING to PV-TOT-OOP-AMT ?
For this case the mannulas says that we r not supposed to move Alphanumeric values to Numeric Values....
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Wed Oct 26, 2005 6:16 pm
Reply with quote

YOu cannot use reference modification on numeric data-items...i think, the answer for first two questions would be compilation errors.

3) You can move if you have digits/signs in your string.

Please let me know if i am wrong.

Cheers,
Kumar.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Oct 28, 2005 4:08 am
Reply with quote

Hi Reddy,

You CAN use DISPLAY numeric fields w/refmod. Whatever the sending field contains is moved WITHOUT conversion to the receiving field. Of course the positions and lengths you choose are used.

The move is done according to the rules for a group move, i.e. NO conversion of data.
Back to top
View user's profile Send private message
rsshanmugam

New User


Joined: 08 Mar 2005
Posts: 62
Location: Basildon

PostPosted: Fri Oct 28, 2005 11:19 am
Reply with quote

the first two move is valid unless the alphanumeric value contains numeric value otherwise you get run time error.

regarding third move what mmwife said is correct.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Oct 29, 2005 4:34 am
Reply with quote

You will NOT get an error using refmod in the 1st 2 cases. They are treated as GROUP moves.

Try it . You'll see that I'm correct.

Re. the 3rd case, see "When the sending item is alphanumeric" below. This is from the Zos Cobol manual. The move will be successful (even w/alpha chars) but any arith functions will fail.

Quote:
The following rules outline the execution of valid elementary moves. When the receiving field is:

Numeric or Numeric-edited:

Except where zeros are replaced because of editing requirements, alignment by decimal point and any necessary zero filling take place, as described under "Alignment rules" in topic 5.1.6.6.

If the receiving item is signed, the sign of the sending item is placed in the receiving item, with any necessary sign conversion. If the sending item is unsigned, a positive operational sign is generated for the receiving item.

If the receiving item is unsigned, the absolute value of the sending item is moved, and no operational sign is generated for the receiving item.

When the sending item is alphanumeric, the data is moved as if the sending item were described as an unsigned integer.

When the sending item is floating-point, the data is first converted to either a binary or internal decimal representation and is then moved.

De-editing allows moving a numeric-edited data item into a numeric or numeric-edited receiver. The compiler accomplishes this by first establishing the unedited value of the numeric-edited item (this value can be signed), then moving the unedited numeric value to the receiving numeric or numeric-edited data item.
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 Doubt about pl/1 (job offer) General Talk & Fun Stuff 5
No new posts doubt when executing a file when logg... TSO/ISPF 2
No new posts Doubt in MFS IMS DB/DC 2
No new posts Doubt on GETMAIN, FREEMAIN behaviour CICS 3
No new posts Doubt in using command code O IMS DB/DC 4
Search our Forums:

Back to Top