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

How to write a S9(7)V99 COMP-3 field into a file


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

New User


Joined: 15 Nov 2005
Posts: 15
Location: chennai

PostPosted: Thu Jan 31, 2008 8:12 pm
Reply with quote

Hi ,

I have a field S9(7)V99 COMP-3 in a file.when i browse that file the value of thet field is like +64.00 ,-64.00,-2395.00.

I have to write it in output file in the same format taht is like
+64.00 ,-64.00,-2395.00.
Please suggest me a solution.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Jan 31, 2008 8:31 pm
Reply with quote

krishnakumarramaraj wrote:
Hi ,

I have a field S9(7)V99 COMP-3 in a file.when i browse that file the value of thet field is like +64.00 ,-64.00,-2395.00.

I have to write it in output file in the same format taht is like
+64.00 ,-64.00,-2395.00.
Please suggest me a solution.


Those values are you softwares interpretation of the values not the way they are in the file. if you want COMP-3 values in your file then just define the field as pic s9(7)v99 comp-3 and move the data from the input to the output. If you want like +64.00 ,-64.00,-2395.00 then define it as numeric edited in your output file PIC +,+++,++0.99 and move the data from the input to the output.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jan 31, 2008 8:35 pm
Reply with quote

a PIC S9(7)V99 COMP-3 field containing +64.00 will be a 5 byte field containing X'000006400C'.

if you want the field in the file to look like +64.00 you need to define 2 edit masks: PIC ++++++9.99 and PIC ------9.99.

based on the positive or negative value of the comp-3 field you need to move to one or the other edit mask. an edit mask will only show - or +. not both (used to be). maybe the new cobols provide a multifunction editmask.

I would suggest defining your editmask in the output file definition.

if you want the file to contain a COMP-3 field, then define the output file definition with a comp-3 field.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jan 31, 2008 11:04 pm
Reply with quote

Hello,

Quote:
when i browse that file the value of thet field is like +64.00 ,-64.00,-2395.00.
How are you browsing the file that shows the sign and the decimal point? "Inside" a file a comp-3 (packed decimal) field would have neither. . .

Are you using a "smart" browse that matches the data to a copybook or something similar?
Back to top
View user's profile Send private message
krishnakumarramaraj

New User


Joined: 15 Nov 2005
Posts: 15
Location: chennai

PostPosted: Mon Feb 04, 2008 10:38 am
Reply with quote

Thanks for ur reply and its working.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top