View previous topic :: View next topic
|
Author |
Message |
srimsc_ibmmainframes
New User
Joined: 17 Feb 2004 Posts: 19 Location: pune
|
|
|
|
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 |
|
|
ikumar
New User
Joined: 02 Aug 2005 Posts: 81
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
rsshanmugam
New User
Joined: 08 Mar 2005 Posts: 62 Location: Basildon
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|