INSPECT verb in COBOL program -


here example used inspect verb.

inspect function reverse (ws-addr(7:4)) tallying ws-count leading spaces              display 'count  :' ws-count              compute ws-length = 4 - ws-count              display 'length  :' ws-length 

i not getting right output below input,

input-1  - 43we  ws-count = 0 length   = 4  input-2  - 85 ws-count = 2 length   = 2  input-3  - 74oi ws-count = 2 length   = 2 

for input-3 ws-count should come 0 getting 2 value. please find console window screen shot below,

in-values  :%orig243we count  :000 length  :004 addresslines:  43we<br>   ws-sub  :004 in-values  :%orig385   count  :002 length  :002 addresslines:  85<br>     ws-sub  :005 in-values  :%orig474oi count  :002 length  :002 

could me resolve this.

you must initialize identifier-2 before execution of inspect statement begins.

so says ibm enterprise cobol language reference, , words similar in cobol manual.

identifier-2 target field of talllying.

if not set initial value prior inspect, current value used add (or not, in case).

this useful sometimes, if not want make use of it, must set identifier-2 field 0 before inpsect.

in case be, example (you use initialize, set 88 has 0 in first position of value clause, etc):

move 0 ws-count 

if show data-definitions, representative sample input , expected output, may hints doing want in tidier way. if tell want.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -