Bit Twiddling in IBM (LE) COBOL 
Author Message
 Bit Twiddling in IBM (LE) COBOL

Every once in a while, there is a question in IBM-MAIN and/or
comp.lang.cobol about how to do "bit twiddling" in COBOL.  If you are
interested in an article - with examples - of how to do this in IBM COBOL
(using LE callable services), then you may want to see the (not very new)
article at:

  http://www.*-*-*.com/

This article DOES require that you have these LE callable services
available - which (the last time I checked) included Micro Focus COBOL - but
did NOT include IBM VisualAge COBOL.  However, my information MAY WELL be
out-of-date on both of those (i.e, it may be available in VisualAge COBOL -
but not Micro Focus COBOL). I do NOT know about any of the other PC or Unix
compilers that include many "IBM extensions" (e.g. CA-Realia, Fujitsu,
PerCOBOL, etc)

NOTE: I am aware that there are ways of "tricking" the compiler and
run-times and doing much of this with "binary" fields and arithmetic - but I
believe that these techniques are "more self documenting".

--
Bill Klein
 wmklein <at> ix.netcom.com



Wed, 10 Mar 2004 14:21:58 GMT  
 Bit Twiddling in IBM (LE) COBOL
Hi Bill,

        Thanks for pointing these out. However, the compiler generates a
"BALR" when accessing <ANY> LE callable-service routine, which is rather
high overhead in my opinion.

        Much of my 30+ year career has been related to writing CICS-based
network-oriented banking-systems in COBOL, ASSEMBLER and PL/I, which must
get down to the bit-level and be VERY fast, as the number of transactions a
second can be in the hundreds.

        I just wanted to point out that although these routines are much
more self-documenting, it's apparent that many of today's techies are not
that well versed in the area of collating sequences. Hence, the reason we
always get many bit-manipulation and conversion-related questions on C.L.C.
For IBM-Mainframers, I still advocate a basic knowledge of ASSEMBLER,
because it can only improve your overall skillset.

        As all things have there place, these LE routines, should be used
with caution in a Mainframe environment, if speed is a critical issue. I
guess I'm just an old fat guy with old-time ideas, running on a 360/30.

        I think old crusty Jimmy from Calgary would agree ;o) (Just pickin
on ya Jimmy) !

Regards,

Bill O'Boyle



Quote:
> Every once in a while, there is a question in IBM-MAIN and/or
> comp.lang.cobol about how to do "bit twiddling" in COBOL.  If you are
> interested in an article - with examples - of how to do this in IBM COBOL
> (using LE callable services), then you may want to see the (not very new)
> article at:

>  http://www.esj.com/fullarticle.asp?ID=9130023120PM

> This article DOES require that you have these LE callable services
> available - which (the last time I checked) included Micro Focus COBOL -
but
> did NOT include IBM VisualAge COBOL.  However, my information MAY WELL be
> out-of-date on both of those (i.e, it may be available in VisualAge
COBOL -
> but not Micro Focus COBOL). I do NOT know about any of the other PC or
Unix
> compilers that include many "IBM extensions" (e.g. CA-Realia, Fujitsu,
> PerCOBOL, etc)

> NOTE: I am aware that there are ways of "tricking" the compiler and
> run-times and doing much of this with "binary" fields and arithmetic - but
I
> believe that these techniques are "more self documenting".

> --
> Bill Klein
>  wmklein <at> ix.netcom.com



Thu, 11 Mar 2004 07:37:54 GMT  
 Bit Twiddling in IBM (LE) COBOL

Quote:

> Hi Bill,

>         Thanks for pointing these out. However, the compiler generates a
> "BALR" <snip>
>         As all things have there place, these LE routines, should be used
> with caution in a Mainframe environment, if speed is a critical issue. I
> guess I'm just an old fat guy with old-time ideas, running on a 360/30.

>         I think old crusty Jimmy from Calgary would agree ;o) (Just pickin
> on ya Jimmy) !

You cheeky ex-Irish expatriate Boyle, (notice I dropped the magic "O"). "Frisky"
I might have taken as a compliment but "crusty",  God I hope not. Bill K. you're
the only one who has met me - true or false <G>

