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 know the return code of a particular Sort Statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
keerthi

New User


Joined: 23 Mar 2005
Posts: 25

PostPosted: Thu Nov 17, 2005 5:40 pm    Post subject: How to know the return code of a particular Sort Statement
Reply with quote

I am asked this question in IBM interview; please let me know the solution for this.

How can we know the return code of this particular Sort Statement? Here I want to know The Return code of the Sort Statement only. Can we get using INPUT PROCEDURE if yes How?

Sort file-1 on Ascending Key Using file-2 Giving file-3
Or
Sort file-1 on Ascending key INPUT PROCEDURE is section-1
OUTPUT PROCEDURE is section-2.

Thanks in advance,
Keerthi.
Back to top
View user's profile Send private message

khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Nov 21, 2005 5:27 pm    Post subject: Sort statement-Return Code
Reply with quote

hi frnd,
Can u explain Ur query in detail. bcz the return code depends on the input file also. since u had specified as for the particular Sort Statement!!! it will be 0 i think so. if the i/p or the o/p file structure differs then it will throw the RC according to that..
Back to top
View user's profile Send private message
sungang77

New User


Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

PostPosted: Tue Nov 22, 2005 7:37 am    Post subject:
Reply with quote

Hi~ I look up the IBM library book -- Enterprise COBOL for z/OS V3.4 Programming Guide. Hope it's helpful to you.
1.12.11 Determining whether the sort or merge was successful

The DFSORT program returns one of the following completion codes after a sort or merge has finished:

0 Successful completion of the sort or merge

16 Unsuccessful completion of the sort or merge


The completion code is stored in the SORT-RETURN special register. The contents of this register change after each SORT or MERGE statement is
performed.

You should test for successful completion after each SORT or MERGE statement. For example:

Code:

      SORT SORT-WORK-2
          ON ASCENDING KEY SORT-KEY
          INPUT PROCEDURE IS 600-SORT3-INPUT-PROC
          OUTPUT PROCEDURE IS 700-SORT3-OUTPUT-PROC.
      IF SORT-RETURN NOT=0
          DISPLAY "SORT ENDED ABNORMALLY. SORT-RETURN = " SORT-RETURN.
      . . .
  600-SORT3-INPUT-PROC SECTION.
      . . .
  700-SORT3-OUTPUT-PROC SECTION.
      . . .

If you do not reference SORT-RETURN anywhere in your program, the COBOL run time tests the return code. If the return code is 16, COBOL issues a
runtime diagnostic message.

If you test SORT-RETURN for one or more (but not necessarily all) SORT or MERGE statements, the COBOL run time does not check the return code.

By default, DFSORT diagnostic messages are sent to the SYSOUT data set. If you want to change this default, use the MSGDDN parameter of the
DFSORT OPTION control card or use the SORT-MESSAGE special register.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm


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