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
 
Summing Totals in a Trailer Record

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

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Thu Jan 29, 2009 9:32 pm    Post subject: Summing Totals in a Trailer Record
Reply with quote

I want to create a trailer record with credit and debit totals for audit purposes.

The data i am using is as follows:

Code:

080731,ACETRANSL           ,Y,080108,P,02,+00000000521105.91,MANUAL
080731,ACETRANSL           ,Y,080108,P,02,-00000000521105.91,MANUAL
080731,AUTODISSA           ,Y,080108,P,02,-00000000088211.27,MANUAL
080731,AUTODISSA           ,Y,080108,P,02,+00000000088211.27,MANUAL
080731,BELTPACKE           ,Y,080108,P,02,+00000005390584.79,MANUAL
080731,BELTPACKE           ,Y,080108,P,02,-00000009059841.76,MANUAL
080731,BELTPACKE           ,Y,080108,P,02,+00000003669256.97,MANUAL
080731,BEVELTOPT           ,Y,080108,P,02,+00000000259916.12,MANUAL
080731,BEVELTOPT           ,Y,080108,P,02,+00000002005213.00,MANUAL


I have creeated the following job to create an audit file:

Code:

//STEP010  EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//SYMNAMES DD DSN=&BASERV.DATA(&SYMNAME),DISP=SHR                   
//IN       DD DSN=&ID.RV.&TLQ.N&JOBNAME..MFEED.OFPFEED&GENIN,DISP=SHR
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//OUT      DD DSN=&ID.RV.&TLQ.N&JOBNAME..MFEED.OFPAUDIT&GENOUT,     
//            UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,CATLG)             
//*                                                                 
//TOOLIN   DD DSN=&BASERV.DAT(&MEMBER1),DISP=SHR                   
//CTL1CNTL DD DSN=&BASERV.DATA(&MEMBER2),

Where member 1 is:
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT)   


and member 2 is:

Code:

  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,                               
  OUTREC=(1,51,117X),                                               
  TRAILER1=(1:FEEDID,                                               
          SCHED-FREQ,                                             
          DATENS=(DM4),                                           
          TIMENS=(24),                                           
          DATENS=(DM4),                                           
          COUNT=(M11,LENGTH=9),                                   
          TOT=(112,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
          TOT=(112,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
          TOT=(261,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
          TOT=(261,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
          CREATOR,                                               
          STATCNT1,                                               
          STATCNT2,                                               
          STATCNT3,                                               
          DATATYPE)                                               


The only field I am interested in are the total fields. For the first total I only want to include records where character 112 is '-' and for the seconf total where charaacter 112 is '+'.

Can anyone 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 10:30 pm    Post subject:
Reply with quote

The DFSORT job below will give you what you asked for. I assumed your input file has RECFM=FB and LRECL=300, but the job can be changed appropriately for other attributes. I also assumed you wanted separate - and + totals for the 261 field as well as the 112 field.

Note that you only need one COPY operator (pass), not two.

Code:

//STEP010  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SYMNAMES DD DSN=&BASERV.DATA(&SYMNAME),DISP=SHR
//IN       DD DSN=&ID.RV.&TLQ.N&JOBNAME..MFEED.OFPFEED&GENIN,DISP=SHR
//OUT      DD DSN=&ID.RV.&TLQ.N&JOBNAME..MFEED.OFPAUDIT&GENOUT,
//            UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,CATLG)
//*
//TOOLIN   DD DSN=&BASERV.DAT(&MEMBER1),DISP=SHR
//CTL1CNTL DD DSN=&BASERV.DATA(&MEMBER2),


Where member 1 is:

Code:

COPY FROM(IN) USING(CTL1)


and member 2 is:

Code:

  INREC IFTHEN=(WHEN=(112,1,CH,EQ,C'-'),
          OVERLAY=(301:112,18),HIT=NEXT),
        IFTHEN=(WHEN=(112,1,CH,EQ,C'+'),
          OVERLAY=(319:112,18),HIT=NEXT),
        IFTHEN=(WHEN=(261,1,CH,EQ,C'-'),
          OVERLAY=(337:261,18),HIT=NEXT),
        IFTHEN=(WHEN=(261,1,CH,EQ,C'+'),
          OVERLAY=(355:261,18))
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
    OUTREC=(1,51,117X),
    TRAILER1=(1:FEEDID,
            SCHED-FREQ,
            DATENS=(DM4),
            TIMENS=(24),
            DATENS=(DM4),
            COUNT=(M11,LENGTH=9),
            TOT=(301,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
            TOT=(319,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
            TOT=(337,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
            TOT=(355,18,SFF,EDIT=(STTTTTTTTTTTTTT.TT),SIGNS=(+,-)),
            CREATOR,
            STATCNT1,
            STATCNT2,
            STATCNT3,
            DATATYPE)
Back to top
View user's profile Send private message
Michaelod
Warnings : 1

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Fri Jan 30, 2009 5:14 pm    Post subject:
Reply with quote

Thanks Frank....that worked perfectly.

Just for clarification, what does HIT=NEXT mean or do?

Cheers
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: Fri Jan 30, 2009 9:33 pm    Post subject:
Reply with quote

Without HIT=NEXT, processing stops when an IFTHEN clause is satisfied. With HIT=NEXT, processing continues when an IFTHEN clause is satisfied.

For example:

Code:

   INREC IFTHEN=(WHEN=(cond1),BUILD=(action1)),
      IFTHEN=(WHEN=(cond2),BUILD=(action2))


If cond1 is satisfied, processing stops for that record, that is. the second IFTHEN clause is not used for that record.

Code:

   INREC IFTHEN=(WHEN=(cond1),BUILD=(action1),HIT=NEXT),
      IFTHEN=(WHEN=(cond2),BUILD=(action2))


If cond1 is satisfied, processing continues for that record, that is, the second IFTHEN clause is used for that record.

HIT=NEXT is useful when two IFTHEN clauses are not related, e.g. 1,1,CH,EQ,C'5' for the first clause and 22,1,CH,EQ,C'Y' for the second clause.
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm

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