MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT - Edit Mask Patterns
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 8:12 am    Post subject: DFSORT - Edit Mask Patterns Reply with quote

Hi All,

I am trying to figure out if the following requirement is achievable using DFSORT -
I have an amount field - S9(11)V99 COMP-3 and i need to display this field in a report as follows -

Code:
1,7,PD,EDIT=(II,III,III,III.TTS),SIGNS=(,,,-)


Code:

Input   ->  +123456750
Output  ->  1234567.50

Input   ->  -532150
Output  ->   5321.50-

Input   ->  +50
Output  ->  .50

Input   ->    +0
Output  ->   .00


Note : Whats bothering me are the last two cases -

I am getting

Code:
Input   ->  +50
Output  ->   50

Input   ->    +0
Output  ->   00


The period (.) is missing Sad
Also 0.00 instead of .00 is not acceptable Sad

Could anyone please help me.

Thanks,
Raveendra.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Sep 07, 2007 8:22 am    Post subject: Reply with quote

raveendra_ibm,

If you want 0.00 then you need a T instead I before the decimal. try this

Code:

1,7,PD,EDIT=(II,III,III,IIT.TTS),SIGNS=(,,,-)


this will give you

Code:

0.50 
0.50-


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 9:05 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for your time... but i actually needed .00 and NOT 0.00

Quote:
Also 0.00 instead of .00 is not acceptable


I am currently gettting 00 (i.e., no period at all)

Thanks,
Raveendra.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Sep 07, 2007 9:36 am    Post subject: Reply with quote

