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

Internal sort not able to execute


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

New User


Joined: 07 Dec 2011
Posts: 26
Location: India

PostPosted: Mon Jan 23, 2012 5:10 pm
Reply with quote

Hello,
I am trying to execute a cobol program using internal sort . i am getting below error in spool. Please help me out to resolve this. I did not understand that do we really need to open input file in sort? Please suggest.


IGZ0035S There was an unsuccessful OPEN or CLOSE of file INFILE in program INTER at relative location X'04DA'.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 90.
From compile unit INTER at entry point INTER at compile unit offset +000004D8 at entry offset +000004D8 at
address 29900D50.


Thanks in advance,
Sravani
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 23, 2012 5:23 pm
Reply with quote

Is your sort statement SORT USING or SORT INPUT PROCEDURE? In either case, the input file must be opened, read, then closed for the sort to proceed. The only question is whether your code does it, or SORT does it.

Basic question for you: if sort does not open the input file, just how can it read the records to sort?
Back to top
View user's profile Send private message
sravz chinnu

New User


Joined: 07 Dec 2011
Posts: 26
Location: India

PostPosted: Mon Jan 23, 2012 5:27 pm
Reply with quote

Thanks alot for your reply.
This is what my sort statement in cobol program.
SORT SORT-FILE
ON ASCENDING KEY S-NAME S-SURNAME
ON DESCENDING S-EMP-DATE
USING UNSORTED-PERSON
GIVING SORTED-PERSON.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 23, 2012 5:33 pm
Reply with quote

You got a file error, you have no error handling. Find out what a status 90 might be, look for error messages in your job output.
Back to top
View user's profile Send private message
sravz chinnu

New User


Joined: 07 Dec 2011
Posts: 26
Location: India

PostPosted: Mon Jan 23, 2012 5:40 pm
Reply with quote

Robert,
Do we really need to open input file when we use SORT USING and Giving. As i never see open statement to this. Instead i saw open stament in sort using input procedure . Please correct me if i am wrong as i am fresher.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 23, 2012 5:49 pm
Reply with quote

SORT does the open -- your program does not -- when SORT USING is invoked. Similarly, SORT does the open of the output file when SORT GIVING is invoked. The mere fact that your code does not open the file does NOT mean the file is not opened. In order for SORT to process each record, that record must be read from the file on disk (or tape) into memory -- either by SORT or by your code.

A file status 90, however, I would expect to mean that your code is doing an explicit OPEN statement that is failing. You need to learn how to use file status codes (both the usual 2-byte code as well as the extended file status codes available for VSAM files) and include them in every program you write.
Back to top
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 121
Location: Puerto Rico

PostPosted: Mon Jan 23, 2012 8:04 pm
Reply with quote

Good day!

Check your log messages for clues to your problem, missing DD statement for the input or output. Verify your SD's in the program and like Robert mention you do need to open your sort files.
Back to top
View user's profile Send private message
sravz chinnu

New User


Joined: 07 Dec 2011
Posts: 26
Location: India

PostPosted: Tue Jan 24, 2012 9:25 am
Reply with quote

Thanks all.
I did not give any open statement in my program. still it is working and i got the final output which is sorted file.

Thanks,
Sravani icon_smile.gif
Back to top
View user's profile Send private message
Dexter Morgan

New User


Joined: 11 Jan 2012
Posts: 3
Location: United States

PostPosted: Tue Jan 24, 2012 7:35 pm
Reply with quote

Just to clarify:

Enterprise COBOL for z/OS Language Reference
Version 4 Release 2
SC23-8528-01

SORT USING
All input files must be described in FD entries in the data division.
At the time the SORT statement is executed, these files must not be open.
The compiler opens, reads, makes records available, and closes these files automatically. (From manual)

SORT GIVING
All output files must be described in FD entries in the data division.
At the time the SORT statement is executed, these files must not be open.
The compiler opens, writes, and closes these files automatically.
(SORT GIVING shortened and paraphrased from manual)

Your choice of USING/GIVING option may not be a good way of using internal SORT because you can just code SORT
JCL before your program on the input side or after creating file to sort on output side.
Back to top
View user's profile Send private message
sravz chinnu

New User


Joined: 07 Dec 2011
Posts: 26
Location: India

PostPosted: Tue Jan 24, 2012 8:39 pm
Reply with quote

Thanks alot MORGAN. I got clarification on this.

Sravani icon_biggrin.gif
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top