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
 

 

Write a report that will eventually break by String record

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

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Tue Oct 16, 2007 11:37 pm    Post subject: Write a report that will eventually break by String record
Reply with quote

I have a file:

1 header record (1st record on the file) value '01' in column 01
then it follows with a single string record value '08' in column 01
then many detail records value '04' in column 01

then it may repeat multiple times with again a
string record x'08' followed by multiple detail records x'04' etc...

Example: (LRECL=080 FB)

01ABCXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....
081111string record # 1xxxxxxxxxxxxxxxxxxxx
04detail record#1 of String record #1 $100.00
04detail record#2 of String record #1 $150.00
.
.
.
04detail record#n of String record #1 $170.00
082222string record # 2xxxxxxxxxxxxxxxxxxxx
04detail record#1 of String record #2 $100.00
04detail record#2 of String record #2 $110.00
.
.
.
04detail record#n of String record #2 $220.00
etc..

Now, I won't know if there is only 1 or more sets of '08' string records.

What I need to do is write a report that will eventually break by String record:

So it would have:

1111 detail for rec # 01 $100
1111 detail for rec # 02 $150
1111 .
1111 detail for rec # 02 $170
Total for 1111 $$$$$

2222 detail for rec # 01
2222 detail for rec # 02
2222
2222
1111 detail for rec # 02 $170
Total 2222 $$$$$
Grand Total $$$$$

So basically, I need to first attach the '08' field 1111 to each '04' which follows until the next '08' if there is one. Then if there is another '08' record, the attach the 2222 to each '04' record.

Then

do the report etc...
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: Wed Oct 17, 2007 1:20 am    Post subject:
Reply with quote