If IIT.TTS produces 0.00 I'd bring that up with IBM.....
The way I read the EDit op-code (I've been known to be wrong) is that if the Significance starter is encountered and Previous State of Significance Indicator is off and the left 4 bits of the Source Digit is X'0000' and the right 4 bits are not a sign, then the result is the fill character and State of Significance Indicator at End of Digit Examination is turned on allowing for the Message byte (decimal point) to appear.
Heck, even my (really) old PoOp shows an example of it working the way you want.......
Back to top
View user's profile Send private message
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 10:17 am    Post subject: Reply with quote

Hi CICS_Guy,

Quote:
The way I read the EDit op-code (I've been known to be wrong) is that if the Significance starter is encountered and Previous State of Significance Indicator is off and the left 4 bits of the Source Digit is X'0000' and the right 4 bits are not a sign, then the result is the fill character and State of Significance Indicator at End of Digit Examination is turned on allowing for the Message byte (decimal point) to appear.


Sorry, I am new to this jargon Confused But does that mean that

If i give input as 0 to
Code:
1,7,PD,EDIT=(II,III,III,III.TTS),SIGNS=(,,,-)

I would get an output .00 ?

But I am getting 00 and not .00 Sad

Thanks,
Raveendra.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Sep 07, 2007 10:25 am    Post subject: Reply with quote

raveendra_ibm wrote:
Sorry, I am new to this jargon Confused But does that mean that

If i give input as 0 to
Code:
1,7,PD,EDIT=(II,III,III,III.TTS),SIGNS=(,,,-)

I would get an output .00 ?

But I am getting 00 and not .00
No, it means that (if I understand the edit opcode) IIT.TT should produce .00
Back to top
View user's profile Send private message
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 10:30 am    Post subject: Reply with quote

Quote:
No, it means that (if I understand the edit opcode) IIT.TT should produce .00


Hi CICS_Guy, Just wanted to bring it to your notice that its III.TT and not IIT.TT .

Thanks,
Raveendra.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Sep 07, 2007 10:33 am    Post subject: Reply with quote

Quote:

If IIT.TTS produces 0.00 I'd bring that up with IBM.....
No, it means that (if I understand the edit opcode) IIT.TT should produce .00


CICS Guy,

Hmm T indicates a significant digit. If zero, this digit will be shown. It is just similar to the 9 in cobol whereas I is equivalent to Z in cobol
so an edit mask of IIT.TT would show as 0.00

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Sep 07, 2007 10:45 am    Post subject: Reply with quote

I know how it works in COBOL, but I was thinking that sort would be using the assembler opcode ED which implies that if the significance character is hit with a zero, the zero is suppressed and the significance flag is turned on after processing that zero so the following message characters (the decimal point) would be generated......
Or at least, that
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 07, 2007 11:00 am    Post subject: Reply with quote

Raveendra,

A T indicates a leading zero that should not be suppressed. For all zeros, everything before the first T will be replaced by blanks. So EDIT=(IT.TT) will give ' 0.00'.

An I indicates a leading zero that should be suppressed. Again, for all zeros, everything before the first T will be replaced by blanks. So EDIT=(II.TT) will give ' 00'. The period is replaced with a blank because it is before the first T.

In order to get .dd instead of dd, you'd have to post-process the value. For example:

Code:

  INREC IFTHEN=(WHEN=INIT,                                 
    BUILD=(1,7,PD,EDIT=(II,III,III,III.TTS),SIGNS=(,,,-))),
   IFTHEN=(WHEN=(14,2,CH,EQ,C' '),OVERLAY=(15:C'.'))       

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 11:26 am    Post subject: Reply with quote

Thank you, Frank.

But I am accepting the solution with a pinch of salt Sad

The actual requirement was to generate a report with two files as input one of which has this amount field. We have been achieving this by COBOL at our shop. But I thought of trying out the same using DFSORT.

Post-processing for the period might not 'sound convincing' to my technical superiors. Let me try my luck....

Thanks for the time and solution Frank...

Thank you Kolusu and CICS_Guy.

Regards,
Raveendra.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 07, 2007 11:52 am    Post subject: Reply with quote

Well, it's only "post-processing" in the sense that you have to hit the field twice. But in terms of actual processing, you're using an INREC statement to do everything in one pass. Don't call it "post-processing" when you talk to your "technical superiors". Wink

Maybe you could ask your "technical superiors" to explain why you have to show .00 instead of 0.00 in the report. Rolling Eyes I'd guess that 0.00 is the much more generally accepted way to display a zero value.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raveendra_ibm
Beginner


Joined: 02 Apr 2006
Posts: 32
Topics: 10

PostPosted: Fri Sep 07, 2007 12:03 pm    Post subject: Reply with quote

Hmmm.... I'll try it Frank. Thank you.

Could you please suggest me where can i best fit in the overlay (for period) for a report similar to the one mentioned below....

[code:1:86cd6f7291]OUTFIL FNAMES=RPT3,LINES=15,
HEADER2=(/,3:
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Sep 07, 2007 12:32 pm    Post subject: Reply with quote

Quote:
Thank you in advance.


No, sorry. You're not done yet.

I can show you how to do what you want, but first we have to fix the problems in your statements. You have some blanks that shouldn't be there and too many commas in SIGNS. I can fix those up to get:

Code:

  OUTFIL FNAMES=RPT3,LINES=15,                                 
           HEADER2=(/,3:'Branch Revenue Report',               
           30:'Page',PAGE,45:DATE=(MD4-),                       
           2/,3:'Branch',25:'Revenue',50:'Profit',/,           
           3:'---------------',25:'--------',50:'--------'),   
           OUTREC=(3:1,15,X,25:22,7,PD,                         
           EDIT=(III,III,III.TTS),SIGNS=(,,,-),X,               
           50:28,7,PD,EDIT=(III,III,III.TTS),SIGNS=(,,,-))     


But you have an overlapping positon (28) for the PD fields - 22,7 -> 22-28 and 28,7 -> 28-34 - that can't be right. What should the positions be?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Fri Sep 07, 2007 12:38 pm    Post subject: Reply with quote

Quote:
The period (.) is missing
Also 0.00 instead of .00 is not acceptable

raveendra,

Try this code -- it may produce the output you are looking for:
Code:

OUTREC FIELDS=(1,6,PD,EDIT=(II,III,III,III),C'.',6,2,PD,
       EDIT=(TTS),SIGNS=(,,,-))

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group