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

Multiple Validations in a single sort step


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

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Tue Oct 18, 2011 10:39 pm
Reply with quote

Hello,

I have an input file oF 32 BYTES where 6 fields are comma seperated :

Code:

LAT,123456789,ABCD,XX999,22222,C
LAT,123456789,ABCD,XX999,22222,C
,123456789,ABCD,XX999,22222,C
LAT,111111111,ABCD,XX999,22222,C
LAT,123456789,ABCD,XX999,22222,C
LAT,123456789,ABCD,,22222,C
LAT,123456789,ABCD,XX999,,C


Valid record conditions :-
1. First 3 bytes must be LAT. If as in 3rd record, there is no LAT, then we have to apend LAT to that record and make it valid.
2. second field must always be equal to 123456789. Any other 9 byte will make the record invalid. In above file 4th record is invalid
3. 4th field must always have some values. As in 6th record if there is no value in that field, then that record is invalid.
4.5th field must always have some values. As in 7th record If there is no value in that field, then that record is invalid.
5. 6th field must be always a character 'C'

The records which satisfy all the above conditions must be written to OUTPUT.GOOD.FILE and any records which does not satisfy any one of the above validations must be written to OUTPUT.ERROR.FILE


Can this be achieved using a single sort step ?
If yes, how will my DFSORT code be ?

Thanks for all the help.

-
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: Tue Oct 18, 2011 11:03 pm
Reply with quote

Quote:
5. 6th field must be always a character 'C'


Show what this type of invalid record could look like. Could it look like this?

LAT,123456789,ABCD,XX999,,,

or like this:

LAT,123456789,ABCD,XX999

or both or some other way?

What is the RECFM of your input file?

Please show what you would expect in the two output files for your input example including the variations for missing C.
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Tue Oct 18, 2011 11:14 pm
Reply with quote

Hi Try this:

Code:


//SYSIN    DD *                                                       
 OPTION COPY                                                         
 INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=3),%02=(ENDBEFR=C',',FIXLEN=9),
              %03=(ENDBEFR=C',',FIXLEN=4),%04=(ENDBEFR=C',',FIXLEN=5),
              %05=(ENDBEFR=C',',FIXLEN=5),%06=(ENDBEFR=C',',FIXLEN=1))
 BUILD=(%01,C',',%02,C',',%03,C',',%04,C',',%05,C',',%06)             
 OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'   '),OVERLAY=(C'LAY'),             
        HIT=NEXT),                                                   
  IFTHEN=(WHEN=(5,9,ZD,NE,123456789),OVERLAY=(40:C'1'),HIT=NEXT),     
  IFTHEN=(WHEN=(20,5,CH,EQ,C'     '),OVERLAY=(40:C'1'),HIT=NEXT),     
  IFTHEN=(WHEN=(26,5,CH,EQ,C'     '),OVERLAY=(40:C'1'),HIT=NEXT)     
  OUTFIL FNAMES=T1,OMIT=(40,1,CH,EQ,C'1'),BUILD=(1,32)               
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Tue Oct 18, 2011 11:17 pm
Reply with quote

Oops...I missed the validation for 6th field to be 'C'.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top