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

In a file if a column account number conatain value 0001234.. how can we move the value to another variable without zero. value may contain any type such as 00123405. we need the value 1234 or 12305. how can we do that in cobol. Please help.

1 Answers   CSC,


Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable? Answer with an Example will be of great help.

6 Answers   EDS,


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

0 Answers  


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  


How to display the index.(displacement from an array)

4 Answers   IBM,






can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

0 Answers  


01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?

5 Answers   Amdocs,


How to covert given string into ASCII value in COBOL/MF COBOL

3 Answers   CTS, IBM, iFlex,


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

0 Answers  


what happens if we dont close cursor in db2-cobol pgm?

6 Answers  


How many sections are there in data division?.

10 Answers   Amdocs, TCS,


How can we pass data from cobol to JCl?

7 Answers   ADP, Amdocs, IBM,


Categories