xor and xor_eq



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

xor and xor_eq

Postby zatlas1 » Fri Jul 13, 2012 4:41 pm

Hi all
I am compiling C (not C++) source code that contains ^ and ^=. The compiler does not like it and complains about it:

ERROR CBC3191 ZATLAS1.PCRE.SRCE(COMPILE8):1135 The character \xb0 is not a valid C source character.

I turned on the DIGRAPH option and used xor_eq which the compiler did not like either (besides this is only for C++). Could somebody please guide me on what should I do in prder to be able to use the legitimate operators ^ and ^= or alternatively, how to corretly use the digraphs in question

Thank you
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: xor and xor_eq

Postby Robert Sample » Fri Jul 13, 2012 4:58 pm

This could be a code page issue -- which code page are you editing in, and which code page does the C compiler use?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: xor and xor_eq

Postby zatlas1 » Fri Jul 13, 2012 5:36 pm

I am not sure exactly what code page is in the z/OS installation, however ^ (which is xor) should be EBCDIC x'b0' in code page 037. OTH, in 1047 it should be x'5F'... mmm, I will try to change the x'b0' to x'5f' and see what will happen. Will report tonight :)
Thanks
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: xor and xor_eq

Postby zatlas1 » Sun Jul 15, 2012 7:33 pm

Thank you.
Well, changing x'b0' to x'5f' did the trick although it looks like the codepage setup in wc3270 seems to be set correctly. I would assume that there is some compile option to deal with that. How do I tell the compiler which codepage to use?

ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: xor and xor_eq

Postby Robert Sample » Sun Jul 15, 2012 8:55 pm

Look at the LOCALE compiler option in the manual -- which you should have looked at first.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: xor and xor_eq

Postby zatlas1 » Mon Jul 16, 2012 3:39 am

I did not touch the thing for almost 20 years and at that time nobody really used USS, POSIX, etc. so I actually appreciate the fact that I, sorta, know what I am doing :) Please don't be that hard on me.
How do I find what codepage does my installation use (as a lowly consultant, the high priests of the system will walk through me as I was made of thin air :(
Which LOCALE should I use if the compiler with 'NOLOCALE' does not like the x'b0' but works fine with x'f5'?
Thanks
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: xor and xor_eq

Postby steve-myers » Mon Jul 16, 2012 4:05 am

One problem is most terminal emulators treat the ASCII ^ character as the EBCDIC ¬ character, which is in the same place on most real 3270 keyboards.

It seems to me no one bothered to look up the correct trigraph for the ^ character, which is ??', and is documented in XL C/C++ Language Reference for your z/OS release.

FWIW, I started this post with absolutely no knowledge what the trigraph was. I had to find it myself. It took me all of 5 minutes.

One problem I did have with this post was inserting the ¬ character into the post. The ¬ character is not on most PC type keyboards. I eventually got it by creating a text file on a mainframe with the ¬ character, and downloaded it as text data using the 3270 file transfer process. This translated the EBCDIC ¬ to the most common ASCII representation of the ¬ character, which I then copied and pasted into this post.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: xor and xor_eq

Postby zatlas1 » Mon Jul 16, 2012 4:59 am

I knew about digraphs but forgot about trigraphs. Thank you for the information.
I will offer several solutions and using the specific trigraph would be one of them.
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time


Return to C, C++