How to count the records in COBOL data file?what will happen if the file open in extent mode and corresponding is equal to OLD in jcl?by opening an empty vsam file in i/o wii get file status 35 how can you over come this ?

Showing Answers 1 - 2 of 2 Answers

Hi latha,Please eloberate use quastion in proper way so that every can understand in proper way, I mean, If u want to count a record after each fetch or what(simply u want know record count).77 WS-REC-COUNT PIC S9(8) VALUE ZEROS.READ IN-FILE AT END SET EOF NOT AT END ADD +1 TO WS-REC-COUNT.Perform above on loop or depending on requirement.JCL OLD Disposition overrides Programming file status. And hence All data available will be lost.And hence use DISP=MOD.by opening an empty vsam file in i/o wii get file status 35 how can you over come this ? ----------->> Elaborate ur question and post ur sysout so we can look into it.Thanks & RegardsHemantha Kumar

  Was this answer useful?  Yes

kalone

  • Mar 14th, 2010
 

Q1. To count records in a file (in cobol) you can use the method given by hemantha .Or in JCL you can use COUNT in SORT to get the records.

Q2. If the file is OPENed in EXTEND mode in prog but in JCL Disp OLD  is given then 
 prog will override the jcl i.e the records will be appended in the file.

Q3. To avoid it , use OPTIONAL while defining the file in cobol prog. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions