× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Title: RE: Basic Cobol

 Thank you Joel, you are the only one who actually answered my request. I appreciate it very much.

-----Original Message-----
From: Stone, Joel
To: 'RPG400-L@midrange.com'
Sent: 1/30/01 1:14 PM
Subject: RE: Basic Cobol

Here is a simple COBOL program: to compile, use option 14 in PDM.  The
program reads all records from FILE1 and prints them.
 
 
       IDENTIFICATION DIVISION.                                   
                                                                  
       PROGRAM-ID.                     PGM1.                      
       ENVIRONMENT DIVISION.                                      
                                                                  
       INPUT-OUTPUT SECTION.                                      
       FILE-CONTROL.                                              
           SELECT File1                ASSIGN TO DATABASE-file1.  
                                                                  
           SELECT Prntr                ASSIGN TO PRINTER-Prntr.   
                                                                  
       DATA DIVISION.                                             
       FILE SECTION.                                              
       FD  File1.                                                 
       01  file1-rec.                                             
           COPY DDS-ALL-FORMATS OF file1.                         
                                                                      
       FD  prntr.                                                     
       01  prntr-rec     pic x(100).                                  
                                                                      
       WORKING-STORAGE SECTION.                                       
       01  WS-FLAG-EOF     PIC X       VALUE SPACE.                   
           88  EOF                     VALUE 'Y'.                     
                                                                      
       PROCEDURE DIVISION.                                            
                                                                      
      ****************************************************************
      *  MAIN ROUTINES                                                
      ****************************************************************
       MAINLINE.                                                      
           PERFORM SETUP                                              
           PERFORM main-process UNTIL EOF                             
           PERFORM ENDUP                                              
           STOP RUN.                                    
                                                        
       SETUP.                                           
           OPEN INPUT file1                             
                output prntr.                           
           READ file1 at end stop run.                  
                                                        
       main-process.                                    
           write prntr-rec from file1-rec.              
           READ file1 at end move 'Y' to ws-flag-eof.   
                                                        
       ENDUP.                                           
           CLOSE File1 prntr.                           
 

-----Original Message-----
From: Keith Flournoy [mailto:kflournoy@verticalsky.com]
Sent: Monday, January 29, 2001 9:08 PM
To: 'RPG400-L@midrange.com'
Subject: Basic Cobol



I am an RPG developer and I have not used COBOL in the past. Can anyone
tell me how to write a basic COBOL program. An example would be how to
compile a COBOL program that uses a physical or logical file. Thanks.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.