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 

Select only the first group of records

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


Joined: 25 Mar 2007
Posts: 11
Topics: 4
Location: Switzerland

PostPosted: Mon Dec 14, 2009 12:33 pm    Post subject: Select only the first group of records Reply with quote

Hi,
I search a trick to extract (only) the first group of records in a file. The not selected should be saved in a separate output data set.
The input file has no headers or trailers. The group-key has a length from 10 characters.

I found only solutions with the "GROUP=" clausel. But here i need a header-record.

All files have following format:
RECFM=FB, LRECL=80

Example (input file):
Code:
Daniel
Daniel
Daniel
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James


Desired output file 1:
Code:
Daniel
Daniel
Daniel


Desired output file 2:
Code:
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James


Is this possible with dfsort or icetool?
thank you in advance

hungerbuehler
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: Mon Dec 14, 2009 5:35 pm    Post subject: Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
Daniel
Daniel
Daniel
Max
Max
Max
Max
Tommy
Tommy
Rita
Rita
James
James
James
/*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,10))),
    IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(81:ID=8))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)
/*

_________________
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
hungerbuehler
Beginner


Joined: 25 Mar 2007
Posts: 11
Topics: 4
Location: Switzerland

PostPosted: Sat Dec 19, 2009 9:06 am    Post subject: Reply with quote

Hi Frank,

Thank you very much.
It works absolute perfect.

Best regards
hungerbuehler
Back to top
View user's profile Send private message
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