View previous topic :: View next topic
|
Author |
Message |
sree_sree_sree
New User
Joined: 30 Aug 2006 Posts: 13
|
|
|
|
Hi,
As per the below logic, will this code work...
Please let me know how many people agree with below coding..
WORKING-STORAGE SECTION.
01 EBBA PIC X(3) VALUE 'CDE'.
01 EBB1 PIC 9(3).
01 EBB2 PIC 9(3).
PROCEDURE DIVISION.
MOVE EBBA TO EBB1.
DISPLAY 'VALUES',EBBA,EBB1,EBB2.
STOP RUN. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
sree_sree_sree,
Whether this code works or not is determinant upon what you expect it to do.
If you mean, will this code cause the program to abend, the answer is no, it will not abend.
I don?t see a rational reason is for moving a non-numeric string to a numeric field however. What are you trying to accomplish with this move?
Dave |
|
Back to top |
|
|
sree_sree_sree
New User
Joined: 30 Aug 2006 Posts: 13
|
|
|
|
Hi David,
Thanks for responce..
As per my knowledge on SCO7, if we move any non numeric data to numeric data then we will get this abend..I am trying to get an abend SOC7 intentionally to research on this but my code works fine.. thats what iam wondering...
the out put which i have got from the above logic is
DISPLAY 'VALUES',EBBA,EBB1,EBB2.
VALUESCDECD5
Here iam moving non- numeric to numeric and it should not work..
Please let me know once for me |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
valid movements listed in the attachment |
|
Back to top |
|
|
tasneem
New User
Joined: 22 Nov 2006 Posts: 3 Location: Pune
|
|
|
|
Hi,
The code snippet written will work fine. MOVE statement will not give a SOC7 abend. If any subsequent arithmetic operation is performed on variable EBB1, this would result in a SOC7 abend.
Correct me if wrong.
Thanks,
Tasneem |
|
Back to top |
|
|
karthick Raja
New User
Joined: 10 Aug 2006 Posts: 8
|
|
|
|
Hi,
But this code will not abend even if you have a conditional check.
when you move spaces to numeric and then have a conditional check it will give SOC 7. In this case that 'CDE' will be dealt as 345(C3C4C5) and will be processed. I am not sure what that conversion C to C3 is?
But even when you display and check you will get CDE only and not 345.
I dont get how it is.. can any one explain? |
|
Back to top |
|
|
Samir H. Jibhakate
New User
Joined: 10 Nov 2006 Posts: 1 Location: Pune
|
|
|
|
Hi This is sam! this code will not work. it will give errer i.e. SOC7.
Bcz u r moving alphanumeric item to numeric and this is not possible in Cobol. |
|
Back to top |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
hello samir which version of cobol you are using |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
cobolunni,
that was good que...
b'cos i tested the prog with cobol '85 and it was working fine.... |
|
Back to top |
|
|
Nighthawk750
New User
Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
karthick Raja wrote: |
Hi,
But this code will not abend even if you have a conditional check.
when you move spaces to numeric and then have a conditional check it will give SOC 7. In this case that 'CDE' will be dealt as 345(C3C4C5) and will be processed. I am not sure what that conversion C to C3 is?
But even when you display and check you will get CDE only and not 345.
I dont get how it is.. can any one explain? |
It is true that the program is not abending. However, the fact that the program seems to be working fine does not mean that everything is working correctly.
What happens is that 'CDE" is converted. If you look (for example via Xpediter) in the actual values of the numerical field, you will see that it contains
CCF
345
C3 is the EBCDIC value for C
C4 is the EBCDIC value for D
And the F5 is a non-numerical representation of the number 5. That is because the 'E' is seen as a sign. (A=1, B=2, C=3, D=4 E=5 etc).
Confusing? yeah. Even when I write this down it is confusing me.
But this perfectly demonstrates that you realy have to know what you are coding. Returncode zero does not always mean that everyting went as expected.
Hope this clarifies things a bit. |
|
Back to top |
|
|
|