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 

How to skip first & last records

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


Joined: 18 May 2005
Posts: 11
Topics: 3

PostPosted: Thu Nov 10, 2005 6:51 am    Post subject: How to skip first & last records Reply with quote

Hi,

I want to copy the file into another file except first & last record.

Please let me know how to achieve.
Back to top
View user's profile Send private message
karupps
Beginner


Joined: 18 May 2005
Posts: 11
Topics: 3

PostPosted: Thu Nov 10, 2005 7:49 am    Post subject: Reply with quote

My input record is like this:

H 12456 646665
D 101 ABC 456
D 102 CBG 789
D 103 FTR 967
T 0005

i want only Detail records .
The rectype might not be same (H,D,T) for all the files. It may be (0,5,9,etc..)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Nov 10, 2005 8:16 am    Post subject: Reply with quote

karupps,

The following JCL will give you the desired results.
Code:

//STEP0100  EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*
//SORTIN    DD DSN=YOUR INPUT DSN,
//             DISP=SHR                                     
//SORTOUT   DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN     DD *                                           
  OPTION SKIPREC=1                                         
  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(SEQNUM,8,ZD,START=0,INCR=1,80:X)           
  OUTFIL NODETAIL,REMOVECC,                                 
  TRAILER1=(C'  OPTION COPY,SKIPREC=1,STOPAFT=',1,8,80:X)   
