How to find the total record occurrence count ?

Questions by katar_s   answers by katar_s

Showing Answers 1 - 0 of 0 Answers

Here is the answer for your question

Code
  1. IDENTIFICATION DIVISION.

  2. PROGRAM-ID. RECCNT.

  3. ENVIRONMENT DIVISION.

  4. INPUT-OUTPUT SECTION.

  5. FILE-CONTROL.

  6.     SELECT IN-FILE1 ASSIGN TO DD1

  7.     FILE STATUS IS WS-ST1.

  8. DATA DIVISION.

  9. FILE SECTION.

  10. FD IN-FILE1.

  11. 01 REC1                    PIC X(80).

  12. WORKING-STORAGE SECTION.

  13. 01 WS-REC-CNT              PIC 9(02) VALUE IS 0.

  14. 01 EOF                     PIC X     VALUE IS SPACES.

  15.     88 EOF-Y                         VALUE IS 'Y'.

  16.     88 EOF-N                         VALUE IS 'N'.

  17. 01 WS-ST1                  PIC X(02) VALUE IS SPACES.

  18. PROCEDURE DIVISION.

  19. MAIN-PARA.

  20.     OPEN INPUT IN-FILE1.

  21.     PERFORM READ-PARA UNTIL EOF-Y.

  22.     DISPLAY 'NO OF RECORDS IN FILE ARE  : ' WS-REC-CNT.

  23.     CLOSE IN-FILE1.

  24.     GOBACK.

  25.  

  26.  

  27. READ-PARA.

  28.     READ IN-FILE1 AT END SET EOF-Y TO TRUE

  29.                  NOT AT END

  30.                  ADD 1 TO WS-REC-CNT.

  31.  

  32.  

  33.  

  34. JCL CODE.

  35.  

  36. //xxxxxT JOB 'ACCOUNTING INFO',

  37. //             CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID

  38. //STEP1 EXEC PGM=RECCNT

  39. //STEPLIB DD DSN=xxxxx.1234.LOADMVS,DISP=SHR

  40. //DD1 DD DSN=xxxxx.1234.FILEPGM1,DISP=SHR

  41. //SYSPRINT DD SYSOUT=*

  42. //SYSOUT DD SYSOUT=*

  43. //*

  44.  

  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