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

what happen when move garbage value to numeric field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vaibhav7

New User


Joined: 23 Aug 2006
Posts: 5

PostPosted: Fri Aug 25, 2006 12:13 pm
Reply with quote

Can anyone tell me what will happen when we move a garbage value to a numeric field? Will it abend?
Back to top
View user's profile Send private message
annujp

New User


Joined: 31 Aug 2005
Posts: 39
Location: St Paul,MN

PostPosted: Fri Aug 25, 2006 12:39 pm
Reply with quote

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

New User


Joined: 23 Aug 2006
Posts: 5

PostPosted: Fri Aug 25, 2006 2:06 pm
Reply with quote

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

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Fri Aug 25, 2006 4:41 pm
Reply with quote

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

New User


Joined: 23 Aug 2006
Posts: 5

PostPosted: Fri Aug 25, 2006 6:33 pm
Reply with quote

thans diwakar
Back to top
View user's profile Send private message
vaibhav7

New User


Joined: 23 Aug 2006
Posts: 5

PostPosted: Fri Aug 25, 2006 6:34 pm
Reply with quote

thanks diwakar
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Mon Aug 28, 2006 12:07 am
Reply with quote

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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Aug 28, 2006 8:15 am
Reply with quote

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

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Mon Aug 28, 2006 12:37 pm
Reply with quote

Hi mmwife,

Thanks for coming up with an example.

Regards,
Diwakar

--------------------------------------------------------------

Nobody is perfect. I am nobody
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top