title: Suppress Leading Zeros in COBOL
body: <p>I have tried looking this up online but I can't find anything that matches my situation. I need to suppress the leading zeros in the output but I can't get it working correctly. The number I need to suppress is the PR-PAY-RATE.</p>
  
  <pre><code>  ******************************************************************
     ID DIVISION.
        PROGRAM-ID. LAB5
        AUTHOR. asdf.
        DATE-WRITTEN. March 25, 2014.
        DATE-COMPILED. CURRENT-DATE.
    ******************************************************************
     ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
         SELECT PAYROLL-FILE ASSIGN TO PAYIN
         ORGANIZATION IS SEQUENTIAL.
  
     DATA DIVISION.
       FILE SECTION.
       FD PAYROLL-FILE.
  
    **** Payroll Record Length 360 characters ************************
     01  PAYROLL-RECORD.
         05  PR-EMPLOYEE-ID         PIC  X(07).
         05  PR-LAST-NAME           PIC  X(26).
         05  PR-FIRST-NAME          PIC  X(15).
         05  PR-DIVISION            PIC  X(10).
         05  PR-GROUP               PIC  X(10).
         05  PR-DEPARTMENT          PIC  X(10).
         05  PR-TITLE               PIC  X(20).
         05  PR-ADDRESS1            PIC  X(30).
         05  PR-ADDRESS2            PIC  X(30).
         05  PR-CITY                PIC  X(30).
         05  PR-STATE               PIC  X(2).
         05  PR-PROVINCE            PIC  X(20).
         05  PR-COUNTRY             PIC  X(20).
         05  PR-ZIP-POSTAL          PIC  X(09).
         05  PR-PAY1-STATUS         PIC  X(01).
             88  PR-STAT-ACTIVE         VALUE 'A'.
             88  PR-STAT-TERMINATED     VALUE 'T'.
             88  PR-STAT-RETIRED        VALUE 'R'.
             88  PR-STAT-DISCHARGED     VALUE 'D'.
         05  PR-START-DT            PIC  9(08).
         05  PR-TERM-DT             PIC  9(08).
         05  PR-TERM-REASON         PIC  X(30).
         05  PR-PAY-RATE            PIC  9(9)V99.
         05  PR-PAY-CYCLE           PIC  X(01).
             88  PR-HOURLY              VALUE 'H'.
             88  PR-BIWEEKLY            VALUE 'B'.
             88  PR-YEARLY              VALUE 'R'.
         05  PR-LAST-INCREASE-DT    PIC  9(08).
         05  PR-LAST-EVAL-DT        PIC  9(08).
         05  PR-LAST-EVAL-RATING    PIC  X(01).
             88  PR-RATE-A              VALUE 'A'.
             88  PR-RATE-B              VALUE 'B'.
             88  PR-RATE-C              VALUE 'C'.
             88  PR-RATE-D              VALUE 'D'.
             88  PR-RATE-N              VALUE 'N'.
         05  PR-BENEFIT-FLAG        PIC  X(01).
             88  PR-BENEFIT-YES         VALUE 'Y'.
             88  PR-BENEFIT-NO          VALUE 'N'.
         05  PR-MEDICAL-FLAG        PIC  X(01).
             88  PR-MEDICAL-YES         VALUE 'Y'.
             88  PR-MEDICAL-NO          VALUE 'N'.
         05  PR-DENTAL-FLAG         PIC  X(01).
             88  PR-DENTAL-YES          VALUE 'Y'.
             88  PR-DENTAL-NO           VALUE 'N'.
         05  PR-VISION-FLAG         PIC  X(01).
             88  PR-VISION-YES          VALUE 'Y'.
             88  PR-VISION-NO           VALUE 'N'.
         05  PR-BENEFIT-COST-YR     PIC  9(9)V99.
         05                         PIC  X(30).
    **** End of Payroll Record ***************************************
  
  
      WORKING-STORAGE SECTION.
      01  WS-NAMED-MEMORY-LOCATIONS.
         05 EOF-SWITCH               PIC X        VALUE 'N'.
            88 EOF                                VALUE 'Y'.
            88 NOT-EOF                            VALUE 'N'.
  
         05 PAYROLL-COUNT            PIC 9(5).
         05 EMP-SELECTED             PIC 9(9)V99.
         05 TOTAL-PAY                PIC 9(9)V99.
         05 AVG-PAY                  PIC 9(9)V99.
  
  
    ******************************************************************
      PROCEDURE DIVISION.
  
      100-MAIN-PROGRAM.
         PERFORM 200-DISPLAY-SPLASH-PAGE.
         PERFORM 300-OPEN-FILES.
         PERFORM 400-READ-PAYROLL-FILE UNTIL EOF.
         PERFORM 700-END-PROGRAM.
         STOP RUN.
  
      200-DISPLAY-SPLASH-PAGE.
         DISPLAY '**************************************************'.
         DISPLAY '* asdf   ENTERPRISE TECHNOLOGIES LAB5            *'.
         DISPLAY '* asdf                                           *'.
         DISPLAY '* March 25, 2014                                 *'.
         DISPLAY '**************************************************'.
  
      300-OPEN-FILES.
         OPEN INPUT PAYROLL-FILE.
  
      400-READ-PAYROLL-FILE.
          READ PAYROLL-FILE
              AT END MOVE 'Y' TO EOF-SWITCH.
  
          IF EOF
              THEN PERFORM 700-END-PROGRAM.
          IF NOT-EOF
              PERFORM 500-PROCESS-PAYROLL-RECORDS
          END-IF.
  
       500-PROCESS-PAYROLL-RECORDS.
  
          ADD 1 TO PAYROLL-COUNT.
  
          IF PR-PAY1-STATUS = 'A' AND PR-PAY-CYCLE = 'B'
              THEN PERFORM 600-DISPLAY-PAYROLL-DATA.
  
  
  
  
       600-DISPLAY-PAYROLL-DATA.
         DISPLAY 'Employee ID        : ' PR-EMPLOYEE-ID.
         DISPLAY 'Employee First Name: ' PR-FIRST-NAME.
         DISPLAY 'Employee Last  Name: ' PR-LAST-NAME.
         DISPLAY 'Pay Status         : ' PR-PAY1-STATUS.
         DISPLAY 'Pay Cycle          : ' PR-Pay-Cycle.
         DISPLAY 'Pay Rate           : ' PR-Pay-Rate.
         DISPLAY '******************************************'.
          ADD 1 TO EMP-SELECTED.
          ADD PR-PAY-RATE TO TOTAL-PAY GIVING TOTAL-PAY.
          COMPUTE AVG-PAY = TOTAL-PAY / EMP-SELECTED.
  
  
       700-END-PROGRAM.
  
  
         DISPLAY 'Total Payroll Recs : ' PAYROLL-COUNT.
         DISPLAY 'Employees Selected : ' EMP-SELECTED.
         DISPLAY 'Total Pay          : ' TOTAL-PAY.
         DISPLAY 'Average Pay        : ' AVG-PAY.
         DISPLAY '******************************************'.
         DISPLAY '* End of LAB5                            *'.
         DISPLAY '******************************************'.
         CLOSE PAYROLL-FILE.
         STOP RUN.
  </code></pre>