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

Signed Decimal summation & Conversion to Zonal Decimal


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
manoz_k

New User


Joined: 08 Mar 2007
Posts: 23
Location: CHENNAI

PostPosted: Thu Jan 29, 2009 1:27 am
Reply with quote

Hi,

Here is my requirement :

Part -1

I have input file with few Amount fileds in the following format 9(9).9(2)
I want to Sum fields in say columns 97 (spanned across 13 bytes 1 byte for sign, 9 for number fields, 1 byte for decima and 2 for Decimal )

-000000270.00+000000000.25
+000000210.00-000000000.25


Part -2

After summation of amount fields based on a Key ( suppose at 34 byte for 11 bytes ) i want to convert the output to ZONED Decimal format.

Thank you very much for your time.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 29, 2009 1:52 am
Reply with quote

manoz_k,


Assuming that you want to sum the amount fileds based on the key in pos 97 for 13 bytes and in pos 110 for 13 bytes the following DFSORT control cards will give you the desired results.

Code:

//SYSIN    DD *
  SORT FIELDS=(34,11,CH,A)                                     
  OUTFIL REMOVECC,NODETAIL,                                     
  SECTIONS=(34,11,                                             
  TRAILER3=(34,11,X,                                           
            TOT=(097,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(110,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-))))
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 29, 2009 2:12 am
Reply with quote

Manoj,

If you want to convert the summed amounts to ZD format, you can change the TOT lines to:

Code:

            TOT=(97,13,SFF,TO=ZD,LENGTH=11),X,
            TOT=(110,13,SFF,TO=ZD,LENGTH=11)))
Back to top
View user's profile Send private message
manoz_k

New User


Joined: 08 Mar 2007
Posts: 23
Location: CHENNAI

PostPosted: Thu Jan 29, 2009 2:46 am
Reply with quote

Skolusu wrote:
manoz_k,


Assuming that you want to sum the amount fileds based on the key in pos 97 for 13 bytes and in pos 110 for 13 bytes the following DFSORT control cards will give you the desired results.

Code:

//SYSIN    DD *
  SORT FIELDS=(34,11,CH,A)                                     
  OUTFIL REMOVECC,NODETAIL,                                     
  SECTIONS=(34,11,                                             
  TRAILER3=(34,11,X,                                           
            TOT=(097,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(110,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-))))
/*

Here is my actual Control Card : ( based on your suggestion as above )
Total Input file is of length 16 + 13 + 13 + 13 + 13 + 13 = 81

Code:

  SORT FIELDS=(1,16,CH,A)                                         
  OUTFIL REMOVECC,NODETAIL,                                     
  SECTIONS=(1,16,                                               
  TRAILER3=(1,16,X,                                             
            TOT=(017,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(030,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(043,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(056,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
            TOT=(069,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)))) 


But I am getting following error

Code:

ICE230A 0 86 BYTE HEADER/TRAILER RECORD EXCEEDS 81 BYTE LRECL FOR SORTOUT


What is this TRAILER record is all about ?

Thanks for your help !!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 29, 2009 3:52 am
Reply with quote

Your TRAILER length is greater than your input length which isn't allowed. You can avoid the error message by using a BUILD operand like so:

Code:

  SORT FIELDS=(1,16,CH,A)
  OUTFIL REMOVECC,NODETAIL,
  BUILD=(86X),     <--------------------------------
  SECTIONS=(1,16,
    TRAILER3=(1,16,X,
      TOT=(017,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
      TOT=(030,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
      TOT=(043,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
      TOT=(056,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)),X,
      TOT=(069,13,SFF,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-))))
Back to top
View user's profile Send private message
manoz_k

New User


Joined: 08 Mar 2007
Posts: 23
Location: CHENNAI

PostPosted: Thu Jan 29, 2009 4:42 am
Reply with quote

I feel i got the expected output.What i see from the Trailer record is that embeds a space before the SIGN field for that i took additional 5 bytes.Actually my file is of 81 Bytes alone, but trailer record was expecting 86, as i have 5 amount fields so 5 Signs needed.Which took it to 86.

Thank you very much for your help !!!
Back to top
View user's profile Send private message
manoz_k

New User


Joined: 08 Mar 2007
Posts: 23
Location: CHENNAI

PostPosted: Thu Jan 29, 2009 4:47 am
Reply with quote

This helped me to put it in the Zoned Decimal format finally. Thanks a lot for your help.
Back to top
View user's profile Send private message
manoz_k

New User


Joined: 08 Mar 2007
Posts: 23
Location: CHENNAI

PostPosted: Thu Jan 29, 2009 6:55 am
Reply with quote

Frank Yaeger wrote:
Manoj,

If you want to convert the summed amounts to ZD format, you can change the TOT lines to:

Code:

            TOT=(97,13,SFF,TO=ZD,LENGTH=11),X,
            TOT=(110,13,SFF,TO=ZD,LENGTH=11)))


Thanks for the information, Does it take care of Negative Summation too ?Do we need to mentioned that explicitly ?

Regards,
Manoj
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 29, 2009 8:16 am
Reply with quote

Hello,

Quote:
Does it take care of Negative Summation too
Yes.

Quote:
Do we need to mentioned that explicitly
No.

The "S" in SFF (Signed Free Form) is for "signed". Unsigned would be UFF.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 29, 2009 9:37 pm
Reply with quote

Manoj,

SFF will handle signed and unsigned input values.

TO=ZD will handle signed and unsigned totals. The sign will be F for positive values or D for negative values. You could use TO=ZDC if you want C for positive values.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top