Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compress records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Compress records
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: 6968
Location: porcelain throne

PostPosted: Tue May 11, 2010 6:59 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Tue May 11, 2010 7:18 pm    Post subject:
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

Active Member


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

PostPosted: Tue May 11, 2010 7:42 pm    Post subject:
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue May 11, 2010 10:33 pm    Post subject:
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

Active Member


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

PostPosted: Tue May 11, 2010 10:40 pm    Post subject:
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: 1243
Location: Israel

PostPosted: Wed May 12, 2010 1:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us