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
 

 

Query on Move X(11) data to 9(11) variable

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

New User


Joined: 11 Jul 2007
Posts: 68
Location: noida

PostPosted: Mon Apr 27, 2009 8:56 pm    Post subject: Query on Move X(11) data to 9(11) variable
Reply with quote

Hi All.

Pls look at the follwoing code
05 CC-00000000000 PIC X(11) VALUE
'00000000000'.

05 D17625-MEMBER-ID PIC 9(11).

MOVE CC-00000000000 TO D17625-MEMBER-ID

This move is working fine. But I wanted to understand what is going on at background. How is the move able to assign char data to numeric data ( is it always allowed ?)

Secondly if it is allowed.. then when does actual type checking happen or is there sometype of type conversion happening..

Pls throw as much light as possible..
Thanks
Sunny
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon Apr 27, 2009 9:00 pm    Post subject:
Reply with quote

If you run the compile with LIST (not OFFSET) you will see the MOVE statement is converted into a pseudo-assembler MVC instruction. This instruction moves 11 bytes from one field to another field -- as long as they are both USAGE DISPLAY. Note that the sending field does not even have to have numeric data; you can move anything from a variable to a PIC 9(11) USAGE DISPLAY field.

Attempting to do any arithmetic with the field, however, will cause problems unless all 11 characters are actually numeric digits. And you will also run into issues when fields are converted (USAGE COMP, COMP-3, etc) as these types of moves require numeric data or generally a S0C7 abend occurs.
Back to top
View user's profile Send private message
sunny_io

New User


Joined: 11 Jul 2007
Posts: 68
Location: noida

PostPosted: Mon Apr 27, 2009 9:50 pm    Post subject: Reply to: Query on Move X(11) data to 9(11) variable
Reply with quote

Hi
Thanks for the reply
One more query I had ..
MOVE CC-00000000000 TO D17625-MEMBER-ID

Considering what I have as pic clause and what I'm moving ..
Although 05 CC-00000000000 PIC X(11) VALUE
'00000000000'.
is character by PIC clause but has zeroes in it..
Would I stil get Soc 7 if I manipulate D17625-MEMBER-ID ??
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon Apr 27, 2009 10:38 pm    Post subject:
Reply with quote

Not the way you've got things defined -- COBOL doesn't care where the data came from, only that each digit is numeric when being used for arithmetic or other numeric operation.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


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