Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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: 6966
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: 962
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: 7936
Location: Bellevue, IA

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: 962
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: 1224
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 Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Not able to compress a very large PDS Hervey Martinez JCL & VSAM 7 Fri Nov 04, 2016 5:57 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us