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

Store the Comp-3 value to Readable format in COBOL


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

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Fri Mar 20, 2009 9:15 am
Reply with quote

Hi

I have a query.

My input file contains a field of size PIC 9(4) COMP-3 of length 3.

I need to display this field in zoned decimal / readable format in the cobol program

Below is field structure in the input file
01 sample pic 9(4) comp-3

In the cobol program i declared a temporary field as below

01 sample-disp pic x(3) usage value is display.

In procedure division i gave following move statement to move the comp-3 value to the temp declared valye,

move sample to samp-disp.

Note that after the above process if the value in the input value is '0501' (hex fomat), after the move it is displaying as '050'.

Let me know if there is any issue in the above cobol declartion variable.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 20, 2009 3:08 pm
Reply with quote

try 01 sample-disp pic 9(4).
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Fri Mar 20, 2009 3:21 pm
Reply with quote

Thanks for the tip
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 Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top