COBOL INTERNAL SORT ERROR

145 pts.
Tags:
COBOL ERROR MESSAGE
Hello, I'm getting the following error on the 'OUTPUT' procedure of the internal sort,

'RETURN statement 2267 out of order'.

 Cause . . . . . : The RETURN statement was not expected by SORT/MERGE. Either a SORT/MERGE was not active or the statement was issued out of sequence. Message issued at statement 2267 of COBOL program 'IAHF910' in program object 'IAHF910' in library 'IAHFOBJ'.

 Recovery . . . : Remove the RETURN statement or place it in proper order.

I verified using STRDBG that the INPUT procedure is running and SORT records are being released.   

SORT SORT-FILE                                      ASCENDING KEY SREC-KEY                          INPUT PROCEDURE  P1000-DECLARE-TXN-SALE         OUTPUT PROCEDURE P2000-READ-SORT.          

The code appears to fine in the 'OUTPUT' procedure, and the return is in the correct place,

P2000-READ-SORT.                                                  RETURN SORT-FILE                                                AT END                                                               PERFORM P2100-UPDATE-SAVE-RECORD THRU P2199-EXIT              GO TO P2199-EXIT.                               

This code apparently ran fine on a Mainframe.  I'm on a project to convert all applications to the i.  Any help or suggestions would be appreciated.

Thank you



Software/Hardware used:
AS/400 iSeries version 6.1
ASKED: September 10, 2009  8:44 PM
UPDATED: September 17, 2009  7:47 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

It ran fine on the mainframe. Now you are converting it to the “i” but where is the program running? Is it still running on the mainframe? Or has the code been compiled and executed on some other platform and operating system?

You are getting this error during COMPILE; right?

IF you have taken the source code from the mainframe and copied to some other box and are trying to compile in a new environment, you need to ensure that you are following the rules for COBOL in this new environment. Not all COBOLs are the same. Each compiler has its own rules. Just like SQL for DB2 is different than SQL for Oracle. IBM COBOL on the mainframe is different from NetCOBOL for Windows. So check the syntax of this PC version of COBOL internal SORT.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Xtreme1
    The program has been imported to the i, and necessary changes have been made for the new environment. The program has compiled on the i, the error is occuring on execution. We have several programs with the the same 'internal sort' logic that are running fine on the i. It's very strange. IBM doesn't offer information as far as the error goes.
    145 pointsBadges:
    report
  • Meandyou
    Interesting. I assume that some changes to the source code were required when you moved it to the i. (By the way, what is "the i?") Is it possible the the RETURN is being executed out of sequence? A stray branch instruction, perhaps, is causing it to be executed before it should be (or executed twice)? Other than that, I don't know what to suggest.
    5,220 pointsBadges:
    report
  • Xtreme1
    After further investigation there were changes made to the source. I re-imported the original code and recompiled and there is no longer an issue. BTW, an i is the same as the iSeries or AS/400. I appreciate your input. Thanks.
    145 pointsBadges:
    report
  • Meandyou
    Hey, glad you found it.
    5,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following