Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 2502
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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts CICS transaction slow response time vasanthz All Other Mainframe Topics 3 Thu Jan 19, 2017 1:31 am
No new posts DD DUMMY & CPU TIME Nileshkul Testing & Performance analysis 16 Mon Dec 19, 2016 11:35 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us