#875 REX0372E: Error 40.1: External routine "SYSSTEMINSERT" fail

Rick McGuire
Bob Martin

The following program:

!/usr/bin/env rexx

RCDS.0 = 0
call SysStemInsert 'RCDS.',1,'line 1'
call SysStemInsert 'RCDS.',2,'line 2'

fails with:
5 - call SysStemInsert 'RCDS.',2,'line 2'
REX0040E: Error 40: Incorrect call to routine
REX0372E: Error 40.1: External routine "SYSSTEMINSERT" failed

Using ooRexx-4.0.0.x86_64.deb on Ubuntu 9.10 on an AMD 64x2
Program works as expected on 32-bit system.


  • David Ashley
    David Ashley

    I can confirm this fails on Fedora 12 x86_64 as well. I looked at the code and cannot see a reason for the bad return on first glance. Guess it will have to be debugged.

  • Rick McGuire
    Rick McGuire

    I spotted the problem, and Windows is likely to have the same problem with SysStemSort. The issue is using sscanf to convert the arguments to size_t values. On 64-bit platorms, the %u pattern only parses off an int value, which is 32-bit. This results in only half of the target value getting filled in properly. I'm working on fixes for this.

  • David Ashley
    David Ashley

    OK, I think I see the problem. It has to do with the sscanf function calls in the Rexx external function. The position variables are specified as size_t for the stem and the sscanf function uses "%u" as the format for scanning. This works great for 32 bit where int and long are the same size (or on Windows 64 bit where they remain the same size). But on *nix 64 bit systems this is not correct. The format specifier needs to be "%lu" because size_t is a 64 bit value.

    Rick, Mark - can you confirm this?



Cancel   Add attachments