I am getting some odd results out of the C library function strcasecmp(). Does someone want to tell me if they see pilot error here?
(For anyone not familiar, strcasecmp() is documented as https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.bp xbd00/rsrccm.htm .) I have the following debug code running: printf("strcasecmp(\"%%\", \"*\") %d\n", strcasecmp("%", "*")); (Try to read past all of the escaping in the string. The string is effectively 'strcasecmp("%", "*")'. And here are the results: strcasecmp("%", "*") -37 4AA988A8899476764757546FF44 02393125347DFCFB0FCFD003700 It is saying that % (X'6C') is less than * (X'5C'). Why do I think it's ASCII rather than just a plain old bug? Because ultimately what I am doing is sorting a table. And here is the sort order I end up with: %, *, +, -, /, // That's wrong for EBCDIC but perfect for ASCII. Yes, it's running on z/OS. No, I'm not doing anything weird with LOCALE. Any ideas? Charles ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN