View previous topic :: View next topic
|
Author |
Message |
vaibhav7
New User
Joined: 23 Aug 2006 Posts: 5
|
|
|
|
Can anyone tell me what will happen when we move a garbage value to a numeric field? Will it abend? |
|
Back to top |
|
|
annujp
New User
Joined: 31 Aug 2005 Posts: 39 Location: St Paul,MN
|
|
|
|
It wont abend until u use the numeric field for some calculations. Like a compute,ADD or something like that.
A simple move will not cause an abend |
|
Back to top |
|
|
vaibhav7
New User
Joined: 23 Aug 2006 Posts: 5
|
|
|
|
Many thanks annujp.
I am bit confused as what can be be there in garbage fields as I was not able to try it out.
Can it be variables which are not initilised or any other? Please can you specify? |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Hi,
Cobol accepts values which are not compatible. i.e a variable declared as
PIC 9(5)
can accept ABCDE .
When we try to do some computation with respect to variable it abends.
Also the COMP3 variables will behave in the different way.
There may even be a error message like. Variable type mismatch.
Regards,
Diwakar
---------------------------------------------------------
Nobody is perfect . I am Nobody |
|
Back to top |
|
|
vaibhav7
New User
Joined: 23 Aug 2006 Posts: 5
|
|
|
|
thans diwakar |
|
Back to top |
|
|
vaibhav7
New User
Joined: 23 Aug 2006 Posts: 5
|
|
|
|
thanks diwakar |
|
Back to top |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
But in the case of array declared in the file record when we are giving non numeric value to numeric field why we are getting an error |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Here's a situation where a move will abend w/an 0C7:
Code: |
05 alphas pic x(003) value 'XYZ'.
05 comp-3-s redefines
alphas pic S9(005) comp-3.
05 comp-3-r pic S9(005) comp-3.
move comp-3-s to comp-3-r |
Because the MOVE stmt generates a ZAP (zero and add packed) assembler language instruction, which is an arithmetic insruction, an 0C7 occurs when the "garbage" (XYZ) is encountered executing the ZAP. |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Hi mmwife,
Thanks for coming up with an example.
Regards,
Diwakar
--------------------------------------------------------------
Nobody is perfect. I am nobody |
|
Back to top |
|
|
|