Find the LENGTH of a String in COBOL -IBM Mainframes?

Find the LENGTH of a String in COBOL -IBM Mainframes?

WebOct 14, 2014 · The current popular way to do this is with reference-modification. You need to take your user-input, find out how many trailing spaces it contains, calculate how long the data is, add one for the trailing blank, and hold that value in a field (preferably a BINARY field). Then your INSPECT can look like this: WebMay 26, 2015 · COBOL has fixed-lenth fields, which will be "padded" to the right with spaces if the data is short of the field-length and truncated to the right if the data is longer than the field. Enterprise COBOL does have string literals - consult the manual. To find the length of the data in a field, you have to count the trailing spaces. crx rear lights WebJun 4, 2011 · always returns the compiled length of the variable. there is no such thing in cobol as LENGTH OF STRING. if you want to determine the length of a value within a variable, one way, determine the number of trailing spaces within the variable. Code: INSPECT (REVERSE (variable)) TALLYING LEADING SPACES. WebNov 6, 2012 · To find the Length of the String by karthick » Tue Jan 22, 2008 8:03 am 2 Replies 5672 Views Last post by dick scherrer Tue Jan 22, 2008 8:55 pm Cobol Calculate the length of a string by ignacio » Sun Mar 02, 2008 9:53 pm 5 Replies 8782 Views Last post by dick scherrer convert m2 to hm2 WebResolution: 1) It reverses the string using the REVERSE Intrinsic function. 2) The INSPECT verb is used to count the number of leading spaces. 3) The number of leading spaces is … WebMar 20, 2009 · To find the Length of the String by karthick » Tue Jan 22, 2008 8:03 am 2 Replies 5720 Views Last post by dick scherrer Tue Jan 22, 2008 8:55 pm Cobol Calculate the length of a string by ignacio » Sun Mar 02, 2008 9:53 pm 5 Replies 8810 Views Last post by dick scherrer Thu Jul 03, 2008 4:55 pm Board index; The team • All times are UTC ; crx required proof missing theme WebJul 19, 2006 · Compute WS-Pos = WS-Field-Length. Perform Varying WS-Pos from WS-Pos by -1. Until WS-Pos < 0. Or Text-Field (WS-Pos:1) Not = Space. End-Perform. The result I need will then be found in WS-Pos, which will be equal to the length of the data in the field, minus any trailing spaces.

Post Opinion