Performing a binary OR in COBOL with Pic X data -


There are several flags defined by me (by a header file out of my control) that looks like this:

  * * OPTVAL field for IPV6_ADDR_PREFERENCES_FLAGS * 01 IPv6-ADDR-favorite-flag PIC X (4). * * IPV6_ADDR_PREFERENCES_FLAGS mapping * 77 IPv6-Preefr-SRC-Home PIC X (4) VALUE X'0000000l '77 IPv6-Preefr-SRC-CoA PIC X (4) VALUE X'00000002' 77 IPv6-Preefr-SRC -timpi PIC X (4) VALUE X'00000004 '77 IPv6-Preefr-SRC-public PIC X (4) VALUE X'00000008' 77 IPv6-Preefr-SRC-CGA PIC X (4) VALUE X'000000l0 ' 77 IPv6-PEEPER-SRC-NONKAZI PIC X (4) VALUE X'00000020 ' 

I would like to see some of these flags binary or Need to Rshn, and I have a simple way of'm wondering if that is I do not know. Is there a simple keyword or syntax that considers my program as a binary value and lets me do my math, or is this header file completely broken?

I would have written this library poorly if you used a low-level library for the use of COBOL If you want to write, you should take the data type which is easy to manipulate in COBOL. In this case, a cocktail item representing a long-term (S 9 (9)) vibration will be easy to cope with COBOL.

Assuming you call these values ​​together To reduce the Livelihood, you can only combine them together to achieve flag values, because this works because there is a bit set in each constant.

Rearrange a temporary area You can either take advantage of the type of cobol or the lack of safety and can send them to a sub-program for operation. The following will work on VMS COBOL:

  Identification Department program ID.SAMPLEOR.Data division work-collection section * IPV6_ADDR_PREFERENCES_FLAGS * 01 IPv 6-ADDR-Favorite-FPS OPICAL field for PIC X (4). * * IPV6_ADDR_PREFERENCES_FLAGS Mapping * 77Ivv 6-Prefer-SRC-HomePIC X ( 4) VALUE X'0 0000001 "77 IPv6-Preefr-SRC-CoA PIC X (4) VALUE X'00000002 '77 IPv6-Preefr-SRC-TMP PIC X (4) VALUE X'00000004' 77 IPv6-Preefr-SRC-public PIC X (4) VALUE X'00000008 '77 IPv6-Preefr-SRC-CGA PIC X (4) VALUE X'00000010' 77 IPv6-Preefr-SRC-Nonkaji PIC X (4) VALUE X'00000020 'process Division 1 IPv6-Prefer-SRC-Home IPv6-Prefer-SRC-COA IPv6-ADDR-Preferences-Flags Abuse can call "Biniyriyr". Call "Banner" using IPv 6-Prefer-SRC-Public IPv6-ADDR-Prefence-Flags IPv6-ADDR-Preferences-Flags. If the IPv6-ADDR-favorite-flag not = X'0000000B 'DISPLAY "Failure" END- If the End Program Sampler Identification Division Program ID BINARYOR Data Division Work-Storage Section Link Section 01 ARG 1 PIC S 9 (9) Comp 01 ARG 2 PIC S 9 (9) Comp 01 Results Picture S9 (9) Component ARG 1 ARG 2 Precinct Division using the result 1. ARG1 To get results from ARG2 And program banner  

If this is not working, you will need to represent the binary item of your COBOL platform to do the right kinds of work.

I have reduced very few things (too many) in COBOL (many decades ago). Usually, you can work it out, but at some point it becomes difficult and worth the trouble No. At that point, it pays to call a language (such as C) which is better suited for the passing bits.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -