Real Info About How To Check For Spaces In Cobol
![7 Cobol Examples With Explanations. | By Yvan Scher | Medium](https://miro.medium.com/max/380/1*AV6msGonAQBLHYqCWK2hbw.png)
You mentioned using function reverse followed by inspect.
How to check for spaces in cobol. Your variable then contains spaces. You cannot check a comp variable for spaces, period. Try to use below metioned code for this requirement.
This statement counts the number of occurrences of the letter ‘c’. Cobol move statement move ws_count to my_data. Do a inspect over your variable checking for ' ' if count is greater or equal to 1.
You could code as follows to check for less than or equal to spaces: So you can reverse the bytes in a. The cobol character set includes 78 characters which are shown below −.
Move ' inspect tallying depicted by mainframewizard.com'. Blank 'b' can be used as if var = 'bbbbb'. Display 'count of leading spaces is = '.
But what if i need to check for spaces in a larger variable say 50 bytes. 1) using inspect fill all the spaces in your first field to some delimiter that you would not face in your data, for example, '~' 2) reverse the string using function for ex,.