|
View previous topic :: View next topic
|
| Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
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 |
|
 |
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
| Oops...I missed the validation for 6th field to be 'C'. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|