View previous topic :: View next topic
|
Author |
Message |
shanudarling Warnings : 1 New User
Joined: 20 Dec 2006 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
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 |
|
|
shanudarling Warnings : 1 New User
Joined: 20 Dec 2006 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Aren't you getting any abend? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
Aren't you getting any abend? |
Why and what abend should he get?
shanu(darling) (I cant believe people will take such usernames ),
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Little correction,
Please read,
You will get compilation error when you try to move Alphabetic (not alphanumeric) variable to numeric variable. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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. |
|
Back to top |
|
|
socker_dad
Active User
Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
|
|
|
|
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. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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..
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 |
|
|
|