[comp.os.vms] callable sort

warnock@prism.clemson.EDU ("Todd Warnock") (05/21/87)

According to the manuals, this should work.  It doesn't !  Can anyone offer
clues as to why ?    Much thanks as usual !

Todd Warnock
VAX Systems
Clemson University
Clemson, South Carolina 29634-2803

ARPA:	Warnock@Prism.Clemson.EDU
BITnet:	Warnock@Clemson
CSnet:	Warnock@Clemson.CSnet

------------------------- fortran sort program follows ------------------------
	program sort

	character*7	before(10)
	character*7	after(10)
	character*1	return_rec
	integer		key(5)
	integer		status
	integer		lrl /7/
	integer		sor$begin_sort
	integer		sor$release_rec
	integer		sor$sort_merge
	integer		sor$return_rec
	integer		sor$end_sort

	external	dsc$k_dtype_t

	key(1) = 1
	key(2) = %loc(dsc$k_dtype_t)
	key(3) = 1
	key(4) = 0
	key(5) = 1

	before(1) =  'ARECORD'
	before(2) =  'FRECORD'
	before(3) =  'ERECORD'
	before(4) =  'CRECORD'
	before(5) =  'HRECORD'
	before(6) =  'DRECORD'
	before(7) =  'GRECORD'
	before(8) =  'BRECORD'
	before(9) =  'JRECORD'
	before(10) = 'IRECORD'

c begin sort

	status = sor$begin_sort(keybuf,lrl)
	if (.not.status) call sys$exit(%val(status))

c release records to sort

	do 10, i=1,10
		status = sor$release_rec(before(i))
		if (.not.status) call sys$exit(%val(status))
10	continue

c sort/merge

	status = sor$sort_merge()
	if (.not.status) call sys$exit(%val(status))

c return records 

	do 20, i=1,10
		status = sor$return_rec(after(i),len)
		if (.not.status) call sys$exit(%val(status))
		type*,after(i)
20	continue

c end sort

	status = sor$end_sort()
	if (.not.status) call sys$exit(%val(status))

	end

------------------------- end of fortran sort ----------------------------------
------

MCGUIRE@GRIN2.BITNET (05/22/87)

> Date:         21 May 87 13:41:00 EDT
> From:         Todd Warnock <WARNOCK@PRISM.CLEMSON.EDU>
> Subject:      callable sort
>
> According to the manuals, this should work.  It doesn't !  Can anyone offer
> clues as to why ?    Much thanks as usual !
>
> [program example calling SOR$ routines follows]

What's the error?  Compile time message?  Link time message?  Run time
message?  Incorrect results?  Poor performance?

Much as I'd like to have the time to try to reproduce your problem starting
from the source, I don't.  If you include the exact symptoms of your
problem in another posting, someone may be able to determine the cause of
the problem without wasting time getting to the same point where you are
right now.  Looking forward to hearing from you again!

Ed <MCGUIRE@GRIN2.BITNET>

rankin@EQL.Caltech.EDU (Pat Rankin) (05/22/87)

> According to the manuals, this should work.  It doesn't !  Can anyone offer
> clues as to why ?    Much thanks as usual !

>       integer		key(5)
> ...
>       status = sor$begin_sort(keybuf,lrl)

      There are two different problems.  The first is easy:
  you've used two different variables by not spelling the key buffer
  name consistently.  Try adding "IMPLICIT NONE"  to your code or
  compiling with "/WARN=DECLARATIONS".
      The second problem is more subtle: the key buffer argument must
  be an array of words, so you need to declare it "INTEGER *2".

                                    Pat Rankin