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

What's wrong with my program?


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

New User


Joined: 28 Nov 2005
Posts: 14
Location: Shanghai China

PostPosted: Tue Nov 29, 2005 7:11 pm
Reply with quote

the system tells me:

No "SELECT" statement was specified for file "MYPS-FILE"
definition was discarded.

IGYPS2121-S "WS-PS-EOF" was not defined as a data-name.
An error was found in the definition of file "MYPS-FILE"
to this file was discarded.

that's my error, but I have defined MYPS-FILE.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Tue Nov 29, 2005 7:27 pm
Reply with quote

not sure to find the errors in your program unless we see it.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Nov 29, 2005 7:29 pm
Reply with quote

Quote:
that's my error,but i have defined MYPS-FILE.


Then better you also post your code....

Regards,

Priyesh.
Back to top
View user's profile Send private message
chenxuehua

New User


Joined: 28 Nov 2005
Posts: 14
Location: Shanghai China

PostPosted: Wed Nov 30, 2005 5:24 pm
Reply with quote

ok that's my program
Code:

ENVIRONMENT DIVISION.
      *
      * OPTIONAL SECTION
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
          SELECT  MYSORT-FILE
               ASSIGN TO MYSORT. 
           SELECT  MYPS-FILE
               ASSIGN TO MYPS                                           FORM
               ORGANIZATION IS SEQUENTIAL
               ACCESS MODE IS SEQUENTIAL
               FILE STATUS WS-FILE-STATUS.
       DATA DIVISION.
       FILE SECTION.
       SD  MYSORT-FILE
           RECORD CONTAINS 80 CHARACTERS
           LABEL RECORDS IS MYSORT-DATA.   
       01  MYSORT-DATA.
           03  MY-SORT-KEY             PIC X(04).
           03  MY-SORT-TEXT            PIC X(76).
       FD  MYPS-FILE
           RECORD CONTAINS 80 CHARACTERS
           LABEL RECORDS ARE STANDARD.
       01  MYPS-DATA.
           03  MY-PS-KEY             PIC X(04).
           03  MY-PS-TEXT            PIC X(76).

WORKING-STORAGE SECTION.
       01  WS-MYWORKING-AREA.
           03  WS-FILE-STATUS.                                          SX12011
               05  WS-VSAM-STATUS    PIC XX.                            SX12011
                   88  WS-VSAM-FILE-EOF          VALUE '10'.            SX12011
                   88  WS-VSAM-FILE-OK           VALUE '00'.            SX12011

       PROCEDURE DIVISION.

       AA000-MAIN            SECTION.                                 

  SORT-TESTING.

           SORT MYSORT-FILE
           ON ASCENDING KEY MY-SORT-KEY
           INPUT PROCEDURE 600-SORT3-INPUT
           OUTPUT PROCEDURE 700-SORT3-OUTPUT.

           IF SORT-RETURN IS NOT EQUAL TO 00
               DISPLAY 'SORT-RETURN = ' SORT-RETURN.

       600-SORT3-INPUT.

           PERFORM 500-OPEN-PS-FILE

           MOVE 'N'   TO WS-PS-STATUS

           PERFORM 501-PS-READ WITH TEST BEFORE UNTIL WS-PS-EOF

           CLOSE MYPS-FILE
           .
       700-SORT3-OUTPUT.
           MOVE 'N'   TO WS-SORT-STATUS
           PERFORM UNTIL WS-SORT-EOF
               RETURN MYSORT-FILE RECORD
                   AT END
                       MOVE 'Y'             TO WS-SORT-STATUS
               END-RETURN
               IF NOT WS-SORT-EOF
                   DISPLAY 'OUTPUT MY-SORT-KEY = ' MY-SORT-KEY
               END-IF
           END-PERFORM
           .
       500-OPEN-PS-FILE.
           OPEN I-O    MYPS-FILE

           DISPLAY ' OPEN PS FILE = ' WS-FILE-STATUS

           IF WS-FILE-STATUS NOT = '00'
               DISPLAY 'OPEN PS FILE ERROR '
               MOVE 48   TO RETURN-CODE
               STOP RUN
           END-IF.

       501-PS-READ.
           READ MYPS-FILE
           IF WS-FILE-STATUS NOT = '00'
               IF WS-FILE-STATUS  = '10'
                   SET WS-PS-EOF TO TRUE
               ELSE
                   DISPLAY 'READ PS FILE ERROR '
                   MOVE 49   TO RETURN-CODE
                   STOP RUN
               END-IF
           ELSE
      *        MOVE MYPS-DATA TO MYSORT-DATA
               RELEASE MYSORT-DATA FROM MYPS-DATA
               DISPLAY 'INPUT MYSORT-RECORD = ' MYSORT-DATA
           END-IF.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Nov 30, 2005 7:05 pm
Reply with quote

chenxuehua wrote:

IGYPS2121-S "WS-PS-EOF" was not defined as a data-name.

I'll agree with this error message. You don't have a definition for WS-PS-EOF in your WORKING-STORAGE.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Nov 30, 2005 9:45 pm
Reply with quote

I'm assuming that many of the problems with the code you supplied is due to the cut and paste into the example you supplied.

Many times, errors as you describe are caused from very simple editing mistakes. A misplaced period is a common problem, once this happens the compiler sometimes doesn?t interrupt following statements as you would expect.

I found the following were not defined in the code example:


"WS-PS-STATUS" WAS NOT DEFINED AS A DATA-NAME.
"WS-PS-EOF" WAS NOT DEFINED AS A DATA-NAME.
"WS-SORT-STATUS" WAS NOT DEFINED AS A DATA-NAME.
"WS-SORT-EOF" WAS NOT DEFINED AS A DATA-NAME.

When I compiled your program I did NOT get the message for the select statement. So either your example is not exactly what you compiled, or you may be using a different compiler. Or when I edited your code I inadvertently corrected the problem.

Let us know.

icon_smile.gif
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Nov 30, 2005 9:55 pm
Reply with quote

I got the same results as DavidatK here.
Back to top
View user's profile Send private message
chenxuehua

New User


Joined: 28 Nov 2005
Posts: 14
Location: Shanghai China

PostPosted: Fri Dec 02, 2005 7:10 am
Reply with quote

thank you! I'm a new learner,here.
Back to top
View user's profile Send private message
chenxuehua

New User


Joined: 28 Nov 2005
Posts: 14
Location: Shanghai China

PostPosted: Fri Dec 02, 2005 7:16 am
Reply with quote

let me try again
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 Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top