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: 7995
Location: Bellevue, IA

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: 7995
Location: Bellevue, IA

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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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