IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Inspect statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
spoorni

New User


Joined: 29 Nov 2007
Posts: 20
Location: india

PostPosted: Mon Jun 06, 2016 9:53 pm
Reply with quote

I am trying to use an inspect statement in a cobol program as follows:
INSPECT PBRO-BLAZE-REC REPLACING ALL LOW-VALUES BY '|'

The PBRO-BLAZE-REC has some S9(02) COMP-3 fields and they are getting replaced as well when i use this inspect statement. Is there any reason why? If yes, how can this be resolved?
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: Mon Jun 06, 2016 10:26 pm
Reply with quote

Yes, because an S9(02) COMP-3 field could contain X'00' in the first byte. As far as INSPECT is concerned, this is a legitimate target. It doesn't care about the PICTURE clause, it's an equal opportunity Verb. icon_lol.gif

HTH....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 06, 2016 10:28 pm
Reply with quote

Quote:
Is there any reason why? If yes, how can this be resolved?
If you don't know the internal representation for a COMP-3 variable, you need to read the Enterprise COBOL Programming Guide manual to find out - try page 53 of the version 6.1 manual. A PIC S9(02) COMP-3 variable will take TWO bytes and if the absolute value of the variable is less than 10, then the first byte will have a LOW-VALUE in it. As far as resolving the issue, you have multiple choices:
1. Do not use that INSPECT statement
2. Change the COMP-3 variables to USAGE DISPLAY
3. Modify the INSPECT to work on variables except the COMP-3 variables
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Tue Jun 07, 2016 7:05 pm
Reply with quote

Why would you want pipe in comp3 though?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2448
Location: Hampshire, UK

PostPosted: Tue Jun 07, 2016 8:38 pm
Reply with quote

Rohit,
He doesn't which is why he has a problem.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Tue Jun 07, 2016 9:43 pm
Reply with quote

Nic,
yes, I wanted TS to look Manuals on what data items the INSPECT would works. INSPECT is what TS did not read in the manuals before using it and Robert pointed the options already.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts SKIP LOCKED DATA in UPDATE statement DB2 9
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts CALL statement in COBOL for VSE COBOL Programming 3
No new posts ISPF skeleton that has IF/THEN/DO sta... TSO/ISPF 15
Search our Forums:

Back to Top