Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Multiple Validations in a single sort step

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Multiple Validations in a single sort step
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 Moderator


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

PostPosted: Tue Oct 18, 2011 11:03 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us