View previous topic :: View next topic
|
Author |
Message |
sh_moni Currently Banned New User
Joined: 30 Apr 2007 Posts: 7 Location: pune
|
|
|
|
hi,
i am running a sort program in COBOL but in compiler i am getting a message:
SORT SORT-FILE ON ASCENDING KEY W-STUDENTENTENTID
USING STUDENT
GIVING FRESULT.
File "STUDENT" in the "USING" phrase of the "SORT" statement was accepted as being eligibile for the FASTSRT compiler option.
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you post a message, the message number should be posted with it.
I believe what you received is only informational and not an error. |
|
Back to top |
|
|
sh_moni Currently Banned New User
Joined: 30 Apr 2007 Posts: 7 Location: pune
|
|
|
|
My cobol Code :
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGN17.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT STUDENT ASSIGN TO DD2.
SELECT SORT-FILE ASSIGN TO DD3.
SELECT FRESULT ASSIGN TO DD4.
DATA DIVISION.
FILE SECTION.
FD STUDENT
RECORDING MODE IS F
RECORD CONTAINS 80 CHARACTERS.
01 STUDENTDETAILS.
02 STUDENTID PIC 9(7).
02 STUDENTNAME.
03 SURNAME PIC X(8).
03 INITIALS PIC XX.
02 DATEOFBIRTH.
03 YOBIRTH PIC 9(4).
03 MOBIRTH PIC 9(2).
03 DOBIRTH PIC 9(2).
02 COURSECODE PIC X(2).
02 GRANT PIC 9(2).
02 GENDER PIC X.
02 PIC X(50).
SD SORT-FILE.
01 SORT-DETAILS.
02 W-STUDENTID PIC 9(7).
02 PIC X(73).
FD FRESULT
RECORDING MODE IS F
RECORD CONTAINS 80 CHARACTERS.
01 FINALDETAILS.
02 F-STUDENTID PIC 9(7).
02 PIC X(73).
01 WS-WORK-AREAS.
05 ARE-THERE-MORE-RECORDS PIC X(3) VALUE 'YES'.
PROCEDURE DIVISION.
BEGIN.
OPEN INPUT STUDENT.
OPEN OUTPUT FRESULT.
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ STUDENT
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM SORT-OF-FILES
END-READ
END-PERFORM.
CLOSE STUDENT.
CLOSE FRESULT.
STOP RUN.
SORT-OF-FILES.
MOVE STUDENTDETAILS TO SORT-DETAILS
SORT SORT-FILE ON ASCENDING KEY W-STUDENTID
USING STUDENT
GIVING FRESULT. |
The error message I am getting For This is as below.
A logic error occurred. Neither FILE STATUS nor a declarative was specified for at relative location X'071A'. The status code was 41.
From compile unit ASSIGN17 at entry point ASSIGN17 at compile unit offset +00000 at address 09300BFA.
What i understand is the program is failing at the SORT step that's why it is giving file status 41 when next time i am trying to run the program.But can somebody enlighten me about the Logic error as i dont find anything wrong in the code. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you post an error, please post your jcl and the diagnostic info for the compile and the run - do not type them into the post, copy/paste them.
This problem is caused by trying to use files in the sort that are already open. You cannot name files in SORT that are already in use in the code elsewhere. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
FS 41 is opening a file already open. With the sort using, you should not open the file, sort will do it.
Try it this way:
Code: |
BEGIN.
SORT SORT-FILE ON ASCENDING KEY W-STUDENTID
USING STUDENT
GIVING FRESULT.
STOP RUN. |
By the way, since you are doing nothing to the records, why COBOL, why not just sort utility? |
|
Back to top |
|
|
sh_moni Currently Banned New User
Joined: 30 Apr 2007 Posts: 7 Location: pune
|
|
|
|
Many thanks William.
Sorry Dick I am quite new both to mainframes and this forum so please ignore my faults. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Manoj,
Not to worry - we're here to help with both the mainframe and the forum:) |
|
Back to top |
|
|
|