View previous topic :: View next topic
|
Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
This requirement cannot be fulfilled. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Is this must do requirement in DFSORT? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Bill,
if one test returns a 4 and one returns a 0, which return code do you test for ?
Gerry |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
|