Well, the detail records in your output records don't really match up to the detail records in your input records (e.g. # 01 vs # 1), but here's a DFSORT/ICETOOL job that should give you the idea:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
01ABCXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....
081111string record # 1xxxxxxxxxxxxxxxxxxxx
04detail record#1 of String record #1  $100.00
04detail record#2 of String record #1  $150.00
04detail record#n of String record #1  $170.00
082222string record # 2xxxxxxxxxxxxxxxxxxxx
04detail record#1 of String record #2  $100.00
04detail record#2 of String record #2  $110.00
04detail record#3 of String record #2  $140.00
04detail record#n of String record #2  $220.00
/*
//OUT DD SYSOUT=*
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) -
  WITHALL WITH(5,76) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION SKIPREC=1
  INREC IFTHEN=(WHEN=INIT,BUILD=(3:1,76,81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(3,2,CH,EQ,C'08'),
                OVERLAY=(1:5,4,81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(89:SEQNUM,8,ZD,
                         81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,REMOVECC,
    SECTIONS=(1,4,
      TRAILER3=('  Total for ',1,4,X,
        TOT=(43,6,UFF,EDIT=($TTT.TT)),/)),
    TRAILER1=('  Grand total ',1,4,X,
        TOT=(43,6,UFF,EDIT=($TTT.TT)))
/*


OUT would have:

Code:

1111detail record#1 of String record #1  $100.00     
1111detail record#2 of String record #1  $150.00     
1111detail record#n of String record #1  $170.00     
  Total for 1111 $420.00                             
                                                     
2222detail record#1 of String record #2  $100.00     
2222detail record#2 of String record #2  $110.00     
2222detail record#3 of String record #2  $140.00     
2222detail record#n of String record #2  $220.00     
  Total for 2222 $570.00                             
                                                     
  Grand total 2222 $990.00                           
Back to top
View user's profile Send private message
yianis

New User


Joined: 14 Aug 2006
Posts: 45

PostPosted: Wed Oct 17, 2007 9:34 pm    Post subject: Reply to: Write a report that will eventually break by Strin
Reply with quote

Thanks Frank!!!!

I need to sort some of the fields but I'm having some problems doing this.

INPUT:


Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 081704                                                                 
000002 04   000022222222   11111111   30000000000000   000000           $00   
000003 04   000011111111   99999999   20000000000000   000008    $22,195.54   
000004 04   000033333333   11111111   10000000000000   000001     $1,363.01   
000005 081702                                                                 
000006 04   000099999999   99999999   30000000000000   000001   $264,851.60   
000007 04   000044444444   11111111   20000000000000   000001       $452.89   
000008 04   000088888888   99999999   10000000000000   000001       $651.67   


OUTPUT (not Sorted)

Code:
                        SYSTEM GENERATED CREDIT VOUCHERS                       
                        ================================                       
                                                                               
DATE:10/17/07                                 CYCLE: I       PAGE:     1       
ENTRY#   SERIAL#      TRANSIT#      ACCOUNT        T/C       AMOUNT             
------ -----------    --------   --------------   ------   ------------         
1704   000022222222   11111111   30000000000000   000000           $00         
1704   000011111111   99999999   20000000000000   000008    $22,195.54         
1704   000033333333   11111111   10000000000000   000001     $1,363.01         
                                            ENTRY TOTAL     $23,558.55         
                                                                               
                                                                               
DATE:10/17/07                                 CYCLE: I       PAGE:     2       
ENTRY#   SERIAL#      TRANSIT#      ACCOUNT        T/C       AMOUNT             
------ -----------    --------   --------------   ------   ------------         
1702   000099999999   99999999   30000000000000   000001   $264,851.60         
1702   000044444444   11111111   20000000000000   000001       $452.89         
1702   000088888888   99999999   10000000000000   000001       $651.67         
                                           ENTRY TOTAL    $265,956.16         
                                                                               
                                           GRAND TOTAL    $289,514.71         


I'd like to be able to sort it by any of the fields above, so let's say by Entry Code & Serial # within that so it should look like this:

Code:
                        SYSTEM GENERATED CREDIT VOUCHERS               
                        ================================               
                                                                       
DATE:10/17/07                                 CYCLE: I       PAGE:     1
ENTRY#   SERIAL#      TRANSIT#      ACCOUNT        T/C       AMOUNT     
------ -----------    --------   --------------   ------   ------------
1702   000044444444   11111111   20000000000000   000001       $452.89 
1702   000088888888   99999999   10000000000000   000001       $651.67 
1702   000099999999   99999999   30000000000000   000001   $264,851.60 
                                            ENTRY TOTAL    $265,956.16 
                                                                       
                                                                       
DATE:10/17/07                                 CYCLE: I       PAGE:     2
ENTRY#   SERIAL#      TRANSIT#      ACCOUNT        T/C       AMOUNT     
------ -----------    --------   --------------   ------   ------------
1704   000011111111   99999999   20000000000000   000008    $22,195.54 
1704   000022222222   11111111   30000000000000   000000           $00 
1704   000033333333   11111111   10000000000000   000001     $1,363.01 


The code I have now (from your code provided above too). I had to do some more massaging of the data to get tot his point, but the last part of the code is:


Code:
                                                       
//JS00500  EXEC PGM=ICETOOL                                 
//SYMNAMES DD DSN=XXXXXXXXXXXXXXXXXXXXXXXXX.CYCLE,DISP=SHR 
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN       DD DSN=XXXXXXXXXXXXXXXXXXXX.FMT133,             
//         DISP=SHR                                         
//OUT      DD DSN=XXXXXXXXXXXXXXXXXXXX.FMT2,               
//         DISP=(,CATLG,DELETE),                           
//         SPACE=(TRK,(100,20),RLSE),AVGREC=K,             
//         DCB=(RECFM=FB,LRECL=149,BLKSIZE=0)               
//SYSPRINT DD SYSOUT=*                                     
//SYSOUT   DD SYSOUT=*                                     
//TOOLIN   DD    *                                         
SPLICE FROM(IN) TO(OUT) ON(134,8,ZD) -                     
  WITHALL WITH(5,129) USING(CTL1)                           
/*                                                         
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(003:01,057,                         
                                 060:58,072,                         
                                 134:SEQNUM,8,ZD)),                   
        IFTHEN=(WHEN=(3,2,CH,EQ,C'08'),                               
                OVERLAY=(1:5,5,134:SEQNUM,8,ZD)),                     
        IFTHEN=(WHEN=NONE,                                           
                OVERLAY=(142:SEQNUM,8,ZD,                             
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))     
  OUTFIL FNAMES=OUT,REMOVECC,                                         
      HEADER1=(025:'SYSTEM GENERATED CREDIT VOUCHERS',/,             
               025:'================================'),               
    SECTIONS=(1,4,SKIP=P,                                             
      TRAILER3=(45:'ENTRY TOTAL ',                                   
        TOT=(58,14,UFF,EDIT=($II,III,III.TT)),/)),                   
      HEADER2=(/,001:C'DATE:',                                       
               006:&DATE,                                             
               047:C'CYCLE:',                                         
               054:CYCLE,                                             
               062:C'PAGE:',                           
               067:&PAGE,/,                           
               001:C'ENTRY#',                         
               010:C'SERIAL#',                         
               023:C'TRANSIT#',                       
               037:C'ACCOUNT',                         
               052:C'T/C',                             
               062:C'AMOUNT',/,                       
               001:C'------',                         
               008:C'-----------',                     
               023:C'--------',                       
               034:C'--------------',                 
               051:C'------',                         
               060:C'------------'),                   
    TRAILER1=(45:'GRAND TOTAL ',                       
       TOT=(58,14,UFF,EDIT=($II,III,III.TT)))         
                                                       
/*                                                     

I would like to be able to sort it by Entry Code & Serial# as an example and page by line# and not break page on entry....
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: Wed Oct 17, 2007 10:49 pm    Post subject:
Reply with quote

You'll need to use two ICETOOL operators to do that. Something like this:

Code:
//TOOLIN   DD    *                                         
SPLICE FROM(IN) TO(T1) ON(134,8,ZD) -                     
  WITHALL WITH(5,129) USING(CTL1)                           
SORT FROM(T1) USING(CTL2)
/*                                                         
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(003:01,057,                         
                                 060:58,072,                         
                                 134:SEQNUM,8,ZD)),                   
        IFTHEN=(WHEN=(3,2,CH,EQ,C'08'),                               
                OVERLAY=(1:5,5,134:SEQNUM,8,ZD)),                     
        IFTHEN=(WHEN=NONE,                                           
                OVERLAY=(142:SEQNUM,8,ZD,                             
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))   
//CTL2CNTL DD *
   SORT FIELDS=(...)
   OUTFIL FNAMES=OUT,...


T1 is a temporary file. You can comment out the SORT operator at first so you can take a look at what T1 contains and set up your SORT and OUTFIL statements accordingly.
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 Detailed Transaction History report f... Kyle Carroll CICS 5 Tue Oct 18, 2016 12:42 am
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


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