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

Interesting Numeric Move resulted in a S0C7


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

Active User


Joined: 05 Dec 2006
Posts: 171
Location: Seattle, WA

PostPosted: Fri Jun 29, 2007 3:43 am
Reply with quote

I am working on a project and had the following fields:

Code:
01  STATUS-DATE.
     05  STAT-DATE-MM          PIC 99.
     05  STAT-DATE-DD          PIC 99.
     05  STAT-DATE-YY          PIC 99.

01  STATUS-DATE-PACKED   PIC S9(7) COMP-3.


MOVE STATUS-DATE TO STATUS-DATE-PACKED.



This resulted in a S0C7.

Changing the STATUS-DATE to this:

Code:
01  STATUS-DATE            PIC 9(06).

01  FILLER REDEFINES STATUS-DATE.
     05  STAT-DATE-MM          PIC 99.
     05  STAT-DATE-DD          PIC 99.
     05  STAT-DATE-YY          PIC 99.



Results in successful process.

COBOL is a funny duck. icon_rolleyes.gif
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Jun 29, 2007 6:31 am
Reply with quote

Moving alphanumeric to comp-3 will cause abend.
Back to top
View user's profile Send private message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Fri Jun 29, 2007 10:25 am
Reply with quote

Initialize the comp-3 variable.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 29, 2007 11:32 am
Reply with quote

Hello,

Well, doing this
Quote:
Initialize the comp-3 variable.
is always a good idea, but initializing the receiving field will have no affect on a move.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jun 29, 2007 11:48 am
Reply with quote

Assuming Enterprise COBOL, The move is legal.
Does STATUS-DATE contain numeric data?
It would be interesting to see the difference in the generated code and which instruction actually got the exception.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Jun 29, 2007 1:10 pm
Reply with quote

This may sound a dumb question but did MOVE result in S0C7? icon_confused.gif
Group data items are alphanumeric, so the move will be considered as alphanumeric move. For such alphanumeric moves compiler will generate MVC instruction. Even if the STATUS-DATE contains numeric data, this may result in moving invalid data in COMP-3 variable.
Example:
Code:
01  STATUS-DATE VALUE '012345'.                 
     05  STAT-DATE-MM          PIC 99.         
     05  STAT-DATE-DD          PIC 99.         
     05  STAT-DATE-YY          PIC 99.         
01  STATUS-DATE-PACKED         PIC S9(7) COMP-3.
PROCEDURE DIVISION.                             
     MOVE STATUS-DATE TO STATUS-DATE-PACKED.   
     ADD 1 TO STATUS-DATE-PACKED. ======> soc7               
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jun 29, 2007 7:07 pm
Reply with quote

Hi SD,

In the orig case you moved a group item to a packed field and no conversion took place.

Withthe redfef you changed the orig field to an elementary item and conversion took place.
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 171
Location: Seattle, WA

PostPosted: Fri Jun 29, 2007 8:51 pm
Reply with quote

Of course! By NOT defining the group level as numeric, it defaulted to alphanumeric - making the move to a comp-3 field invalid.


Must have had an alzheimer's moment....... icon_lol.gif


Thanks guys! (and gals)
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Sun Jul 01, 2007 2:11 pm
Reply with quote

Is there any way to define the group variable as numeric? i.e. to change from the default of alphanumeric

Thanks,
Bala
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Jul 01, 2007 4:21 pm
Reply with quote

Hello,

No. By definition, group fields are alpha-numeric.

You can sometimes use the content as numeric, but the definition of group fields is alpha-numeric.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jul 02, 2007 5:09 am
Reply with quote

No, the only way is to redefine it.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Mon Jul 02, 2007 9:27 am
Reply with quote

Thanks dick & Jack:-)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jul 02, 2007 5:57 pm
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jul 02, 2007 6:09 pm
Reply with quote

My pleasure.
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 Find a record count/numeric is multip... COBOL Programming 1
No new posts How to move DB2 Installation HLQ DB2 4
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Numeric check on packed signed and un... COBOL Programming 4
Search our Forums:

Back to Top