Bill O'B - I found your comments about bit-twtddling for mainframes interesting,
I've designed for them but never programmed for them. Seeing that COBOL was
'supposed' to be self contained to help you avoid using the underlying 'magic' -
what's missing from COBOL that doesn't allow you to bit twiddle. I've never had
occasion to use it, but I sure many of the PC compilers do accommodate bit
twtddling.

PS: I'm NOT FAT - I've actually slimmed with age <G>.

Jimmy



Thu, 11 Mar 2004 11:05:02 GMT  
 Bit Twiddling in IBM (LE) COBOL
The draft Standard includes MUCH better data definitions and Boolean
operators to handle all of this (than what IBM currently provides).  My
hope/assumption is that any environment that implements them will do so with
"performance" in mind.  However, until these become available, this was
simply an "option" that I wanted to point out.   I agree that if performance
is of concern, you SHOULD check out your "list" (Assembler-type) generated
code.  I am not positive, but I *believe* that IBM does "in-line" some when
handled with CALL "literal" (they can't for CALL identifier).

--
Bill Klein
 wmklein <at> ix.netcom.com

Quote:
> Hi Bill,

>         Thanks for pointing these out. However, the compiler generates a
> "BALR" when accessing <ANY> LE callable-service routine, which is rather
> high overhead in my opinion.

>         Much of my 30+ year career has been related to writing CICS-based
> network-oriented banking-systems in COBOL, ASSEMBLER and PL/I, which must
> get down to the bit-level and be VERY fast, as the number of transactions
a
> second can be in the hundreds.

>         I just wanted to point out that although these routines are much
> more self-documenting, it's apparent that many of today's techies are not
> that well versed in the area of collating sequences. Hence, the reason we
> always get many bit-manipulation and conversion-related questions on
C.L.C.
> For IBM-Mainframers, I still advocate a basic knowledge of ASSEMBLER,
> because it can only improve your overall skillset.

>         As all things have there place, these LE routines, should be used
> with caution in a Mainframe environment, if speed is a critical issue. I
> guess I'm just an old fat guy with old-time ideas, running on a 360/30.

>         I think old crusty Jimmy from Calgary would agree ;o) (Just pickin
> on ya Jimmy) !

> Regards,

> Bill O'Boyle



> > Every once in a while, there is a question in IBM-MAIN and/or
> > comp.lang.cobol about how to do "bit twiddling" in COBOL.  If you are
> > interested in an article - with examples - of how to do this in IBM
COBOL
> > (using LE callable services), then you may want to see the (not very
new)
> > article at:

> >  http://www.esj.com/fullarticle.asp?ID=9130023120PM

> > This article DOES require that you have these LE callable services
> > available - which (the last time I checked) included Micro Focus COBOL -
> but
> > did NOT include IBM VisualAge COBOL.  However, my information MAY WELL
be
> > out-of-date on both of those (i.e, it may be available in VisualAge
> COBOL -
> > but not Micro Focus COBOL). I do NOT know about any of the other PC or
> Unix
> > compilers that include many "IBM extensions" (e.g. CA-Realia, Fujitsu,
> > PerCOBOL, etc)

> > NOTE: I am aware that there are ways of "tricking" the compiler and
> > run-times and doing much of this with "binary" fields and arithmetic -
but
> I
> > believe that these techniques are "more self documenting".

> > --
> > Bill Klein
> >  wmklein <at> ix.netcom.com



Thu, 11 Mar 2004 11:41:09 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. LE 1.8 wierd COBOL abend dump-longish ( x-posted to IBM-MAIN and COBOL )

2. Twiddle binary bit in Cobol?

3. Environmental Variables in LE COBOL on an IBM mainframe

4. IBM COBOL LE CICS PROGRAMMER

5. IBM COBOL under LE - Performance Info

6. Compiling COBOL in VM, IBM LE

7. Bit Twiddling??

8. Bit twiddling on Parallel port

9. UUDECODE - Bit-twiddling in Arexx

10. SIMD-like bit-twiddling on odd-sized quantities

11. New Mathematical bit-twiddle - stage on of a isPerfectSquare()

12. Crazy bit-twiddle algorithms needed!

 

 
Powered by phpBB® Forum Software