Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Change Return code of a step based on the value of a field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kingofmainframes
Warnings : 2

New User


Joined: 09 Apr 2006
Posts: 20
Location: Chennai

PostPosted: Thu Feb 08, 2007 11:27 pm    Post subject: Change Return code of a step based on the value of a field
Reply with quote

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
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 09, 2007 7:01 pm    Post subject:
Reply with quote

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". icon_biggrin.gif
The second might be doable, but I'll let you work on that one.....
Back to top
View user's profile Send private message
kingofmainframes
Warnings : 2

New User


Joined: 09 Apr 2006
Posts: 20
Location: Chennai

PostPosted: Fri Feb 09, 2007 9:35 pm    Post subject: Re: Change Return code of a step based on the value of a fie
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Feb 09, 2007 10:11 pm    Post subject:
Reply with quote

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
View user's profile Send private message
kingofmainframes
Warnings : 2

New User


Joined: 09 Apr 2006
Posts: 20
Location: Chennai

PostPosted: Fri Feb 09, 2007 10:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Feb 09, 2007 10:24 pm    Post subject:
Reply with quote

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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
kingofmainframes
Warnings : 2

New User


Joined: 09 Apr 2006
Posts: 20
Location: Chennai

PostPosted: Fri Feb 09, 2007 10:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Feb 10, 2007 12:57 am    Post subject:
Reply with quote

It reads all of the records.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us