MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to avoid S0C7 in comp fields ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Thu Jul 24, 2014 8:09 am    Post subject: How to avoid S0C7 in comp fields ? Reply with quote

Hi
How to avoid s0c7 in comp fields since we cant do numeric check
Scenario:
suppose i have a LA-B in a file which is s9() comp
I read a record & have the following code
MOVE LA-B to WS-LA-B
The above move will fail if LA-B has some junk
So what to do
Thanks
deepa
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Jul 24, 2014 8:16 am    Post subject: Reply with quote

What prevents you from checking for numeric?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Thu Jul 24, 2014 9:49 am    Post subject: Reply with quote

COMP fields are binary fields. The MOVE will not fail.
Back to top
View user's profile Send private message
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Thu Jul 24, 2014 11:47 pm    Post subject: Reply with quote

Hi
Numeric check can be made only for X(5) sort of fields Not not COMP fields
Actually compiler will give error
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Fri Jul 25, 2014 1:10 am    Post subject: Reply with quote

For NUMERIC you can check PIC X(n) fields (if the field is not too long), PIC 9(n) USAGE DISPLAY, USAGE COMP-3, USAGE PACKED-DECIMAL.

USAGE COMP, COMP-1, COMP-2, COMP-4, COMP-5, BINARY cannot be checked for NUMERIC simply because all bits may be relevant to the result, there is no "junk", there are no non-NUMERIC values (there are incorrect values, but unfortunately we can't test for that).
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Fri Jul 25, 2014 9:17 am    Post subject: Reply with quote

Thanks, William. Sorry for the misleading answer, deepa12. Since all values are valid for COMP fields, one option would be to check for a valid numeric range, right?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Jul 25, 2014 11:25 am    Post subject: Reply with quote

deepa12 wrote:
Hi
Numeric check can be made only for X(5) sort of fields Not not COMP fields
Actually compiler will give error


Deepa12,

You do realize that your COMP field can be redefined as alphanumeric field and you can use that field for NUMVAL function?

How about you show us the definitions of LA-B and WS-LA-B and the contents of the LA-B in hex that is causing the S0C7 abend? May be we can suggest an alternative.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Sat Jul 26, 2014 12:52 am    Post subject: re. how to avoid s0c7 in comp fields Reply with quote

Actually i tried the folln but i get U4038 abend

ws-a pic s9(9)comp.
ws-b redefines ws-a pic x(4)
ws-c pic 9(9)
move 1234 to ws-a
compute ws-c= function numval(ws-x)

The requirement is i have to avoid soc7 in a comp field binary if it contains junk
LA-B S9(4)V9(4) COMP
WS-B S9(4)V9(4).
MOVE LA-B TO WS-B
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sat Jul 26, 2014 1:54 am    Post subject: Reply with quote

The requirement itself is junk.

There are no junk values in a binary field. Depending on how your field is defined, you will always get 0-maximum-picture or 0-maximum-binary value for an unsigned field, for a signed field your range will include negatives.

S0C7 only comes from one of the six decimal machine instructions. It is impossible that a decimal machine instruction will be used directly on a binary field, so impossible, impossible, can't be done, to get a S0C7 on a binary field.

NUMVAL will only work with "chjaracter" data. If you give it actual binary data, it will give you that abend.

Why use decimal places in a binary field?
Back to top
View user's profile Send private message
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Sat Jul 26, 2014 6:27 am    Post subject: Reply with quote

Thanks for this
Could you pls elaborate
on what are the six decimal machine instructions. Not clear about this

I dont know why thre record structure has been defined with virtual decimal in comp field
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sat Jul 26, 2014 6:55 am    Post subject: Reply with quote

You locate the Principles of Operation You search there. One is an Add Packed (AP). I think they are all dealt with together. There may be seven... let us know.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Jul 26, 2014 9:47 pm    Post subject: Re: re. how to avoid s0c7 in comp fields Reply with quote

deepa12 wrote:
The requirement is i have to avoid soc7 in a comp field binary if it contains junk


Deepa12,

You haven't even show what the JUNK is. The MOVE statement will NOT cause an S0C7 . So there is something else that you are not disclosing.

Can you show us what the JUNK value looks like in HEX?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Sat Jul 26, 2014 11:40 pm    Post subject: Reply with quote

actually am an offshore developer It was suggested that we need to avoid s0c7 in this comp field
Am not having a real time scenario for this. i tried various combinations of non numeric value in WS-B E.g. ":,'%" , etc in all these combinations finally since its all in bits of 0,1 the subsequent instructions like add 1 to WS-A also works fine. So i think it wouldnt happen in live
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sun Jul 27, 2014 2:36 am    Post subject: Reply with quote

Well, I can 100% guarantee no S0C7.

If the analyst is so keen on this field, you could do the range-checking suggested by Terry. If there is no upper limit for the field, you could set your own as 9999.9999 and do something if the value is greater than that.

However, if using compiler option TRUNC(STD) this would be pointless as it would never find anything. If using compiler option TRUNC(OPT) it would be pointless unless someone is doing some "clever" coding with the filed (using REDEFINES, explicitly or imploicitly).
Back to top
View user's profile Send private message
deepa12
Beginner


Joined: 05 Apr 2005
Posts: 131
Topics: 64
Location: chennai

PostPosted: Sun Jul 27, 2014 7:21 pm    Post subject: Reply with quote

thanks
_________________
deepa
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group