move low-valule to numeric-data-type



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

move low-valule to numeric-data-type

Postby leon » Wed Feb 25, 2009 9:59 am

Hi All,
why I can't move low-value to fielda which is numeric data type, we have a compile error:"incomptible".
but I think low-value is the smallest value. who knows the reason? thanks.
leon
 
Posts: 40
Joined: Tue Nov 25, 2008 7:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: move low-valule to numeric-data-type

Postby swd » Wed Feb 25, 2009 7:22 pm

Leon - low-values is not a numeric value, it is of course hex zeroes, i.e. x'00000000'. which cannot be moved into a numeric field. It can be moved into a character field, pic x(4) for example.

Why are you trying to move low-values into a numeric field? you can always move it to a PIC X field first then test the field to see if it numeric, or low-values, then move to the numeric field if it contains a numeric value?

Just a suggestion.
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time

Re: move low-valule to numeric-data-type

Postby leon » Thu Feb 26, 2009 12:39 am

good idea, thank you, swd.
leon
 
Posts: 40
Joined: Tue Nov 25, 2008 7:39 pm
Has thanked: 0 time
Been thanked: 0 time

Re: move low-valule to numeric-data-type

Postby dick scherrer » Thu Feb 26, 2009 2:28 am

Hello,

Suggest you move a valid numeric value to a numeric field. . . Zeros should work nicely :)

If you force non-numeric values to a numeric field you will probably cause someone (you or another who has to deal with this code next year when it is no longer fresh in your/their mind) an unwelcome surprise.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post