MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
karupps Beginner Joined: 18 May 2005 Posts: 11 Topics: 3
Posted: Thu Nov 10, 2005 6:51 am Post subject: How to skip first & last records
Hi,
I want to copy the file into another file except first & last record.
Please let me know how to achieve.
Back to top
karupps Beginner Joined: 18 May 2005 Posts: 11 Topics: 3
Posted: Thu Nov 10, 2005 7:49 am Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Thu Nov 10, 2005 8:16 am Post subject:
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
karupps Beginner Joined: 18 May 2005 Posts: 11 Topics: 3
Posted: Thu Nov 10, 2005 8:35 am Post subject:
Thanks Kolusu!
Back to top
vkphani Intermediate Joined: 05 Sep 2003 Posts: 483 Topics: 48
Posted: Thu Nov 10, 2005 9:01 am Post subject:
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
karupps Beginner Joined: 18 May 2005 Posts: 11 Topics: 3
Posted: Fri Nov 11, 2005 5:37 am Post subject:
Thanks Kolusu & Vkphani!
If the file is VB file what will be solution.
Karupps
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Fri Nov 11, 2005 8:35 am Post subject:
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
karupps Beginner Joined: 18 May 2005 Posts: 11 Topics: 3
Posted: Sat Nov 12, 2005 1:25 am Post subject:
Thanks Kolusu!
Now working fine.
Once again thanks for your valuable solution.
Cheers,
Karupps
Back to top
LeoFender Beginner Joined: 01 Mar 2006 Posts: 1 Topics: 0
Posted: Wed Mar 01, 2006 2:26 pm Post subject: Sort
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
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Aug 05, 2008 6:18 pm Post subject:
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
Sqlcode Intermediate Joined: 15 Dec 2006 Posts: 157 Topics: 38
Posted: Wed Aug 06, 2008 12:34 pm Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Wed Aug 06, 2008 2:14 pm Post subject:
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
Sqlcode Intermediate Joined: 15 Dec 2006 Posts: 157 Topics: 38
Posted: Wed Aug 06, 2008 2:23 pm Post subject:
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
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Aug 06, 2008 2:32 pm Post subject:
Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 (it's free). It's not going to get installed by magic. _________________ 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
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