when I compared assembly listing in both cases, there is a difference in two cases! ( Please note that I havent changed anything in SORT statement ) For your reference listing is given below,
Without DISPLAY stmt-
Code:
L 2,296(0,9) BL=1
2010 XC 16(2,2),16(2) SORT-RETURN
NI 85(9),X'FB' TGTFIXD+85
L 3,92(0,9) TGTFIXD+92
L 15,496(0,3) V(IGZESMG )
LA 1,607(0,8) PGMLIT AT +591
BALR 14,15
A0E8 MVC 240(4,10),232(10) PSV=1
LA 4,362(0,11) GN=8(00053A)
ST 4,232(0,10) PVN=3
BC 15,476(0,11) RELEASE-PARA
GN=8 EQU *
A0F0 MVC 232(4,10),240(10) PVN=3
L 2,92(0,9) TGTFIXD+92
L 15,496(0,2) V(IGZESMG )
LA 1,606(0,8) PGMLIT AT +590
BALR 14,15
A0EC MVC 244(4,10),236(10) PSV=2
L 11,40(0,12) PBL=1
LA 3,404(0,11) GN=9(000564)
ST 3,236(0,10) PVN=4
BC 15,602(0,11) RETURN-PARA
GN=9 EQU *
A0F4 MVC 236(4,10),244(10) PVN=4
L 2,92(0,9) TGTFIXD+92
L 15,496(0,2) V(IGZESMG )
LA 1,605(0,8) PGMLIT AT +589
BALR 14,15
GN=24 EQU *
With DISPLAY before SORT-
Code:
L 3,296(0,9) BL=1
3010 XC 16(2,3),16(3) SORT-RETURN
NI 85(9),X'FB' TGTFIXD+85
L 15,496(0,2) V(IGZESMG )
LA 1,621(0,8) PGMLIT AT +605
BALR 14,15
A0E8 MVC 240(4,10),232(10) PSV=1
LA 4,372(0,11) GN=8(000560)
ST 4,232(0,10) PVN=3
BC 15,486(0,11) RELEASE-PARA
GN=8 EQU *
A0F0 MVC 232(4,10),240(10) PVN=3
L 2,92(0,9) TGTFIXD+92
L 15,496(0,2) V(IGZESMG )
LA 1,620(0,8) PGMLIT AT +604
BALR 14,15
A0EC MVC 244(4,10),236(10) PSV=2
L 11,40(0,12) PBL=1
LA 3,414(0,11) GN=9(00058A)
ST 3,236(0,10) PVN=4
BC 15,612(0,11) RETURN-PARA
GN=9 EQU *
A0F4 MVC 236(4,10),244(10) PVN=4
L 2,92(0,9) TGTFIXD+92
L 15,496(0,2) V(IGZESMG )
LA 1,619(0,8) PGMLIT AT +603
BALR 14,15
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Sounds like there may be a bit more to your situation. . .
I just looked at a few programs and other than a SECTION or a para-name, SORT is the first cobol statement after the PROCEDURE DIVISION statement and they all work successfully. In the one-time programs, there is no reference to SORT-RETURN and i get no warning nor an error.
You might try inserting a "dummy" paragraph between PROCEDURE DIVISION and SORT just to see if it makes a difference.
Dick,
I tried with a para-name and founf no change in the results. Without display statement I am still getting unsorted o/p and when I add Display I get sorted o/p.
I don't know assembler, can somebody justify the two set of code generated for same SORT statement? (Listed above)
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
The way I always did it was:
SORT SORT-FILE ON ASCENDING KEY ELEMENT
input procedure is 1000-sort-input thru 1999-exit
output procedure is 2000-sort-output thru 2999-exit
if sort-return is not zero - abend
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hi Abhijit,
Please post the JCL from this step and the SORT statement including 20 or so lines before and after the SORT statement.
The assembler shown is the rather awful generated stuff - not meant to be worked with for the most part. . . . If you still have it available, including the addresses that should be beside the instructions in the assembler code may be helpful.
Seeing the sort source and surrounding code may help with understanding why different registers were used in the 2 versions.