Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Data Representation in COBOL

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

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Sat Jan 07, 2006 7:01 pm    Post subject: Data Representation in COBOL
Reply with quote

Hi All,

Here is a sample code...

A PIC X(04) VALUE IS 'KLMN'.
B REDEFINES A PIC S9(04).
ADD 1000 TO B.
DISPLAY B.

This gives 134E as answer.

Could anyone please let me know how the data is actually stored and how this operation is actually performed.

Thanks and Regards,
Raveendra.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jan 10, 2006 3:59 am    Post subject: Re: Data Representation in COBOL
Reply with quote

raveendra_ibm,

I just answered, I hope, this question for another member. Check this topic. if it doesn't answer your question please come back

http://www.ibmmainframes.com/viewtopic.php?t=7951&start=0&postdays=0&postorder=asc&highlight=

Luck,

Dave
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Tue Jan 10, 2006 9:10 am    Post subject: Re: Data Representation in COBOL
Reply with quote

Hi Raveendra,

Since you're trying to move an Alphanumeric value to a numeric field, the compiler rules dictate that the sending field be numeric and unsigned.

For example


Quote:
WORKING-STORAGE SECTION.
01 A PIC X(04).
01 B PIC 9(04).
PROCEDURE DIVISION.
MOVE 'ABCD' TO A
MOVE A TO B
DISPLAY 'VALUE OF B IS : ' B
STOP RUN.


In the above example since you're trying to move X'C1C2C3C4' (an A/N value) to a numeric field, the compiler rules dictate that the sending field be numeric and unsigned.

It looks like it doesn't care about the non-sign digits (GIGO), but forces the 4 high order sign bits of the low order digit to X'F', overlaying the X'C' that's there. Since the low order bits of that digit is X"4" the full byte is X'F4' or a DISPLAY "4".


Hope this helps.


Please let me know if I am wrong.
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us