/*                                                         
//STEP0200  EXEC PGM=SORT                                 
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD DSN=YOUR INPUT DSN,
//             DISP=SHR                                   
//SORTOUT   DD SYSOUT=*                                   
//SYSIN     DD DSN=&T1,DISP=OLD                           
/*


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
karupps
Beginner


Joined: 18 May 2005
Posts: 11
Topics: 3

PostPosted: Thu Nov 10, 2005 8:35 am    Post subject: Reply with quote

Thanks Kolusu!
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Nov 10, 2005 9:01 am    Post subject: Reply with quote

If your shop has DFSORT then this will give you the desired result.

Code:

//S1       EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
1                                                               
2                                                               
3                                                               
4                                                               
5                                                               
//SYM      DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *                                             
  OPTION COPY                                                   
  INREC OVERLAY=(81:SEQNUM,8,ZD)                               
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,OUTREC=(80X),             
    TRAILER1=('LAST,+',COUNT=(M11,LENGTH=8))                     
  OUTFIL FNAMES=T1                                             
//S2       EXEC  PGM=SORT                                       
//SYSOUT   DD  SYSOUT=*                                         
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                         
//SORTIN   DD DSN=&&T1,DISP=(OLD,PASS)                         
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD    *                                             
  OPTION COPY                                             
  INCLUDE COND=(81,8,ZD,NE,+1,AND,81,8,ZD,NE,LAST)     
  OUTREC FIELDS=(1,80)                                                 
/*                                                             


The output will be

2
3
4
Back to top
View user's profile Send private message Send e-mail
karupps
Beginner


Joined: 18 May 2005
Posts: 11
Topics: 3

PostPosted: Fri Nov 11, 2005 5:37 am    Post subject: Reply with quote

Thanks Kolusu & Vkphani!

If the file is VB file what will be solution.

Karupps
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Nov 11, 2005 8:35 am    Post subject: Reply with quote

Quote:

If the file is VB file what will be solution.


karupps,

Try these jobs:

Code:

//STEP0100  EXEC PGM=SORT                                 
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD DSN=YOUR INPUT VB FILE,       
//             DISP=SHR                                   
//SORTOUT   DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN     DD *                                         
  OPTION SKIPREC=1                                         
  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(1,4,SEQNUM,8,ZD,START=0,INCR=1,80:X)     
  OUTFIL VTOF,                                             
  OUTREC=(1,4,SEQNUM,8,ZD,START=0,INCR=1,80:X),           
  NODETAIL,REMOVECC,                                       
  TRAILER1=(C'  OPTION COPY,SKIPREC=1,STOPAFT=',5,8,80:X) 
/*                                                       
//STEP0200  EXEC PGM=SORT                                 
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD DSN=YOUR INPUT VB FILE,       
//             DISP=SHR                                   
//SORTOUT   DD SYSOUT=*                                   
//SYSIN     DD DSN=&T1,DISP=OLD                           
/*                                 


vkphani's DFSORT solution:

Code:

//S1       EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=YOUR INPUT VB FILE,
//            DISP=SHR                                         
//SYM      DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1       DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *                                               
  OPTION COPY                                                   
  INREC FIELDS=(1,4,SEQNUM,8,ZD,5)                               
  OUTFIL FNAMES=SYM,VTOF,                                       
     OUTREC=(80X),                                                 
     REMOVECC,NODETAIL,                                             
     TRAILER1=('LAST,+',COUNT=(M11,LENGTH=8))                       
  OUTFIL FNAMES=T1                                               
//S2       EXEC  PGM=SORT                                       
//SYSOUT   DD  SYSOUT=*                                         
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                           
//SORTIN   DD DSN=&&T2,DISP=(OLD,PASS)                           
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD    *                                               
  OPTION COPY                                               
  INCLUDE COND=(5,8,ZD,NE,+1,AND,5,8,ZD,NE,LAST)       
  OUTREC FIELDS=(1,4,13)                                               
/*                                   


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
karupps
Beginner


Joined: 18 May 2005
Posts: 11
Topics: 3

PostPosted: Sat Nov 12, 2005 1:25 am    Post subject: Reply with quote

Thanks Kolusu!

Now working fine.

Once again thanks for your valuable solution.

Cheers,
Karupps
Back to top
View user's profile Send private message
LeoFender
Beginner


Joined: 01 Mar 2006
Posts: 1
Topics: 0

PostPosted: Wed Mar 01, 2006 2:26 pm    Post subject: Sort Reply with quote

Alright, then what if we want to keep the header and trailer?

H rec
7
3
8
5
T rec

sorts into

H rec
3
5
7
8
T rec
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 01, 2006 2:45 pm    Post subject: Reply with quote

The "Sort records between a header and trailer" Smart DFSORT Trick shows how to do this with DFSORT:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
_________________
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: Tue Aug 05, 2008 6:18 pm    Post subject: Reply with quote

If you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use the new SUBSET operator to remove the header and trailer, and the new DATASORT operator to sort the data records between the header and trailer.

To remove the header and trailer (FB or VB):

Code:

SUBSET FROM(IN) TO(OUT) INPUT REMOVE HEADER TRAILER


To sort the records between the header or trailer (FB or VB) - supply the SORT statement you need:

Code:

DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
//CTL1CNTL DD *
   SORT FIELDS=(6,10,CH,A)


For complete details on the new DATASORT and SUBSET functions and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
_________________
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
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 12:34 pm    Post subject: Reply with quote

Frank,
We have DFSORT V1R5 in our shop but how do I find out if PTF UK90013 (July, 2008) patch has been installed or not?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Aug 06, 2008 2:14 pm    Post subject: Reply with quote

rajen,

Run the following DFSORT/ICETOOL job and look at the ICE201I message in DFSMSG. If it has an F after ICE201I, you have PTF UK90013.

Code:

ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1


If it has an E after ICE201I, you don't have PTF UK90013.

Code:

//STEP0100 EXEC PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                     
//DFSMSG   DD SYSOUT=*                     
//IN       DD *                             
12345                                       
12345                                       
22222                                       
//OUT      DD SYSOUT=*                     
//TOOLIN   DD *                             
  SELECT FROM(IN) TO(OUT) ON(01,5,CH) FIRST
//*                                         


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
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 2:23 pm    Post subject: Reply with quote

Oopss.. Can't play with it right now. It has E after ICE201I

ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
.
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 Aug 06, 2008 2:32 pm    Post subject: Reply with quote

Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 (it's free). It's not going to get installed by magic. Smile
_________________
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