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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 0 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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