Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Enter values in to the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to Enter values in to the file
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: 3158
Location: Tucson AZ

PostPosted: Sat Jul 28, 2007 4:26 pm    Post subject: Re: How to Enter values in to the file
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us