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

Compress records


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

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Tue May 11, 2010 5:47 pm
Reply with quote

Hi

Please help on this.

My Input field declaration is
01 WS-AMT PIC -(16)9.9(2). ----->Length 20

Output field declaration is
01 WS-AMT1 PIC X(20).

-100 is moved to WS-AMT
then WS-AMT moved to WS-AMT1.
WS-AMT1 is displayed as "13spaces-100.00"

But I need WS-AMT1 to be displayed as "-100.0013spaces"

Regards
Binaya
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 11, 2010 6:59 pm
Reply with quote

and how would the following be displayed:

.01+
.10+
1.00+
10.00+
1000.00+
10000.00+
100000.00+
1000000.00+
10000000.00+
100000000.00+
1000000000.00+
10000000000.00+
100000000000.00+
1000000000000.00+
10000000000000.00+
100000000000000.00+
1000000000000000.00+
.01-
.10-
1.00-
10.00-
1000.00-
10000.00-
100000.00-
1000000.00-
10000000.00-
100000000.00-
1000000000.00-
10000000000.00-
100000000000.00-
1000000000000.00-
10000000000000.00-
100000000000000.00-
1000000000000000.00-
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 11, 2010 7:18 pm
Reply with quote

also,
you do not mean compress,
apparently you mean left justify.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue May 11, 2010 7:42 pm
Reply with quote

Is -(16)9.9(2) correct?

Don't you want -9(16).9(2) ?

And why aren't you getting leading zeroes?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue May 11, 2010 10:33 pm
Reply with quote

Phrzby Phil: -(16)9 and -9(16) are two different pictures -- the first uses the minus sign as a floating insertion symbol (which gives the results posted) while the second uses fixed sign position and left fill zeroes.

Binaya: the only way I know of to achieve what you want is to move the data into your field, then find the first non-blank character and move them to the left of your output variable.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue May 11, 2010 10:40 pm
Reply with quote

I see - never used the (n) after a sign before - learn something new every day! Thanks.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed May 12, 2010 1:38 am
Reply with quote

Phrzby Phil wrote:
Is -(16)9.9(2) correct?
Yes, it is similar to ----------------9.99

Binaya,
when you define a numeric edited variable in cobol (and it doesn't matter if it is -(16)9.9(2) or -9(16).99 or any other format), the decimal point will always be in the same position, whatever value you have in the variable.
Using -(16)9.9(2) and some of Dick's examples, you will have:
Code:
     -0.01
     -0.10
     -1.00
    -10.00
   1000.00
  10000.00
 100000.00
1000000.00

If you want to have the number left justified, you will have to do it manually, by using reference modification for example.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top