Recommendation regarding INSPECT

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
jeroc
Member
Posts: 17
Joined: Mon Dec 03, 2007 8:14 pm

Recommendation regarding INSPECT

Post by jeroc » Mon Dec 17, 2012 2:46 pm

Hello,

I heard there were some some INSPECT constructs that were not recommended but I do not know which ones. Could you tell me if it is true and then, why? Thanks in advance.

Regards,

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Dec 17, 2012 3:34 pm

You going through all verbs one at a time?

Try it out yourself. On the web, often what you'll get is faith-in-own-opinion, which you then have to check on anyway.

If the site where you work has specific standards for INSPECT, check on those first. If not, what would you base "recommended" on? Understandability? Performance? The answer will not always be down to the constructs themselves.

jeroc
Member
Posts: 17
Joined: Mon Dec 03, 2007 8:14 pm

Post by jeroc » Mon Dec 17, 2012 6:46 pm

It was about performance aspect. This is why I would like to know if someone has already heard recommendations related to performance regarding INSPECT.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Dec 17, 2012 9:24 pm

Well, if you go with people's answers generally, you'll probably get "INSPECT is slow". 1) This is not always true. 2) This does not always matter.

But, that is the answer you will tend to get: INSPECT is slow. Or you can look at the manual and see how many variants of INSPECT are possible then consider that anyone just blandly saying "INSPECT is slow" without distinguishing between different uses of it probably doesn't have a real clue about anything.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Dec 19, 2012 3:19 am

Consider what INSPECT can/does do.

Now consider the code you would need to write inline with COBOL to do the same thing(s).

Very little question (to me) that INSPECT will perform better than the inline code for anything complex.

Much of what one "hears" is opinion rather than verified fact.
Have a good one

chaat
Member
Posts: 20
Joined: Sun Apr 18, 2010 11:51 pm
Location: St. Cloud, Minnesota, USA

Post by chaat » Sun Dec 30, 2012 8:09 am

jeroc,

follow this link to the IBM Enterprise COBOL Version 4 Release 2
Performance Tuning manual. Then do a search on INSPECT.

http://www-01.ibm.com/support/docview.w ... wg27018287

I find that for character translations using INSPECT XXXX CONVERTING literal-1 TO literal-2 is more efficient in that it generates inline code rather than a call to a library routine.

Chuck H.
Chuck Haatvedt

email --> clastnameatcharterdotnet

(replace lastname, at, dot with appropriate
characters)

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sun Dec 30, 2012 2:57 pm

More efficient than what?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Dec 31, 2012 9:58 pm

Than the call to the library routine?

d

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Jan 01, 2013 5:18 am

OK, I originally felt Chuck' had missed off the bit about TOUPPER/TOLOWER.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others