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
 

 

SOC7 on Comp-3 move

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

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Sat Apr 10, 2010 12:52 am    Post subject: SOC7 on Comp-3 move
Reply with quote

Hi,

I am getting SOC7 Error on the below move.

Code:
01  IN-REC.                                       
    05 AMOUNT               PIC S9(15)V9(02) COMP-3.

01  OUT-REC.                                       
    05 AMOUNT1              PIC S9(15)V9(02) COMP-3.


Move IN-REC to OUT-REC.

is this move possible ??
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Apr 10, 2010 1:00 am    Post subject:
Reply with quote

Hello,

Moving alphanumeric data (the posted level 01s are group fields and so are alphanumeric) should not cause a s0c7. . .

Your problem is probably trying to use the numeric AMOUNT1 field after the move. What value is in AMOUNT and AMOUNT1 at the time of the abend?
Back to top
View user's profile Send private message
baljinders

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Sat Apr 10, 2010 1:27 am    Post subject:
Reply with quote

Sorry for the incorrect information in the earlier post.

Amount1 is a 05 level copybook field where as amount2 is a level 10 working storage field.

05 Amount1 PIC S9(15)V99 COMP-3.
10 Amount2 PIC S9(15)V99 COMP-3 VALUE 0.

The Amount1 field has zero in it.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Apr 10, 2010 1:33 am    Post subject:
Reply with quote

Are you still moving IN-REC to OUT-REC?
Are you moving Amount1 to Amount2?
Back to top
View user's profile Send private message
baljinders

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Sat Apr 10, 2010 1:38 am    Post subject:
Reply with quote

Amount 1 to amount 2
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Apr 10, 2010 1:44 am    Post subject:
Reply with quote

Packed decimal to packed decimal results in the assembler ZAP (zero and add packed) instruction which can generate a data exception, an S0C7.
Amount1 has non-numeric data in it.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Sat Apr 10, 2010 1:46 am    Post subject:
Reply with quote

Your code should be something along the lines of
Code:
IF  AMOUNT1 NUMERIC
    MOVE AMOUNT1 TO AMOUNT2
ELSE
    MOVE ZERO TO AMOUNT2
END-IF.
The level numbers for AMOUNT1 and AMOUNT2 do not matter.
The location (WORKING-STORAGE or FD) do not matter.
The value of AMOUNT2 before the MOVE statement does not matter.
The number of digits in AMOUNT1 and AMOUNT2 do not have to be the same -- their size doesn't matter.
The value of AMOUNT1 is the only thing that matters. If it is not a number AS COBOL DEFINES NUMBERS, your move may happen but using AMOUNT2 can cause a S0C7 abend. What things would not be considered numbers by COBOL? Plus sign, minus sign, decimal point, comma, spaces instead of zeroes -- basically anything except 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 (except for the last half byte where the sign is stored) will be invalid.
Back to top
View user's profile Send private message
baljinders

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Sat Apr 10, 2010 2:29 am    Post subject:
Reply with quote

Thanks Everyone,

I'll make the necessary changes and will get back with the results.
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 Apr 10, 2010 4:04 am    Post subject: Reply to: SOC7 on Comp-3 move
Reply with quote

Check your compile options and ensure NUMPROC(NOPFD) is set as opposed to NUMPROC(PFD).

PFD can cause great harm because, instead of a ZAP, an MVC is issued, because the field lengths are the same. You never get a S0C7 with an MVC.

Another little "nasty" is if AMOUNT2 were packed-neutral sign PIC 9 instead of packed-signed PIC S9, because unlike moving a signed-field to signed-field, where the compiler generates a ZAP (as Bill has said above), the compiler will generate an MVC followed by an "OI" of the last byte, to ensure an "F" sign-nibble. This is how a neutral signed AMOUNT2 could end up with a value of X'40404040404040404F', when AMOUNT1 contained all SPACES.

It's best to get the S0C7, because then you can find the bad data earlier than waiting until the excrement hits the fan.

Without the S0C7, you could move the bad data to a file and/or a DB and then, you've compounded the problem significantly.

Don't get me wrong, NUMPROC(PFD) does save cycles, but at what cost? All you need is one packed-field with bad data being propagated throughout the company enterprise and you'll be in more trouble than a squirrel on a six-lane highway. You'll spend much more time tracking down and fixing the problem, than the cost of the saved cycles.

Unless you're guaranteed (with 100% accuracy) that your packed-data will always pass the "smell" test, then I would stick with NUMPROC(NOPFD).

You'll be glad you did.... icon_wink.gif

Bill
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Apr 10, 2010 4:42 am    Post subject: Re: Reply to: SOC7 on Comp-3 move
Reply with quote

Bill O'Boyle wrote:
PFD can cause great harm because, instead of a ZAP, an MVC is issued, because the field lengths are the same. You never get a S0C7 with an MVC.
Thanks Bill, I'll try to remember that....grin....
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. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm


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