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 

Grouping records in DFSORT

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


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Wed Dec 17, 2008 7:50 am    Post subject: Grouping records in DFSORT Reply with quote

Hi

I am having a report file of record length 80. I need to extract all detail records of headers having "A" in position 1. Input file contains n number of different headers also.


INPUT:
Code:
AH
1
2
3
T
BH
4
5
6
T
CH
7
8
9
T
AH
0
T
EH
0
1
3
T


H ---> HEADER
T ---> TRAILER

REQUIRED OUTPUT:
Code:
AH
1
2
3
T
AH
0
T


I have created a 3 pass job for this.
Is it possible to do it in 2 pass or 1 pass?

Note: We do not have z/OS DFSORT V1R5 PTF UK90013 (July, 2008). So I cannot use WHEN=GROUP.

Thanks
One.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Dec 17, 2008 10:24 am    Post subject: Reply with quote

oneofspace,

The following DFSORT/ICETOOL JCL will give you the desired results. Since you don't have the latest PTF which supports Group functions we have to use splice to get the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL 
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//IN       DD *
AH     
1     
2     
3     
T     
BH     
4     
5     
6     
T     
CH     
7     
8     
9     
T     
AH     
0     
T     
EH     
0     
1     
3     
T                   
//OUT      DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SPLICE FROM(IN) TO(OUT) ON(81,8,CH) KEEPNODUPS KEEPBASE -     
  WITHALL WITH(01,80) USING(CTL1)                               
//CTL1CNTL DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),           
  IFTHEN=(WHEN=(2,1,CH,EQ,C'H'),OVERLAY=(81:SEQNUM,8,ZD,1,2)), 
  IFTHEN=(WHEN=NONE,OVERLAY=(89:SEQNUM,8,ZD,                   
          81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))                 
                                                               
  OUTFIL FNAMES=OUT,INCLUDE=(89,2,CH,EQ,C'AH'),BUILD=(1,80)     
/*     


If you had the the latest PTF, you can very easily split using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//STEP0200 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
AH                                                             
1                                                               
2                                                               
3                                                               
T                                                               
BH                                                             
4                                                               
5                                                               
6                                                               
T                                                               
CH                                                             
7                                                               
8                                                               
9                                                               
T                                                               
AH                                                             
0                                                               
T                                                               
EH                                                             
0                                                               
1                                                               
3                                                               
T                                                               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,1,CH,EQ,C'H'),PUSH=(81:1,2))
  OUTFIL INCLUDE=(81,2,CH,EQ,C'AH'),BUILD=(1,80)               
/*                                                             


Ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

Hope this helps...

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


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Thu Dec 18, 2008 12:59 am    Post subject: Reply with quote

Dear Kolusu

Marvelous..... Very Happy

I have a doubt. Whether any changes need to be done in control card if the record format is FBA?

Thanks
One.
Back to top
View user's profile Send private message
oneofspace
Beginner


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Thu Dec 18, 2008 8:18 am    Post subject: Reply with quote

Dear Kolusu

One more question.
We are having a cobol program to do the above said requirement.
File details are lrecl is 133, record format is FBA, contains more than 1.3 million records.

Just to replace the cobol program I tried DFSORT.

Considering TOTAL CPU TIME, Cobol program takes .00 and our new job takes .03. So people are not accepting. Sad .....

I am much eager to know the reason. Could you please explain?

Thanks
One.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Dec 18, 2008 11:23 am    Post subject: Reply with quote

oneofspace wrote:
Considering TOTAL CPU TIME, Cobol program takes .00 and our new job takes .03. So people are not accepting. Sad .....

I am much eager to know the reason. Could you please explain?

Thanks
One.


Are you sure you got the cpu time right? Even though we are splicing I have SORT FIELDS=COPY override on splice which is basically does a copy and more efficient. I would like to see the complete sysout of the job including JES messages.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Thu Dec 18, 2008 11:55 am    Post subject: Reply with quote

Quote:
I have a doubt. Whether any changes need to be done in control card if the record format is FBA?


FBA records have a carriage control character in position 1, so the data actually starts in position 2. You would have to adjust the starting positions of all of the fields accordingly, and account for the different LRECL.

Quote:
Are you sure you got the cpu time right? Even though we are splicing I have SORT FIELDS=COPY override on splice which is basically does a copy and more efficient.


Not to mention that the OP couldn't use the WHEN=GROUP solution which would be even more efficient.
_________________
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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Dec 19, 2008 2:42 pm    Post subject: Reply with quote

In an offline note, the original poster indicated he's using Syncsort, not DFSORT, so I don't know why he's saying he tried DFSORT. And obviously, the reason he can't use WHEN=GROUP is because he doesn't have DFSORT.
_________________
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