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
No new posts How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need to identify top 10 costly or tim... ashek15 DB2 4 Wed Feb 14, 2018 3:20 am
No new posts Logic to skip Maximum time-stamp and ... vickey_dw DB2 2 Thu Feb 01, 2018 11:15 pm
No new posts Query to skip Max time-stamp and fetc... vickey_dw DB2 8 Sun Jan 28, 2018 1:09 am

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