View previous topic :: View next topic
|
Author |
Message |
hello2satish
New User
Joined: 21 Jul 2007 Posts: 5 Location: Mumbai
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
hello2satish
New User
Joined: 21 Jul 2007 Posts: 5 Location: Mumbai
|
|
|
|
Thank You Sir Thanks a lot for your kind support
It's great to be here !!
Thank You ! |
|
Back to top |
|
|
|