Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Data issue when moving from Alphanumeric to numeric field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Sat Nov 14, 2009 3:38 pm    Post subject: Data issue when moving from Alphanumeric to numeric field
Reply with quote

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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Nov 14, 2009 4:06 pm    Post subject:
Reply with quote

Hello,

Because the target field has no sign.
Back to top
View user's profile Send private message
nithivenkat

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Sat Nov 14, 2009 4:20 pm    Post subject: Reply to: Data issue when moving from Alphanumeric to numeri
Reply with quote

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

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Nov 14, 2009 4:24 pm    Post subject: Reply to: Data issue when moving from Alphanumeric to numeri
Reply with quote

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

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Sat Nov 14, 2009 4:30 pm    Post subject: Reply to: Data issue when moving from Alphanumeric to numeri
Reply with quote

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

New User


Joined: 15 Sep 2008
Posts: 22
Location: Mumbai

PostPosted: Sat Nov 14, 2009 4:41 pm    Post subject: Reply to: Data issue when moving from Alphanumeric to numeri
Reply with quote

Also, I wont perform any arithmetic with my target field. So kindly advice on this regard Bill/Dick.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Nov 14, 2009 4:44 pm    Post subject: Reply to: Data issue when moving from Alphanumeric to numeri
Reply with quote

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 -

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DZ9ZBK03

search for MVC and you'll see what I mean.

Bill
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Nov 14, 2009 10:04 pm    Post subject:
Reply with quote

Hello,

Not tested but you could run a little experiment using S9(7) for Var2 rather than 9(7). . .
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Nov 15, 2009 7:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Paasing symbolic parameter to instrea... Anirudh Anand JCL & VSAM 1 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 11 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us