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

Field Format in Cobol


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

New User


Joined: 22 Jan 2008
Posts: 85
Location: India

PostPosted: Tue Jun 09, 2009 12:00 pm
Reply with quote

Hi,
I'm reading a records and moving into the 01 level of the copybook.
I have
Code:
01  DB-BREAK-POINT-RECORD.
           05  BRPT-CONC-PCNT-NO-1           PIC 9V99  VALUE ZEROES.


I want to write the records with decimal notations.
For eg.if i move 1500 this should be written as 1.50.
But it is written as 1500.
So i changed the PIC values as 9.99 but still the same 1500 is written.
Help me to solve this.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jun 09, 2009 12:06 pm
Reply with quote

Hello,

You might want to try dividing the number by 1000 before you MOVE to 9.99
Back to top
View user's profile Send private message
replytovishu

New User


Joined: 09 Dec 2008
Posts: 23
Location: india

PostPosted: Tue Jun 09, 2009 12:07 pm
Reply with quote

You want to write it in a file or what...
Back to top
View user's profile Send private message
usharaniA

New User


Joined: 22 Jan 2008
Posts: 85
Location: India

PostPosted: Tue Jun 09, 2009 12:08 pm
Reply with quote

if suppose i dont know about the copy book structure and knows oly the Copy book name. how do i implement it.
Back to top
View user's profile Send private message
usharaniA

New User


Joined: 22 Jan 2008
Posts: 85
Location: India

PostPosted: Tue Jun 09, 2009 12:08 pm
Reply with quote

yes i want to write into a flat file
Back to top
View user's profile Send private message
replytovishu

New User


Joined: 09 Dec 2008
Posts: 23
Location: india

PostPosted: Tue Jun 09, 2009 12:28 pm
Reply with quote

I would suggest you following.

try declaring another variable with pic 9.99 lets suppose ws-var1
move your variable to ws-var1 and write ws-var1 to flat file.

-Vishal
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jun 10, 2009 12:44 pm
Reply with quote

Show the actual code you used.

ILE COBOL Language Reference.

Examples of floating insertion editing:
Code:

   PICTURE               Value of Data        Edited Result
        $$$$.99                 .123               $.12
        $$$9.99                 .12               $0.12
   $,$$$,999.99            -1234.56           $1,234.56
   U,UUU,UU9.99-           -1234.56         EUR1,234.56-
   u,uuu,uu9.99             1234.56         USD1,234.56
   +,+++,999.99          -123456.789        -123,456.78
  $$,$$$,$$$.99CR       -1234567          $1,234,567.00CR
  ++,+++,+++.+++            0000.00
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 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
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top