IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Change Return code of a step based on the value of a field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Fri Feb 09, 2007 7:01 pm
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
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 Developer


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

PostPosted: Fri Feb 09, 2007 10:11 pm
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
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 Developer


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

PostPosted: Fri Feb 09, 2007 10:24 pm
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:

Use [URL] BBCode for External Links
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
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 Developer


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

PostPosted: Sat Feb 10, 2007 12:57 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top