4 ms·
Please don't remind me. I had to convert the expat XML parser to compile on z/OS and work in EBCDIC, and found that round tripping between ASCII and EBCDIC was
by defined 9y ago
Please don't remind me. I had to convert the expat XML parser to compile on z/OS and work in EBCDIC, and found that round tripping between ASCII and EBCDIC was sometimes impossible because of the existence of not two, but THREE line terminator characters: CR, LF, and NL (0x85).
Not to mention that you cannot test for uppercase or lowercase like the ASCII `ch >= 'A' && ch <= 'Z'` because they are not contiguous in EBCDIC. A good reason to use the C RTL.
- osullivj 9y agoI did the same to enable XML messages to flow over MQ between an RS/6000 based front office FX options system, and a back office S/390 system. IIRC there were six (!!) different EBCDIC codepages that could be in play. I had a code generator that would crank out C or Java bindings that could martial between the expat results and the COBOL data structure. 20 years ago now!
- technofiend 9y agoNot sure if you remember but sendmail used to require a certain amount of m4 knowledge and hackery. Emboldened by that and reading the dragon book I was very impressed with myself when I wrote a COBOL parser in a mix of C, lex and YACC that automatically generated the needed 'C' structs and Sybase database layout to load data fed from a System/36. I made the data supplier put his code in the first part of the magtape, read and parsed that and then read the rest of the tape. These days I consider it more of a "what was I thinking" facepalm-worthy sort of thing but at the time I was very proud of it. The "what was I thinking" part is more about the fact that some poor bastard had to come along after me and support that mess.
- osullivj 9y agoLikewise: I regard code generation as a red flag these days. The version skew issues when code generated off slightly different versions of messages are in play can be really nasty. CORBA suffered from that issue big time in the late 90s. And if your generated code uses mutexes in a misguided attempt to be "thread safe", all bets are off...
- defined 9y agoOh yeah, I remember the code pages. Joy. I didn't want to bloat my comment, so thanks for mentioning this!
- avar 9y agoThis is how you can implement isUpper() on EBCDIC: https://github.com/Perl/perl5/blob/v5.24.0/handy.h#L1153 https://github.com/Perl/perl5/blob/v5.24.0/handy.h#L1153
- WorldMaker 9y agoIIRC, you should be able to do it easier than that: EBCDIC is not contiguous because upper-case versus lower-case is a (shift) bit-flag.
- SmellTheGlove 9y ago> Not to mention that you cannot test for uppercase or lowercase like the ASCII `ch >= 'A' && ch <= 'Z'` because they are not contiguous in EBCDIC. A good reason to use the C RTL. Watch your sorting methods, too. I had a guy over here once totally confused why running his SAS job on the mainframe yielded a different result than the same code running on PC SAS against the same data.