Retrieve Odd(1st,3rd..) records from file- SORT JCL OUTFIL
Moderators: Frank Yaeger, DikDude, Moderator Group
-
- Member
- Posts: 13
- Joined: Mon Oct 26, 2009 12:00 pm
Retrieve Odd(1st,3rd..) records from file- SORT JCL OUTFIL
Hi,
I have been asked in one interview that, how to retrieve the odd (1st,3rd,5th....) records from the PS file using DFSORT.
I dont know the answer for this question. If anybody knows the answer means, please help me.
Thanks.
I have been asked in one interview that, how to retrieve the odd (1st,3rd,5th....) records from the PS file using DFSORT.
I dont know the answer for this question. If anybody knows the answer means, please help me.
Thanks.
The best way I can think of is the SPLIT command:
OUTFIL Control Statements:
OUTFIL Control Statements:
Code: Select all
//ODD DD DSN=...
//EVEN DD DUMMY
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=(ODD,EVEN),SPLIT
/*
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
This DFSORT job would be the "best" way:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
http://www.ibm.com/support/docview.wss? ... g3T7000080
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTFIL SAMPLE=2
/*
http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
"Best" (in my opinion) because it doesn't need the extra DUMMY DD statement and doesn't need to write the even records. With the SPLIT method, DFSORT has to write the odd and even records. With SAMPLE, DFSORT only has to write the odd records. So there's less I/O with the SAMPLE method.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
CRISP and CLEAR Answer
Thank u for the effort...MrSpock wrote:The best way I can think of is the SPLIT command:
OUTFIL Control Statements:Code: Select all
//ODD DD DSN=... //EVEN DD DUMMY //SYSIN DD * OPTION COPY OUTFIL FNAMES=(ODD,EVEN),SPLIT /*
---------
RAGHUL
RAGHUL
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
raquliit,
if your desire is to split 1 file into 2,
then you have your answer,
though you would have to modify the dd statement for the second file
and add the necessary dd parms.
but, if you want only 1 output file containing every other record
you managed to mis-read the complete thread
and arrive at the incorrect conclusion.
you do realize that Frank was a DFSORT developer for IBM?
and I would value his answer over anyone else.
especially, since he went to the trouble to explain his answer
and provide the technical reasons for his comment.
if your desire is to split 1 file into 2,
then you have your answer,
though you would have to modify the dd statement for the second file
and add the necessary dd parms.
but, if you want only 1 output file containing every other record
you managed to mis-read the complete thread
and arrive at the incorrect conclusion.
you do realize that Frank was a DFSORT developer for IBM?
and I would value his answer over anyone else.
especially, since he went to the trouble to explain his answer
and provide the technical reasons for his comment.
Last edited by dbzTHEdinosauer on Thu Jul 19, 2012 7:33 pm, edited 1 time in total.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
"though you titled your post CRISP and CLEAR AnswerdbzTHEdinosauer wrote:raquliit,
for your first post,
you managed to mis-read the complete thread
and arrive at the incorrect conclusion.
though you titled your post CRISP and CLEAR Answer
the only thing that is CRISP and CLEAR
is that your skills are rather dull and disappointing.
the only thing that is CRISP and CLEAR
is that your skills are rather dull and disappointing."
Could not get the above lines clearly?
---------
RAGHUL
RAGHUL
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
To be expected. If you could, you wouldn't have made your initial post the initial post that you made.raguliit wrote:Could not get the above lines clearly?
Clear enough?
What is "CRISP and CLEAR" anyway? You advertising something? One symptom is the dumb pointless "positive" message tagged on to an old thread. Certainly fits your post.
Clear enough?
This has gotten rather out of hand. . .
RAGHUL's first post was just a thank you for the CRISP and CLEAR reply(ies) to the original question - posted a while back.
Due to our ever present language challange, this
"though you titled your post CRISP and CLEAR Answer
the only thing that is CRISP and CLEAR
is that your skills are rather dull and disappointing."
was not clear to RAGHUL and was so noted.
fwiw,
d
RAGHUL's first post was just a thank you for the CRISP and CLEAR reply(ies) to the original question - posted a while back.
Due to our ever present language challange, this
"though you titled your post CRISP and CLEAR Answer
the only thing that is CRISP and CLEAR
is that your skills are rather dull and disappointing."
was not clear to RAGHUL and was so noted.
fwiw,
d
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
DikDude,
who cares if it is CLEAR and CRISP if it is wrong????
there is no language problem,
his disappointing and dull skills are being able to read and comprehend.
he liked the idea of a quick answer, even though it was the wrong solution to use.......
who cares if it is CLEAR and CRISP if it is wrong????
there is no language problem,
his disappointing and dull skills are being able to read and comprehend.
he liked the idea of a quick answer, even though it was the wrong solution to use.......
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
How is a "thank you" wrong?who cares if it is CLEAR and CRISP if it is wrong????
Unless i have missed something this is all that was posted (other than quoting the post the thanks was for):
The CRISP and CLEAR referred to the quality of the "solution", nothing else.Thank u for the effort...
Unless i am completely misunderstanding something . . .
Have a good one
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
If I think practically, when would one need to split any given file in to two halves or just to get the old/even records?
Possibly, never required in producation, in "real life" requirements. Possibly just one time requirement or/and a test-data-creation kinda exercise. Personally, if this is needed for such an exercise - I'd not be botherd about I/O in this age of Mainframe computing unless I'm dealing with billions of input-records.
Possibly, never required in producation, in "real life" requirements. Possibly just one time requirement or/and a test-data-creation kinda exercise. Personally, if this is needed for such an exercise - I'd not be botherd about I/O in this age of Mainframe computing unless I'm dealing with billions of input-records.
Regards,
Anuj
Anuj
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page