View previous topic :: View next topic
|
Author |
Message |
nithivenkat
New User
Joined: 15 Sep 2008 Posts: 22 Location: Mumbai
|
|
|
|
Hi,
Can someone give clarification and to resolve the following.
My code has a variable Var1 which is X(10) and a group variable Var2 which contain Var21 as 9(7) and other child variables
I am trying to Move Var1(1:7) to Var21
Here if Var1 has 00000CC, Var2 wont have anything as it cannot hold this data.
But if Var1 has 000000C, Var2 has 0000003.
Can someone tell me why the value is changed for the last digit alone?
Thanks, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Because the target field has no sign. |
|
Back to top |
|
|
nithivenkat
New User
Joined: 15 Sep 2008 Posts: 22 Location: Mumbai
|
|
|
|
Hi Dick,
Can u please elaborate? I mean how to actually make the target field to follow the same as case 1?
Thanks, |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
When a receiving field is defined as display-numeric (IE: VAR2) and data is moved to it, the compiler ensures a zone-nibble "F" in the last-byte via an Or-Immediate instruction ("OI").
In your example, the last-byte of the sending field is a capital "C" (X'C3'). After the move, the compiler issues the "OI" against the last-byte of the receiving-field and the X'C3' is transformed to a X'F3' (a numeric "3").
To avoid this, issue -
Code: |
MOVE VAR1 (1:) TO VAR2 (1:).
|
You don't need to specify the length of 7, because both fields are the same length and the compiler will treat the move as an Alphanumeric to an Alphanumeric and the "OI" will not be issued.
So, regardless of the last-byte's zone-nibble, the 'OI' will be issued when reference modification is not specified against the receiving-field.
However, if the numeric portion of the sending field's last byte is a 4-Bit "A" through a 4-Bit "F", you'll create a field which has the potential to raise a S0C7, when arithmetic is performed against it, regardless whether the "OI" is issued or not.
Using this Alphanumeric to Alphanumeric reference modification move when the receiving field is NUMERIC is not something which should be advocated or used, unless there's a specific business need, because this could cause problems later.
Bill |
|
Back to top |
|
|
nithivenkat
New User
Joined: 15 Sep 2008 Posts: 22 Location: Mumbai
|
|
|
|
Hi Bill,
"You don't need to specify the length of 7, because both fields are the same length and the compiler will treat the move as an Alphanumeric to an Alphanumeric and the "OI" will not be issued. "
My Var 1 is X(10) and Var21 is 9(7).
I need the first 7 bytes of Var 1 to be moved to Var21.
Please advice. |
|
Back to top |
|
|
nithivenkat
New User
Joined: 15 Sep 2008 Posts: 22 Location: Mumbai
|
|
|
|
Also, I wont perform any arithmetic with my target field. So kindly advice on this regard Bill/Dick. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Yes, the example MOVE will work, regardless of the sending field's length. But, if you'd only need to populate (for example) bytes 1-4 of the 7-byte receiving field, then you would specify (1:4) and bytes 5-7 will not be touched.
Take a look at the MVC assembler instruction and you'll find that there isn't any length specified for the sending field (known as operand-1), but there is a length specified for the receiving field (known as operand-2).
You can find instruction breakdowns in the Principles of Operation -
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DZ9ZBK03
search for MVC and you'll see what I mean.
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Not tested but you could run a little experiment using S9(7) for Var2 rather than 9(7). . . |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi nithivenkat,
It might be helpful to tell us how the data will be eventually used. If it will be presented in a report (not DISPLAYed on a screen) give us examples of the types of data that can be expected in VAR1 and what you expect to see when it's printed. Here's some examples - what are the possibilities in your case:
abcdefg
ABCDEFG
~ 6^><|2
$800.00
2006.24
000000C (i.e. X'F0F0F0F0F0F0C3')
x'0000000000003C'
ETC. |
|
Back to top |
|
|
|