Is there any way to find different fields length of input records?
Ex.
7654321 would like to know it is 7 numeric character long
234 " " 3 "
The compiler I use has a feature that allows you to reference the length of a field directly, i.e.:
Code:
move length of ws-7-byte-fld to ws-len-7
Your's might too. Remember though, that a pic 9(7) comp-3 field will result in ws-len-7 = 4 bytes.
If you are really looking for the SIGNIFICANT digits of the field, i.e. ws-7-byte-fld contains 0000123 and you want to determine the length of 123, use this:
Code:
move as above
move zeros to ws-zero-cnt
inspect ws-7-byte-fld tallying ws-zero-cnt for
leading zeros
compute ws-sig-digits = ws-len-7 - ws-zero-cnt
If your compiler doesn't support "length of" you can use "inspect" (or similar feature) tallying characters to get the field length.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.