Posted: Mon Oct 09, 2006 3:29 am Post subject: move one file if search is successfull
My requirement is to search for a particular field in a FILE A.
If my search is successfull then I need to move FILEB to the output file else FILEC to the output file.
1.Search 3 character field('LEA or FBA or VAB) from postion 50 to 52 in FILEA
2.If present move file B to output file
3.Search ('EDA' or DEA') in FILE A.
4.If present move file c to the output file.
How do i do this with sort.
can anyone help me as earlier.
I thought of using IDCAMS.First search the field 'LEA or FBA or VAB' and copy it to a file.Using IDCAMS I check for the presence of file content in it.Then based on the condition code I will use either FILE B OR FILE C.
But Iam looking for the solution which does all these things in a single step.
Either CTL1 or CTL2 will be true in this case.Hence only one output file is possible here.If CTL1 is true then I have to stop CTL2 processing or the vice-versa.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Oct 09, 2006 8:31 am Post subject:
radkrish,
Try this job . Step0100 will set a return code of 4 when include condition results in an empty file. And it excuetes the step0200. If step0100 was succesful , ie. if it finds the included records , step0200 will be skipped for the condition codes check. Also pay attention to the Disp parameters.
Thanks for the reply.
But I shall explain the query again.
1.Consider 3 input files FILEA,FILEB,FILEC and one output file FILED.
1.Search field from postion 50 to 52 in FILEA.
2.If it is found then we need to move/copy FILEB(not FILEA) to the outfile FILED.
3.Similarly,If it is not found,then move/copy FILEC(not FILEA) to the outfile FILED.
In my code,INPUT1 is searched,either OUT1or OUT2 is moved to OUT3 based on the search criteria.
I ran it thru ICETOOL,
Code:
CE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
CE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
CE000I 0 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 10:06 ON MON OCT
SORT FIELDS=COPY
INCLUDE COND=(50,3,SS,NE,C'GES,OV,SDC')
OPTION NULLOUT=RC4
$
CE095A 0 INVALID OPTION STATEMENT OPERAND
CE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
well! thatz fine.
As your valuable reply moved away from the expected result,I tried the option NULLOUT using ICETOOL.Only then I come to know that it should be specifically used with SORT alone.As I need the result in minimal number of steps(thought of finishing it in one single step),I tried different options.Using IDCAMS,it takes 4 steps.These 3 steps is minimal comparably.Thanks for all your replies.
It would be even better if it is possible to be done with one or 2 steps which would avoid me to write a program(that satisfies the reqmt in one single step in JCL).
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Oct 09, 2006 10:54 am Post subject:
radkrish,
FYI, you got the error message for NULLOUT because it is only supported by z/OS DFSORT V1R5 and above, but you're using DFSORT R14. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Oct 10, 2006 10:28 am Post subject:
Getting RC=0 or RC=12 for the COUNT operator with EMPTY is what makes this job work. MODE checks the RC to determine what to do next. (The use of EMPTY to get RC=0 or RC=12 for my job is similar to the use of NULLOUT=RC4 to get RC=0 or RC=4 for Kolusu's job).
If you get a match in FILEA for CDE, FDR or RT, but not MKK, MOV or GFV, OUT will have the records from FILEB and you'll get RC=12 for the job.
If you get a match in FILEA for MKK, MOV or GFV, but not for CDE, FDR or RT, OUT will have the records from FILEC and you'll get RC=12 for the job.
If you get a match in FILEA for CDE, FDR or RT, and for MKK, MOV or GFV, OUT will have the records from FILEB and FILEC you'll get RC=0 for the job.
If you don't get a match in FILEA for CDE, FDR, MKK, MOV or GFV, OUT will not have any records and you'll get RC=12 for the job. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum