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

Move A/N to numeric shows some junk value in last byte


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Wed Apr 18, 2007 11:30 am
Reply with quote

I get a prob........

i have a map varible x(10)....... and a file variable 9(10).

when i receve a value from a map and populate file field values.... then it show some junk value in last byte

01 m-var1 pic x(10)...............(Map variable)

m-var1 = 123456 ...........(only 6 digit)

pgm...

01 ws-var1 pic 9(10) value zeores.

move m-var1i to ws-var1.

ws-var1= 123456 0 (it shows zero or junk value in last byte....WHY??)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Apr 18, 2007 11:48 am
Reply with quote

THIS IS A DIFFERENT PROBLEM;

many of us watch are notified when a reply is posted, it is disturbing to receive emails related to a completely different subject

regards
Back to top
View user's profile Send private message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Wed Apr 18, 2007 12:35 pm
Reply with quote

get a prob........

i have a map varible x(10)....... and a file variable 9(10).

when i receve a value from a map and populate file field values.... then it show some junk value in last byte

01 m-var1 pic x(10)...............(Map variable)

m-var1 = 123456 ...........(only 6 digit)

pgm...

01 ws-var1 pic 9(10) value zeores.

move m-var1i to ws-var1.

ws-var1= 123456 0 (it shows zero or junk value in last byte....WHY??)
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Apr 18, 2007 1:01 pm
Reply with quote

Aren't you getting any abend?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Apr 18, 2007 1:32 pm
Reply with quote

Quote:
Aren't you getting any abend?

Why and what abend should he get?

shanu(darling) icon_lol.gif (I cant believe people will take such usernames icon_lol.gif ),
Try running XPEDITOR or any debugging tool available at your site, see the contents of m-var1, it may contain junk already and it is getting carried to 9(10) variable.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Apr 18, 2007 2:45 pm
Reply with quote

Abhijit,

Quote:
Why and what abend should he get?


Shanu is moving an alphanumeric variable (PIC X(10) with 6 digits followed by 4 spaces) to a numeric variable.

Quote:
01 m-var1 pic x(10)...............(Map variable)

m-var1 = 123456 ...........(only 6 digit)

pgm...

01 ws-var1 pic 9(10) value zeores.

move m-var1i to ws-var1.


Is this kind of move possible?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Apr 18, 2007 3:14 pm
Reply with quote

murmohk1 wrote:
Shanu is moving an alphanumeric variable (PIC X(10) with 6 digits followed by 4 spaces) to a numeric variable.
Is this kind of move possible?
Of course it is, he did it, didn't he?
shanudarling wrote:
when i receve a value from a map and populate file field values.... then it show some junk value in last byte
You need to either define the map as numeric or take care moving the characters to the numeric field.
One way would be to use the intrinsic function NUMVAL.
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Apr 18, 2007 3:21 pm
Reply with quote

Have you practically tried this and seeking advice or is it a hypothetical question?
We can not move alphanumeric data type to numeric without ISNUMERIC check. And going by your data it is left justifying which is not possible for numeric data as the default is right justification.

Please supply enough and authentic data while posting the query so that you can get a prompt solution

Why dont you provide the exact code you tried with.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Apr 18, 2007 7:13 pm
Reply with quote

This keeps coming again and again.
Alphanumeric to numeric movement is perfectly legal in COBOL.
You will get compilation error when you try to move Alphabetic (not alphanumeric) data to numeric variable.
Quote:
We can not move alphanumeric data type to numeric without ISNUMERIC check

This NUMERIC CHECK is not mandatory. You can very well move data between variables without numeric check.

@OP
How you have generated symbolic map? using tool or you have assumed it as X(10)? What is physical map defn for that field?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Apr 18, 2007 7:17 pm
Reply with quote

Little correction,
Please read,
You will get compilation error when you try to move Alphabetic (not alphanumeric) variable to numeric variable.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Apr 19, 2007 9:15 am
Reply with quote

Abhijit,

Quote:
Alphanumeric to numeric movement is perfectly legal in COBOL.


You mean to say moving 123456bbbb (b=spaces) to PIC9(10) is legal?

I have not tried this, but curuios to read your reply.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Apr 19, 2007 5:59 pm
Reply with quote

Quote:
I have not tried this, but curuios to read your reply.

I think I have already answered this.
Why don't you give it a try instead and let me know. Curious to read YOUR reply. icon_smile.gif
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Thu Apr 19, 2007 9:32 pm
Reply with quote

Interesting results.

I coded the following:

01 WS-VARIABLE PIC 9(10) VALUE ZEROES.
01 MAP-VARIABLE PIC X(10) VALUE '123456'.

PROCEDURE DIVISION.

MOVE MAP-VARIABLE TO WS-VARIABLE.

DISPLAY '----+----+----'.
DISPLAY WS-VARIABLE.
GOBACK.

And received no compile errors or execution errors. My output is:

----+----+----
123456

Not at all what I expected. Even changing the WS-VARIABLE to a signed COMP-3 field didn't change the results. However, when it was defined as a plain COMP field, the compile was good but the program abended because of "illegal characters in a numeric field".

Curioser and curioser. icon_confused.gif
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Apr 19, 2007 10:14 pm
Reply with quote

Quote:
Not at all what I expected

What did you expect?

I think murali doesn't need to give it a try then, but if he does he can learn more..icon_smile.gif
socker_dad,
You have tried this in batch cobol but OP is facing some problem in CICS.
However OP hasn't replied about about physical map information..Lets wait for that..
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top