Thank you for information
Hello Vincent, Thank you for the clarification, I have understood the logic now! I did not want to act as a know-it-all, the whole affair was such an idea that you might be able to save a few variables, I do not really need that functionality. Unfortunately I do not have the experience with COBOL, I discovered my passion for this programming language only recently and am really impressed and enthusiastic about this language. I'm an old Fortran programmer in hydraulics, thermodynamics and material...
A variable declared with BLANK WHEN ZERO becomes numeric again if it is assigned a numeric value, even if the value is in quotation marks. The contradicts the comments of Vincent (Bryan) Coen. An example program for this I have added and underlines the problem in my first example.
Thanks, I understood it!
(1) The variable 'preis' was declared as a group element with pic 9 (5) v99 blank when zero. (2) The variable receives its initial value with accept ... pic x(8) to price. (2a) With accept --- pic z(5), 99 results in an error message too. (3) The calculation compute rabatt = preis / 100 * abzug triggers the error message: PRICE IS NOT NUMERICAL. (Example in k2.cbl.html attached)
Problem with 'BLANK WHEN ZERO' clause
I have referred to 'GNU COBOL Programmer's Guide' by Gary L. Cutler, version 2.1 of 23.11.2013. There, on page 44, in the first paragraph, the >> SET is an alternative to >> DEFINE. In point 6 of the description corresponding examples are listed. Be that as it may, I do not really need >> SET ... and will at least forget about it. I am still relatively new to COBOL, it could have been that >> SET ... is important for others. Thank you for the effort. Ingo.
Hi Simon, Thanks for the answer, I have revised my error message and read the manual again with >> DEFINE .. is the result as expected, I'm sorry, it was my mistake. But with >> SET as an alternative to >> DEFINE maybe there is still a mistake, or am I wrong? I do not want to overvalue the matter, it is at least of low priority for me. I have added another test program. Ingo.