Whats the best way in a AI GRAPH to read the header 1st line and trailer (last line) in a i/p file, compare record counts and checksum (available in header) and error out if actual recd count or checksum did not match?

Showing Answers 1 - 6 of 6 Answers

bhanu

  • Aug 31st, 2006
 

we can use run compononent in the parameters tab for commandline give unix AWK command for skipping the specified record num

awk '{if(NR!=1  && NR!=2) print $0}' this we can use for first record

or else we can use onemore component read seperated value in the parameters tab u can specify skipheader as true

This is upto my knowledge

Thanks

Bhanu

  Was this answer useful?  Yes

dontbuckme

  • Sep 22nd, 2006
 

If the input dml has record type, simply do FBE will do.

If the input dml has no record type, but with "n" as End of Record, do a wc -l up front and pass the result back to the graph will do the trick.

Otherwise, you need to assign a sequence number (next_in_sequence) using Reformat, also capture the log port for the record count.  Then:

Header: sequence number=1

Do a join with the source data (say in0) and from the record count capture from the previous Reformat log port (say, in1).

Trailer: in0.sequencenumber=in1.reccount

  Was this answer useful?  Yes

mukund

  • Dec 22nd, 2006
 

guys,

 to read header ,detail,trailer from input file separately ,do validatins for these,

use conditional dml,where we can separate detail from header and trailer

for validations u have to use reformat with count :3(out0:header,Out1:detail,Out2:trailer.)

if any doubts further let me know

cheers

mukund

  Was this answer useful?  Yes

anujaja

  • Aug 25th, 2009
 

You can also use a keyless Dedup with keep parameter as first.
This will put header in output port and rest of the record on Dup port . Then connect dup port again with another dedup and use Keep parameter as last this will remove trailer as well.

  Was this answer useful?  Yes

sham2sushil

  • Dec 16th, 2009
 

anujaja, use only one dedup sort. in dedup sort use the select statement "next_in_sequence > 1" and use keyless Dedup "{}"With keep paramete "last". this will remove trailer, you will get all the body part from the "dup" port

-Shambhu

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions