INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

quick question. XOR in RM/Cobol.

quick question. XOR in RM/Cobol.

(OP)
Hello,

I work with RM/Cobol 7.03 and RM/Cobol 11, according to some sources i've checked it's not possible to do a "XOR" expression in cobol.

Hopefully one one you guys can help me with this. BTW sorry for my broken english, this is not my mother language.


I need to calculate an LCR(Hexadecimal) in Cobol.

ex. I need to take this string "01,50,1,T0501,78174,0,0,11,0,1,"

then do (0 XOR 1) = RES, do (RES XOR 1) = RES2, do (RES2 XOR ,) and continue for every character of the given string(commas included). The final result sould be an Hexadecimal value. According to the string source the result should be a "59".

Thanks in advance.

David L.



RE: quick question. XOR in RM/Cobol.

XOR can be expressed in terms of logical disjunction, conjunction, and negation (for example see here). You have those available in the subprogram library (C$LogicalAnd, etc); see the RM/COBOL User's Guide for more information.

Another way is to create a table of XOR results, and use the binary value of the bytes to do a lookup. See thread209-571499: CRC in COBOL where I demonstarte this technique.

Tom Morrison
Hill Country Software

RE: quick question. XOR in RM/Cobol.

(OP)
Thank you very much,

Found the subprogram library for the XOR in the RM/guide and Works great. Now i feel bad for not searching first on the user guide. Amazingly not a single article, fórum, post i read mentioned this.

Thanks again for the quick reply.

David Lopez.

RE: quick question. XOR in RM/Cobol.

David, welcome to Tek-Tips.

Bit-wise boolean operations are/were not common in COBOL. So, proprietary solutions are created by the COBOL vendors prior to the standardization of bit data types and boolean operations in 2002. In RM/COBOL (which is built on the 1985 standard) we chose to use CALL rather than extend the COBOL language.

Tom Morrison
Consultant

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close