Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
CPU Time consuming more in Inspect

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Sat May 10, 2008 3:35 pm    Post subject: CPU Time consuming more in Inspect
Reply with quote

Code: -
Code:
INSPECT VARIABLE1 (1)                         
                                      REPLACING ALL         
                                       '0 AB   ' BY '0TH AB '
                                       '1 AB   ' BY '1ST AB '
                                       '2 AB   ' BY '2ND AB '
                                       '3 AB   ' BY '3RD AB '
                                       '4 AB   ' BY '4TH AB '
                                       '5 AB   ' BY '5TH AB '
                                       '6 AB   ' BY '6TH AB '
                                       '7 AB   ' BY '7TH AB '
                                       '8 AB   ' BY '8TH AB '
                                       '9 AB   ' BY '9TH AB '



The above code, Its consuming more CPU time so I want to reduce CPU time.

Please let me know how I will achieve this
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 10, 2008 8:32 pm    Post subject:
Reply with quote

Hi Vicky,

One thing you can do is move var (1) to wrk-var and inspect wrk-var. Some O'head is generated to calc the position of var (1). This approach is usually used when multiple operations are performed on a table entry. It may not save much compute time here, but may be worth a try.

BTW, the manual says that the subject and substitution fields must be the same length. I'm surprised you're not getting a compiler error, unless the spaces in your literals are not showing and they equalize the lengths.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat May 10, 2008 10:55 pm    Post subject:
Reply with quote

Vicky,

As Jack has said, move the variable to another WS area, but then, change your INSPECT REPLACING to INSPECT CONVERTING and issue the INSPECT CONVERTING 10 consecutive times, each time changing the FROM and TO literals.

This will generate 10 in-line "TR" (Translate) instructions (when the length of the variable is less than 257) and the overall CPU of these 10 Translate instructions will be less than the CPU generated by the method with which you're using currently.

INSPECT REPLACING will always cause COBOL to CALL (BALR) to a run-time routine and (IMHO) this is where your CPU overhead is occurring.

Try the INSPECT CONVERTING with literals and see if this reduces the CPU. I have a feeling that it will, even though you're issuing 10 INSPECT's, sometimes more is better. icon_wink.gif

Example:
Code:

03  WS-VARIABLE PIC  X(nnn).
*
MOVE VARIABLE (1) TO WS-VARIABLE.
INSPECT WS-VARIABLE CONVERTING '0 AB   ' TO '0TH AB '
INSPECT WS-VARIABLE CONVERTING '1 AB   ' TO '1ST AB '

Just add your INSPECT's for '3 AB' through '9 AB'.

To reemphasize, COBOL will resolve INSPECT CONVERTING with LITERALS to execute in-line, never leaving the program.

Note that if the target variable's length is greater than 256 but less than 1025, COBOL will issue up to four (4) "TR" instructions, each with a maximum length of 256, which is the maximum length for the first operand (in this case, WS-VARIABLE) of a single "TR" instruction. If the target variable's length exceeds 1024, then COBOL will unfortunately, BALR to a COBOL run-time routine and defeat the purpose of reducing CPU. If the target variable's length exceeds 1024, then carve the variable into individual 1024-byte chunks.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 5 Sat May 06, 2017 12:59 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us