MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Different Detail Records need to be output

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 30, 2005 4:24 pm    Post subject: Different Detail Records need to be output Reply with quote

Consider the following input

Code:

RPT1
DETAIL....
DETAIL...
DETAIL...
RPT2
DETAIL....
DETAIL....
RPT3
DETAIL...
DETAIL...
DETAIL...
RPT4
DETAIL...
DETAIL...
DETAIL...
RPT5
DETAIL...
DETAIL...
DETAIL...

Desired Ouput
-----------------
RPT1
DETAIL...
DETAIL...
DETAIL...
RPT3
DETAIL...
DETAIL...
DETAIL...
RPT5
DETAIL...
DETAIL...
DETAIL...


All I want is the report headers and all detail records corresponding to that report. Please suggest.
________
digital vaporizer


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 30, 2005 4:52 pm    Post subject: Reply with quote

It's not clear what you're trying to do. All I see from your example is that you removed the header/detail records for RPT2 and RPT4. Are you trying to remove the second, fourth, sixth, etc report lines, or are you trying to do something else?
Please be more clear about what you want. Also, what is the RECFM and LRECL of your input file?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 30, 2005 5:09 pm    Post subject: Reply with quote

Frank,

Thanks for your quick response. All I'm trying is filter out only specific sections of the report. In this example, I want RPT1 header followed by its detail records until the next report header. Then RPT3 followed by its detail records until the next and so on. I know upfront what are the different header that I want. Here in this example, its RPT1, RPT3 and RPT5.

The LRECL/RECFM can be 80/FB.
________
buy vaporgenie


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 30, 2005 5:28 pm    Post subject: Reply with quote

Coolman,

There is similar thread about sorting headers and detail records. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=3432

The following solution is based of that trick.

Code:

//STEP0100 EXEC PGM=ICETOOL   
//DFSMSG   DD SYSOUT=*         
//TOOLMSG  DD SYSOUT=*         
//IN       DD *               
RPT1       
DETAIL.... 
DETAIL...   
DETAIL...   
RPT2       
DETAIL.... 
DETAIL.... 
RPT3       
DETAIL...   
DETAIL...   
DETAIL...   
RPT4       
DETAIL...   
DETAIL...   
DETAIL...   
RPT5       
DETAIL...   
DETAIL...   
DETAIL...   
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)     
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)     
//CON      DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR                 
//         DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR                 
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  COPY FROM(IN)  USING(CTL1)                                 
  SORT FROM(CON) USING(CTL2)                                 
//CTL1CNTL DD *                                               
  INREC  FIELDS=(1,80,SEQNUM,8,ZD)                           
  OUTFIL FNAMES=T1,INCLUDE=(1,3,CH,EQ,C'RPT'),               
         OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H')                 
  OUTFIL FNAMES=T2,SAVE,                                     
         OUTREC=(1,88,SEQNUM,8,ZD,C'Z')                       
//CTL2CNTL DD *                                               
  OPTION EQUALS                                                 
  INREC  FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,1)   
  SORT   FIELDS=(97,8,ZD,A,105,1,CH,A)                           
  OUTFIL FNAMES=OUT,                                             
  INCLUDE=(97,8,ZD,EQ,1,OR,                                     
           97,8,ZD,EQ,3,OR,                                     
           97,8,ZD,EQ,5),                                       
  OUTREC=(1,80)                                                 
