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
 

 

Accumulation for trailer total

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
SiFocusUK

New User


Joined: 21 Jun 2007
Posts: 6
Location: Essex, UK

PostPosted: Fri Nov 09, 2012 4:19 am    Post subject: Accumulation for trailer total
Reply with quote

Hi,

I have a problem/dilemma which we are hoping can be accomodated in DFSORT but havent been able to successfully resolve it yet.
There is already a sort in place to split a file and accumulate a count on the trailers of the 2 outputs so we would like to add this in for tidyness rather than create a new step.

We have an incoming file with an amount and a credit/debit flag i.e.

xxxxxC00000000000000100xxxxxxxxxx
xxxxxC00000000000000200xxxxxxxxxx
xxxxxC00000000000000500xxxxxxxxxx
xxxxxD00000000000000200xxxxxxxxxx
xxxxxC00000000000000100xxxxxxxxxx

the trailer on the file has 2 fields (one credit and one debit) that we would like to accumulate the totals into.

It sounded pretty simple but i'm afraid i have to admit is got us foxed.

In the example above the trailer would read:

TLRxx00000000000000900x00000000000000200xxxxx

Any assistance would be grately appreciated!

Many Thanks,
Simon
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 09, 2012 4:44 am    Post subject: Reply to: Accumulation for trailer total
Reply with quote

Can you show the code that is not working, and let us know what it is doing instead?
Back to top
View user's profile Send private message
SiFocusUK

New User


Joined: 21 Jun 2007
Posts: 6
Location: Essex, UK

PostPosted: Fri Nov 09, 2012 4:51 am    Post subject:
Reply with quote

The code we have tried just gives us operand errors or invalid syntax. At the moment its only been added for SORTOF01. The lines with # are what i've added although i'm not sure if SUM will work but TOTAL/SUBTOTAL etc dont seem to either.

Code:
 
SORT FIELDS=(COPY)                                             
   OUTFIL FNAMES=SORTOF01,                                     
          IFOUTLEN=150,                                         
     INCLUDE=(1,2,SS,EQ,C'00,99',OR,(66,3,SS,EQ,C'100,240')),   
     IFTHEN=(WHEN=(1,2,CH,NE,C'00'),                           
         OVERLAY=(151:SEQNUM,9,ZD,START=0),HIT=NEXT),           
#        IFTHEN=(WHEN=(25,1,CH,EQ,C'D'),                       
#        SUM FIELDS=(171,17,26,17),FORMAT=ZD),                 
#        IFTHEN=(WHEN=(25,1,CH,EQ,C'C'),                       
#        SUM FIELDS=(191,17,26,17),FORMAT=ZD),                 
     IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),                           
         OVERLAY=(24:151,9),                                   
#        OVERLAY=(33:171,17),                                   
#        OVERLAY=(50:191,17))                                   
   OUTFIL FNAMES=SORTOF02,                                     
          IFOUTLEN=150,                                         
     INCLUDE=(1,2,SS,EQ,C'00,99',OR,(66,3,SS,EQ,C'300')),       
     IFTHEN=(WHEN=(1,2,CH,NE,C'00'),                           
         OVERLAY=(161:SEQNUM,9,ZD,START=0),HIT=NEXT),           
     IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),                           
         OVERLAY=(24:161,9))       
                           


Thank you icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 09, 2012 5:07 am    Post subject: Reply to: Accumulation for trailer total
Reply with quote

OK, yes, it is not possible to make up your own syntax.

The SUM cannot be part of an IFTHEN.

You later have multiple OVERLAYs on an IFTHEN. You can't do that, but you can specify multiple columns in a single OVERLAY.

You do need to extend the record, with the credit value in one place and zero in another for credits and vice-versa for debits. You should then be able to get the TRAILER1 TOTALing for those two fields.

Since you are only processing 00 and 99 types, there may be benefit in

Code:
  INCLUDE COND=(1,2,SS,EQ,C'01,99')


Get's rid of any other records as early as possible, and allows simplification of your OUTFIL INCLUDE. Won't make much difference to resource use for a COPY operation, but neater to be consistent.
Back to top
View user's profile Send private message
SiFocusUK

New User


Joined: 21 Jun 2007
Posts: 6
Location: Essex, UK

PostPosted: Fri Nov 09, 2012 6:58 am    Post subject:
Reply with quote

thank you.

I've been doing a bit more and some digging as well and i think i've come up with something that should give us what we want... but it still doesnt work.

I'm using this:
Code:

 SORT FIELDS=(COPY)                                           
   OUTFIL FNAMES=SORTOF01,                                     
          IFOUTLEN=150,                                       
     INCLUDE=(1,2,SS,EQ,C'00,99',OR,(66,3,SS,EQ,C'100,240')), 
     IFTHEN=(WHEN=(1,2,CH,NE,C'00',AND,(25,1,CH,EQ,C'D')),     
           OVERLAY=(171:26,17,191:+0,TO=ZD,LENGTH=17)),       
     IFTHEN=(WHEN=(1,2,CH,NE,C'00',AND,(25,1,CH,EQ,C'C')),     
           OVERLAY=(191:26,17,171:+0,TO=ZD,LENGTH=17)),       
     IFTRAIL=(HD=YES,TRLID=(1,2,CH,EQ,C'99'),                 
     TRLUPD=(24:COUNT=(EDIT=(TTTTTTTTT)),                     
     33:TOT=(171,17,ZD,LENGTH=17),                             
     50:TOT=(191,17,ZD,LENGTH=17)))                           


but getting
Code:

ICE027A 9 END OF SORTOF01 FIELD BEYOND MAXIMUM RECORD LENGTH


Must be something to do with the OVERLAYs outside the input record length but i'm not sure what. Do i have to use BUILD instead ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 09, 2012 2:47 pm    Post subject: Reply to: Accumulation for trailer total
Reply with quote

To check the processing, you can extend the IFOUTLEN to include the extended fields. It should now run, but you don't want the records that long...
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 09, 2012 4:56 pm    Post subject: Reply to: Accumulation for trailer total
Reply with quote

OK, TRLUPD is not going to work as-is because it uses values which are present on input to OUTFIL.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Nov 10, 2012 6:25 am    Post subject: Reply to: Accumulation for trailer total
Reply with quote

It is not clear if you have a trailer on you input, your sample doesn't show it.

If you use TRAILER1, you should be able to get at the extended fields to generate the trailers.

If you have a trailer on the input, move your "processing" to OUTREC, then IFTRAIL will have access to the extended fields which are input to OUTFIL.
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts DSN name in trailer kranthikumarb DFSORT/ICETOOL 7 Mon Feb 29, 2016 11:30 am
No new posts JCL SORT to split the file and put re... Bill Woodger DFSORT/ICETOOL 17 Wed Feb 17, 2016 4:17 pm
No new posts Merge two files having two trailer re... R.Manivannan DFSORT/ICETOOL 7 Wed Nov 25, 2015 9:18 pm
No new posts How to update Trailer count for a VB ... manas121 DFSORT/ICETOOL 10 Tue Oct 13, 2015 10:09 pm


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