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

step to end with return code of 1 if a condition is met


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madishpa

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Thu Jun 27, 2013 9:32 pm
Reply with quote

I want to end the step with return code of 1 , if the following condition is met

Input file:

06/27/2013
USERNAME X
USERNAME X

Input file Record format is FB and record lenght is 12.

First record in the file is header and it only contains date in the format MM/DD/YYYY

Staring from the second record are the detail lines

Month in the header date should be current month and first 8 bytes in the detail lines should be 'USERNAME' in every record ,
If these conditions are met , then the step should end with retrun code of 1.
I dont want any data to be written in the output file.
What date function can be used in DFSORT for this requirement.

Thanks
Madishpa
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jun 27, 2013 9:45 pm
Reply with quote

This requirement cannot be fulfilled.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 27, 2013 11:04 pm
Reply with quote

Is this must do requirement in DFSORT?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 27, 2013 11:57 pm
Reply with quote

I'm impressed that someone who has been on this forum for 6 years has not:

1. paid attention to the numerous other posts that have CLEARLY stated that DFSORT only sets certain return codes, and 1 is not one of them

2. figured out how to read the DFSORT / ICETOOL manuals (for which there is a link at the top of this page) and found the specific return codes that can be set by DFSORT / ICETOOL.

madishpa. you actually have several choices:
- give up on the idea of having a return code of 1 for your sort and accept the return code DFSORT / ICETOOL generates
- give up on the idea of using DFSORT / ICETOOL and use a language that will allow you to set a return code of 1
- accept that getting a return code of 1 is not possible with DFSORT / ICETOOL and hence what you have asked is not at all possible, period.
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Fri Jun 28, 2013 12:09 am
Reply with quote

Return code of 4 is also fine , I just want to end with a different return code other than 0 ,so that I can control the execution of next steps
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 28, 2013 5:04 am
Reply with quote

Hi,

give this a try
Code:

//STEP0001 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
06/27/2013                                                 
USERNAME X                                                 
USERNAME X                                                 
//SORTOUT  DD DUMMY                                       
//SYSIN    DD *                                                                                 
    OPTION COPY,STOPAFT=1                                 
    INREC OVERLAY=(13:DATE1)                               
    OUTFIL NULLOFL=RC4,INCLUDE=(1,2,CH,NE,17,02,CH)       
/*                                                         
//STEP0002 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
06/27/2013                                                 
USERNAME X                                                 
USERNAME X                                                 
//SORTOUT  DD DUMMY                                       
//SYSIN    DD *                                                                               
    OPTION COPY,SKIPREC=1                                 
    OUTFIL NULLOFL=RC4,INCLUDE=(1,8,CH,NE,C'USERNAME')     
/*                                                         



Gerry
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 28, 2013 12:00 pm
Reply with quote

Yes. If desired, can be done in one step by adding a sequence number and using that for OUTFIL INCLUDE/OMIT to keep the two separate tests distinct.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 28, 2013 12:41 pm
Reply with quote

Hi Bill,

if one test returns a 4 and one returns a 0, which return code do you test for ?


Gerry
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 28, 2013 2:08 pm
Reply with quote

Sorry Gerry.

When I saw INCLUDE with NE I thought "that's OMIT" and didn't look any further :-)

OMIT all the good data, gives 4 if file is OK, 0 if not.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 28, 2013 10:34 pm
Reply with quote

gcicchet wrote:
Hi Bill,

if one test returns a 4 and one returns a 0, which return code do you test for ?


Gerry


Gerry,

As Bill mentioned you can use sequence number validate the records and set the return code in a single step.

1. Add a seqnum and a constant "P"
2. Using IFTHEN validate the seqnum=1 and see if the file date has current month and if not OVERLAY the constant to a space.
3. Similary validate the seqnum>2 and see if the first 8 bytes is username and if not replace the constant with space.

Now Use OUTFIL OMIT the values with "P" and set the return code to 4. So if all records matched the conditions you will have an empty file, if not you will have the space records.

You also don't need to use DATE1 to validate the current month, you just need a dynamic system symbol with &LMON and you can use that to filter out 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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top