Sorting a file using/giving, extsm.obj

In NX3.1 we had to link extsm.obj (in Build Settings>Link>Advanced) for this sort to work:

sort sort-file

on ascending key srt-endpoint

  srt-cl-amt

  srt-kb-amt 

using tmp-file

giving tmp-file.

 

In Visual COBOL, the sort blows up.  Do we need to add the extsm.obj into the settings somewhere or is there another answer?

Please and Thank You. 

  • There is no separate extsm.obj to link in when using the sort statement in Visual COBOL.

    I just tested this here and the sort worked fine in both native and managed code projects without adding anything.

    Can you please define what you mean by "the sort blows up"?

    What is the error message that you are receiving and are you using native code or managed code?

    Thanks.

  • The select and fd definitions are:

     

    SELECT SORT-FILE ASSIGN TO DYNAMIC LOCSRT

    ORGANIZATION SEQUENTIAL

    ACCESS IS SEQUENTIAL.

     

    SELECT TMP-FILE ASSIGN TO DYNAMIC LOCTMP

    ORGANIZATION LINE SEQUENTIAL

    ACCESS IS SEQUENTIAL.

     

    FD  TMP-FILE

    BLOCK CONTAINS 0 RECORDS

    RECORD CONTAINS 2056 CHARACTERS

    LABEL RECORD IS STANDARD.

    01  TMP-REC                    PIC X(2056).

     

    SD  SORT-FILE.

    01  SRT-REC.

    05  FILLER                  PIC X(01).

    05  SRT-CL-AMT         PIC 9(10)V99 COMP-3.

    05  SRT-ENDPOINT    PIC 9(08).

    05  FILLER                   PIC X(08).

    05  SRT-KB-AMT          PIC 9(10)V99 COMP-3.

    05  FILLER                    PIC X(2025).

     

    the error on the sort is:

  • Which Visual COBOL release are you using?

    Can you please open up a support incident for this issue as we will need to try to recreate it in-house using  a data file supplied by you.

    I have a hunch that the problem might have to do with specifying the input file as line sequential with COMP-3 data in it but I will not know until I can actually run the application against your data file.

    Thanks.

  • Verified Answer

    Customer opened support incident for this and the problem was determined to be caused by using SORT with USING/GIVING directly within a managed code object method.

    The problem has been fixed by development and the fix will be available in a future release of Visual COBOL.

    A workaround is to move the SORT statement to a procedural COBOL program and call this program from within the method instead of doing the SORT directly in the method.