View previous topic :: View next topic
|
Author |
Message |
charavind17
New User
Joined: 24 Sep 2008 Posts: 30 Location: chennai
|
|
|
|
i have file in which i want to fetch 1st 3rd records using jcl.. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Using which program in your JCL, anything specific, or any utility that can do that ?
Is the file a VSAM file or non VSAM, tape or DASD ? |
|
Back to top |
|
|
charavind17
New User
Joined: 24 Sep 2008 Posts: 30 Location: chennai
|
|
|
|
VSAM file..any utility is also ok.. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
From experience, you can either use IDCAMS or SORT.
This has been discussed a few times, selecting certain records, so may I suggest a search of the forum or google and then some trial and error, and let us know which utility you have chosen and any problems that you need help with. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
charavind17,
The below might help...
Code: |
//STEP0001 EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
2
3
4
5
6
7
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL SAMPLE=2
/*
|
Output:
Thanks. |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
Hy charavind17,
it's not that difficult: make an IDCAMS REPRO
//* allocate first an empty file
//REPRO EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//IN1 DD DSN=INPUT,DISP=SHR
//OUT1 DD DSN=OUTPUT,DISP=MOD
//SYSIN DD *
REPRO INFILE(IN1) OUTFILE(OUT1) COUNT(1)
REPRO INFILE(IN1) OUTFILE(OUT1) COUNT(1) SKIP(2)
/*
regards,
martin9 |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
martin9,
I tried IDCAMS approach but it gave output like below:
Thanks. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can do this kind of thing quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(1) RRN(3)
/*
|
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramsri,
Quote: |
i have file in which i want to fetch 1st 3rd records using jcl.. |
It's not quite clear which one do you want.
1) 1st and 3rd records.
2) 1st 3 records.
In either case you can achieve by experimenting on what you have right now. Goodluck. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi, arcvns.
I posted the SORT solutio and tried the IDCAMS to just check
I prefer using SORT only.
Thanks. |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
Hy ramsri,
it's just what charavind17 actually wants...
"i have file in which i want to fetch 1st 3rd records using jcl.."
now with my example, there is a new file with the first and the
third record. like in the SORT from Frank Yaeger, you will also get
a new file with the first and third record.
What is now really the intention of charavind17?????????????????
regards,
martin9 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
The Subject line seems clear:
Quote: |
fetch 1st and 3rd record in a file |
|
|
Back to top |
|
|
|