/*                                                               


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 30, 2005 6:06 pm    Post subject: Reply with quote

Kolusu,

Thanks for the quick solution. I already looked at that posting in mainframe challenge.

What if the report headers are not RPT1, RPT3, RPT5 and are something like this

RPT.012, RPT.023. RPT.045 which needs to be filtered.

The file contains report id's that vary from RPT.001 to RPT.100 within the same file

Please suggest. Can you also possibly show a EZTRIVE solution?
________
vaporizer affiliate programs


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Mar 30, 2005 6:08 pm    Post subject: Reply with quote

On the same lines, is there a way, a header can be propapaged to all of the details records?

Say

HDR1
DET
DET
DET
HDR2
DET

and the o/p as
HDR1
DET HDR1
DET HDR1
DET HDR1
HDR2
DET HDR2
________
Chevrolet Big-Block engine specifications


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 30, 2005 7:44 pm    Post subject: Reply with quote

Coolman,

Do you want to "filter out" the sections by hardcoding the report header id (e.g. 'RPT.012', 'RPT.023', etc) as an INCLUDE condition or some other way?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 31, 2005 9:24 am    Post subject: Reply with quote

Frank,

Okay. It appear that I'm not clear. I have a report which has a bunch of report id's which vary from 1 to 100. Now, there are times, when I would have to filter only some specific report id's such as RPT.012, RPT.023 as in this example. I do not want to hardcode these values as the header containing these report id's may have different headings. So, I would need those header records(which contains the report id) followed by the list of details records until I hit another report id. Now, if the subsequent report id matches my criteria, I would be writing those to the output else I would have to skip and this processing needs to be done until the end of the file.

Hope I have made it clear this time
________
one vaporizer


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 31, 2005 12:17 pm    Post subject: Reply with quote

What identifies a report id (that is, the first record of a report section)? Does it have 'RPT' as the first three characters or something else? If there's nothing that identifies a report id, then how do we know where a report section starts?

You say you don't want to hardcode these values (the report ids), but you don't say how you want to input the values to the job. For example, if you want the reports for ids 'RPT.012' and 'RPT.023', how are you going to communicate that to the job? I suggested INCLUDE because you could put whatever report ids you need for that particular run into the INCLUDE statement. Alternatively, you could set the report ids up as DFSORT symbols and use those symbols in the INCLUDE statement. Or do you have another way of communicating the report ids you want to the job that you haven't made clear yet? Like just the number of the report (e.g. 12, 23), and again how are you going to communicate that to the job?

Quote:
Now, if the subsequent report id matches my criteria, I would be writing those to the output else I would have to skip and this processing needs to be done until the end of the file.


To belabor the point, how are you specifying the "criteria"?

I hope I'm explaining what's missing clearly.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 31, 2005 1:52 pm    Post subject: Reply with quote

Frank,

Your assumption is right. I would know the report id's when the job is executed (which is the criteria) such as RPT.012, RPT.023. Please let me know if you need any more information.

Cheers,
Coolman
________
headshop


Last edited by coolman on Sat Feb 05, 2011 1:41 am; edited 1 time in total
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 31, 2005 2:20 pm    Post subject: Reply with quote

As you stated, we can have them as a INCLUDE statement or use DFSORT symbols

Cheers,
Coolman
________
herbalaire


Last edited by coolman on Sat Feb 05, 2011 1:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 31, 2005 3:57 pm    Post subject: Reply with quote

Coolman,

Below is a DFSORT/ICETOOL job that will do what I think you want. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) to use the new DFSORT/ICETOOL IFTHEN, OVERLAY and KEEPBASE functions.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN       DD *
RPT.001
LINE 01
LINE 02
LINE 03
RPT.002
LINE 04
LINE 05
LINE 06
LINE 07
RPT.003
LINE 08
LINE 09
RPT.004
LINE 10
LINE 11
LINE 12
RPT.005
LINE 13
LINE 14
LINE 15
LINE 16
RPT.006
LINE 17
LINE 18
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT  DD DSN=...  output file
//TOOLIN   DD *
* Reformat records by group as follows:
* RPT.id1                 |RPT.id1|00000001|blanks |
* detail                  |blanks |00000001|tempnum|
* detail                  |blanks |00000001|tempnum|
* ...
* RPT.id2                 |RPT.id2|00000002|blanks |
* detail                  |blanks |00000002|tempnum|
* detail                  |blanks |00000002|tempnum|
* ...
  COPY FROM(IN) TO(T1) USING(CTL1)
* Use the group number to splice 'RPT.idn' from
* each header into its detail records as follows:
* RPT.id1                 |RPT.id1|00000001|blanks |
* detail                  |RPT.id1|00000001|tempnum|
* detail                  |RPT.id1|00000001|tempnum|
* ...
* RPT.id2                 |RPT.id2|00000002|blanks |
* detail                  |RPT.id2|00000002|tempnum|
* detail                  |RPT.id2|00000002|tempnum|
* ...
* Then do an INCLUDE using RPT.idn for the groups you want.
  SPLICE FROM(T1) TO(OUT) ON(88,8,ZD) -
    WITHALL WITH(1,80) KEEPBASE USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(88:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,4,CH,EQ,C'RPT.'),
                OVERLAY=(81:1,7,88:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(96:SEQNUM,8,ZD,
                         88:88,8,ZD,SUB,96,8,ZD,M11,LENGTH=8))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,
* Use an INCLUDE with 81,7,CH,EQ,C'RPT.idn' for the
* groups you want.
    INCLUDE=(81,7,CH,EQ,C'RPT.002',OR,
             81,7,CH,EQ,C'RPT.004',OR,
             81,7,CH,EQ,C'RPT.005'),
* Remove the copy of the report id, the group number
* and the temp number.
    BUILD=(1,80)
/*


The INCLUDE selects groups RPT.002, RPT.004 and RPT.005, so OUT contains:

Code:

RPT.002   
LINE 04   
LINE 05   
LINE 06   
LINE 07   
RPT.004   
LINE 10   
LINE 11   
LINE 12   
RPT.005   
LINE 13   
LINE 14   
LINE 15   
LINE 16   


Is that what you wanted?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Thu Mar 31, 2005 6:49 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Mar 31, 2005 4:34 pm    Post subject: Reply with quote

As always, Thanks Frank for your assistance. But I don't have the latest PTFs with me to use this one.

Cheers,
Coolman
________
los angeles dispensary


Last edited by coolman on Sat Feb 05, 2011 1:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 31, 2005 5:36 pm    Post subject: Reply with quote

Coolman,

Ask your System Programmer to install the Dec, 2004 PTF (it's free).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group