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

wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and i want them to be send to outputfile in reverse order. PLZ HELP ME OUT .........THIS IS A RECENT QUESTION IN IGATE..

5 Answers   iGate,


how to convert the recors form vsam file to db2 table tru file aid

0 Answers   TCS,


If we use GO BACK instead of STOP RUN in cobol?

1 Answers   Temenos,


How can we increase the size of an existing PDS to include more no. of modules.

3 Answers  


TYPES OF SORTINGS. which is more prefarable.

2 Answers   Syntel, TCS,






Why we need to use redefine clause when we can define the variable seperately... what is actual need....

5 Answers   Accenture,


Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.

2 Answers   RBS,


file status 00 is checked after opening the file or reading the file

4 Answers   John Deere,


I have a sequential file of 100 records. How do I load the records into a two dimensional array ?

3 Answers   IBM, Xansa,


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

0 Answers   EDS,


how to transfer the file from pc to mainframe??

4 Answers  


What is the difference between a binary search and a sequential search?

3 Answers  


Categories