View previous topic :: View next topic
|
Author |
Message |
kingofmainframes Warnings : 2 New User
Joined: 09 Apr 2006 Posts: 20 Location: Chennai
|
|
|
|
Is it posssible to set the return code of a step based on a the field value?
File1 - VSAM KSDS 4 Bytes key
0000YYY
If any of the character in 5th, 6th & 7th character is not equal to Y set the return code to 12.
IF 5th chracter is not equal to Y then display ' 5th field ' in JESMSGLG of the job or SORTOUT or SYSOUT. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The third example of the "Set RC=12 or RC=4 if file is empty, has more than n records, etc" trick in Smart DFSORT Tricks shows an OMIT/INCLUDE being applied, so I'd say the answer to your first question is "yes".
The second might be doable, but I'll let you work on that one..... |
|
Back to top |
|
|
kingofmainframes Warnings : 2 New User
Joined: 09 Apr 2006 Posts: 20 Location: Chennai
|
|
|
|
Hi Williams,
Thanks. I am getting many more queries after refering to the example you suggested. Kindly clarify.
File1 - VSAM KSDS 4 Bytes key
0000YYY
SYSIN DD *
OPTION COPY
INCLUDE COND=(1,4,CH,EQ,C'0000')
/*
By using the above control card I can get 1 copy of record with key '0000'.
Query
1) Is it possible to get 10 copies of the 1 record I select from file1 in 1 step?
2) Assume SORTIN for the above control card has 100 records. Will DFSORT scan all the records in SORTIN? or It directly reads the record with key '0000'? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you want just one copy of the '0000' record, you can use:
Code: |
INCLUDE COND=(1,4,CH,EQ,C'0000')
OPTION COPY,STOPAFT=1
|
If you want 10 copies of the '0000' record, you can use:
Code: |
INCLUDE COND=(1,4,CH,EQ,C'0000')
OPTION COPY,STOPAFT=10
|
DFSORT will stop reading records when the STOPAFT count is satisfied. So if it finds 10 records in the first 50 records, it will stop after 50 records. |
|
Back to top |
|
|
kingofmainframes Warnings : 2 New User
Joined: 09 Apr 2006 Posts: 20 Location: Chennai
|
|
|
|
Hi Frank,
Thanks for your reply. I meant to ask whether the same record can be copied to the SORTOUT dataset 10 times in one step.
eg,
File1
0000yyy
0001yyy
0002sss
SORTOUT
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy
0000yyy |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Yes. Here are the DFSORT statements:
Code: |
OPTION COPY
INCLUDE COND=(1,4,CH,EQ,C'0000')
OUTFIL REPEAT=10
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
kingofmainframes Warnings : 2 New User
Joined: 09 Apr 2006 Posts: 20 Location: Chennai
|
|
|
|
Hi Frank,
Ok Thanks.
If I give INCLUDE COND as shown below for a VSAM KSDS file with key length 4, Will DFSORT scan all the records in SORTIN? or It directly reads the record with key '0000'? Kindly clarify
Code: |
SYSIN DD *
OPTION COPY
INCLUDE COND=(1,4,CH,EQ,C'0000')
/* |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It reads all of the records. |
|
Back to top |
|
|
|