Home > Software > Mainframe > Cobol
Interview Questions   Tutorials   Discussions   Programs   

Cobol - What is the meaning of 'TALLING' verb in Cobol?




498
views
asked mar August 22, 2014 12:30 PM  

What is the meaning of 'TALLING' verb in Cobol?


           

1 Answers



 
answered By Mswami   0  
TALLYING Phrase: It's basically used for count purpose.

identifier-2
    The count field. It must be an elementary numeric item defined without the symbol P in its PICTURE character-string. You must initialize identifier-2 before the INSPECT statement is executed.

identifier-3 or literal-1
    The tallying operand (the item whose occurrences are tallied) If the tallying operand is a figurative constant, it is considered to be a 1-character nonnumeric literal.

When neither the BEFORE nor AFTER phrase is specified, the following actions take place when the INSPECT TALLYING statement is executed:

  •     If ALL is specified, the count field is increased by 1 for each non-overlapping occurrence in the inspected item of this tallying operand, beginning at the leftmost character position and continuing to the rightmost.
  •     If LEADING is specified, the count field is increased by 1 for each contiguous non-overlapping occurrence of this tallying operand in the inspected item, provided that the leftmost such occurrence is at the point where comparison began in the first comparison cycle for which this tallying operand is eligible to participate.
  •     If CHARACTERS is specified, the count field is increased by 1 for each character (including the space character) in the inspected item. Thus, execution of the INSPECT TALLYING statement increases the value in the count field by the number of characters in the inspected item.

Examples:

INSPECT ID-1
TALLYING COUNTR FOR CHARACTERS
REPLACING CHARACTERS BY SPACES.


INSPECT ID-1
   TALLYING COUNTR FOR CHARACTERS AFTER INITIAL "S"
   REPLACING ALL "A" BY "O".


INSPECT ID-1
   TALLYING COUNTR FOR LEADING "0"
   REPLACING FIRST "A" BY "2"
     AFTER INITIAL "C".

flag   
   add comment

Your answer

Join with account you already have

FF

Preview

 Write A Tutorials
Online-Classroom Classes
www.writeabc.com


  1 person following this question

  3 people following this tag

  Question tags

cobol × 1

Asked 2 years and 3 months ago ago
Number of Views -498
Number of Answers -1
Last updated
3 years and 3 months ago ago

  Similar questions


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert