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
 
Signed Decimal summation & Conversion to Zonal Decimal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Signed Decimal summation & Conversion to Zonal Decimal
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    Post subject:
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 Moderator


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

PostPosted: Thu Jan 29, 2009 2:12 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Jan 29, 2009 3:52 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Jan 29, 2009 8:16 am    Post subject:
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 Moderator


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

PostPosted: Thu Jan 29, 2009 9:37 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm

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