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 Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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