Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Read file in sequential mode

$
0
0

Are you referring to where in a class program do you place the file definitions?

Here is an example of what this could look like:

       class-id managedfiles.Form1 is partial
                 inherits type System.Windows.Forms.Form.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT StudentFile ASSIGN TO "STUDENTS.DAT"
		                      ORGANIZATION IS LINE SEQUENTIAL.

       FILE SECTION.
       FD StudentFile.
       01 StudentDetails.
          02  StudentId       PIC 9(7).
          02  StudentName.
              03 Surname      PIC X(8).
              03 Initials     PIC XX.
          02  DateOfBirth.
              03 YOBirth      PIC 9(4).
              03 MOBirth      PIC 9(2).
              03 DOBirth      PIC 9(2).
          02  CourseCode      PIC X(4).
          02  Gender          PIC X.
       working-storage section.
       method-id ReadFile.
       procedure division.
          open input studentfile
          read studentfile
             at end
                display "no more"
          end-read
          close studentfile
          goback.
       end method.
          
       method-id NEW.
       procedure division.
           invoke self::InitializeComponent
           goback.
       end method.

       method-id button1_Click final private.
       procedure division using by value sender as object e as type System.EventArgs.
       end method.
      
       end class.

Viewing all articles
Browse latest Browse all 4356

Trending Articles