i have n records in one file and in this file there is some
fields and i want to count that how many sharma in my file
so plz give the coding that how we read sharma ?

Answers were Sorted based on User's Feedback



i have n records in one file and in this file there is some fields and i want to count that how man..

Answer / mr. cooooool

HI...........
PLZZZZZZ USE DIS LOGIC.


PROCEDURE DIVISION.
OPEN INPUT FILE1.
PERFORM READ-PARA UNTIL EOF = 'D'.
DISPLAY COUNT.
CLOSE FILE1.
STOP RUN.
READ-PARA.
READ FILE1
AT END
MOVE 'D' TO EOF
NOT AT END
PERFORM INSPECT-PARA
END-READ.
INSPECT-PARA.
INSPECT NAME TALLYING COUNT FOR ALL 'SHARMA'.

COUNT IS A WORKING-STORAGE VARIABLE WHICH WILL COUNT THE
OCCURENCE OF 'SHARMA'.

THANKS
REGARDS
RAVINDRA BISHT

Is This Answer Correct ?    11 Yes 0 No

i have n records in one file and in this file there is some fields and i want to count that how man..

Answer / abhay

using SORT UTILITY(OUTFIL) AND THROUGH SORT(OUTREC),its
possible..
..
1)THROUGH SORT UTILITY(OUTFIL):

//S1 EXEC PGM=SORT
//F1 DD DSN=....
.
.
//SYSIN DD *
SORT FILEDS=(1,4,CH,A)
OUTFIL FILE 1 INREC FIELDS=(10,5,CH,EQ,C'SHARMA')
*/
//

2)THROUGH SORT(OUTREC):

//S1 EXEC PGM=SORT
//DD1 DD DSN=....
//DD2 DD DSN=.... Where o/p contains SHARMA will move into DD2
.
.
//SYSIN DD *
SORT FILEDS=(1,4,CH,A)
OUTREC FIELDS=(10,5,CH,EQ,C'SHARMA')
*/
//

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More COBOL Interview Questions

Can anybody give me example of subscript and index

5 Answers  


How to display string in the reverse order using occurs clause?

4 Answers  


1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

0 Answers   IBM,


Why we are using comp and comp-3 in real time projects?

4 Answers   IBM,


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

0 Answers  


Can the OCCURS clause be at the 01 level?

8 Answers   Oracle,


Write the code implementing the perform … varying.

0 Answers  


If we put three reads in COBOL in the same para one after the other, to read a PS file,will it read the same record thrice or it will read three records sequentially? For example : Input File 01 02 03 Para 900 Read infile Display Infile rec Read infile Display infile rec Read infile Display infile rec. What will be the output?

2 Answers  


what do you mean by copybook? and what is the difference between the copybook which we are using in working storage and procedure division.

3 Answers   HCL, TCS,


What is the difference between working storage copybook and linkage section copybook?

5 Answers   TCS,


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

0 Answers  


What is the problem of ordered sequential files access?

0 Answers  


Categories