IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to Enter values in to the file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hello2satish

New User


Joined: 21 Jul 2007
Posts: 5
Location: Mumbai

PostPosted: Sat Jul 28, 2007 3:30 pm
Reply with quote

Hello friends
I just wanted to know that how to enter the value in the file,the format which i want is given beliow.

Code:
 FD  D01-STUDENT
           01 D01-STUDENT-REC.
              05 D01-NAME                           PIC X(20).
              05 FILLER                             PIC X(01).
                 10 D01-TERM                        PIC 9(02) OCCURS 2 TIMES.
                 10 FILLER                          PIC X(01).
                    15 D01-MARKS                    PIC 9(02) OCCURS 2 TIMES.



Here against one student name 2 terms are there and against each term marks occurs 2 times.

I want the user input value in the file like (code given below is wrong)

Code:
        OPEN OUTPUT D01-STUDENT.
        MOVE SPACES TO D01-STUDENT-REC.
        PERFORM UNTIL WS-B = 2.
        MOVE 0 TO WS-A
        MOVE 1 TO WS-B
        DISPLAY " ENTER NAME "
        ACCEPT D01-NAME.
        DISPLAY " ENTER THE TERM NO "
        ACCEPT D01-TERM(WS-B).
        DISPLAY " ENTER THE MARKS "
        ACCEPT D01-MARKS(WS-B, WS-A + 1).
        DISPLAY " ENTER MARKS "
        ACCEPT D01-MARKS(WS-B, WS-A + 2 ).
        ADD 1 TO WS-B
        WRITE D01-STUDENT-REC.
        CLOSE D01-STUDENT



Please help me out.

Thank You.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sat Jul 28, 2007 4:26 pm
Reply with quote

No periods within the perform.
You need an end for the perform.
You need to take the things out of the perform that should not be done twice.
Code:
        OPEN OUTPUT D01-STUDENT.
        MOVE SPACES TO D01-STUDENT-REC.
        DISPLAY " ENTER NAME ".
        ACCEPT D01-NAME.
        MOVE 0 TO WS-A.
        MOVE 1 TO WS-B.
        PERFORM UNTIL WS-B = 2
           DISPLAY " ENTER THE TERM NO "
           ACCEPT D01-TERM (WS-B)
           DISPLAY " ENTER THE MARKS "
           ACCEPT D01-MARKS (WS-B, WS-A + 1)
           DISPLAY " ENTER MARKS "
           ACCEPT D01-MARKS (WS-B, WS-A + 2 )
           ADD 1 TO WS-B
        END-PERFORM.
        WRITE D01-STUDENT-REC.
        CLOSE D01-STUDENT

Or a bit simpler:
Code:
        OPEN OUTPUT D01-STUDENT.
        MOVE SPACES TO D01-STUDENT-REC.
        DISPLAY " ENTER NAME ".
        ACCEPT D01-NAME.
        MOVE 1 TO WS-B.
        PERFORM 2 TIMES
           DISPLAY " ENTER THE TERM NO "
           ACCEPT D01-TERM (WS-B)
           DISPLAY " ENTER THE MARKS "
           ACCEPT D01-MARKS (WS-B 1)
           DISPLAY " ENTER MARKS "
           ACCEPT D01-MARKS (WS-B 2)
           ADD 1 TO WS-B
        END-PERFORM.
        WRITE D01-STUDENT-REC.
        CLOSE D01-STUDENT
Back to top
View user's profile Send private message
hello2satish

New User


Joined: 21 Jul 2007
Posts: 5
Location: Mumbai

PostPosted: Sun Jul 29, 2007 1:55 am
Reply with quote

Thank You Sir Thanks a lot for your kind support

It's great to be here !!

Thank You !
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top