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
 

 

Interesting Numeric Move resulted in a S0C7

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

Active User


Joined: 05 Dec 2006
Posts: 147
Location: Columbia, MO

PostPosted: Fri Jun 29, 2007 3:43 am    Post subject: Interesting Numeric Move resulted in a S0C7
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    Post subject:
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    Post subject: Re: Interesting Numeric Move
Reply with quote

Initialize the comp-3 variable.
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: Fri Jun 29, 2007 11:32 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Jun 29, 2007 11:48 am    Post subject:
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: 686
Location: Earth

PostPosted: Fri Jun 29, 2007 1:10 pm    Post subject:
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    Post subject:
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: 147
Location: Columbia, MO

PostPosted: Fri Jun 29, 2007 8:51 pm    Post subject: Re: Interesting Numeric Move resulted in a S0C7
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    Post subject:
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

Site Director


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

PostPosted: Sun Jul 01, 2007 4:21 pm    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

Thanks dick & Jack:-)
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: Mon Jul 02, 2007 5:57 pm    Post subject:
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    Post subject:
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    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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm


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