View previous topic :: View next topic |
Author |
Message |
cobcurious Beginner
Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Tue May 01, 2007 12:29 pm Post subject: Converting decimal point to implicit decimal point |
|
|
Hi,
I am receiving an input file with a decimal point (example: -1.1) . I am reading this file in my COBOL program. The field into which the data,received with decimal point, is being stored is declared as numeric with implicit decimal point (say field1 PIC S9V9 COMP) and other there is other field declared as (say field2 PIC S99V9 COMP-3) into which another decimal number,from the input file, is being tried to store. Can someone please let me know how can I convert the decimal numbers into implicit decimal numbers ?
I have searched the forum, I can across something called SFF and UFF. I am not clear how to apply it.
Your help is appreciated.
Thanks
Cobcurious |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Tue May 01, 2007 12:44 pm Post subject: |
|
|
cobcurious,
you can use sff format to convert the values
Code: |
p,m,SFF,BI,LENGTH=2
p,m,SFF,pd,LENGTH=2
p = start position of the numeric field
m = length of the numeric filed , in here it is 4
bi = comp or binary fileds
pd = packed decimal or comp-3
length = length of the target field , in here it is 2
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed May 02, 2007 3:24 am Post subject: |
|
|
Or read the data into a DISPLAY field then move to your COMP field as per the COBOL Programmers Guide section 3.3.3.4 from the manuals link above. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
cobcurious Beginner
Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Tue May 08, 2007 1:51 pm Post subject: |
|
|
Hi All,
Thanks everyone for the help. It worked !
Thanks
Cobcurious |
|
Back to top |
|
|
|
|