Posts

Showing posts with the label Ab Initio examples

S) Output index example

Image
 Input Data               Reformat   Count =3   /*Function returning index of output port*/   output_index_ out :: output_index (in)=   begin   output_index_ out :: if( in.gender =="M")0 else if ( in.gender =="F") 1 ;   end;    

S ) string_replace example

Image
      1A- id   1A- id   1|2| 3  replace to 1||2||3     Reformat     begin   Out.id : : String_replace (in.id ,”| ” ,”| |””);   End   Or   Reformat     begin   Out.id : : string_join ( string_split_no_empty (in.id ,”| ”) ,”| |”);   E nd   1B   In the 2 nd example input file1 to input7 contain one one letter like (1----7) if you are gathering all the input file using reformat and pass the  select condition next_in_sequence () <5 then what will  be the out put .   Ans --4      

S) Reformat and normalize example -- Input : 1,2,3-7,8,9

Image
 Input : 1,2,3-7,8,9 Output : 1 2 3 4 5 6 7 8 9  Solution  let decimal ( 4)val 1 =0;   let decimal ( 4)val 2 =0;   let decimal ( 4)diff =0;     out:: reformat(in)=   begin   if ( string_index (in.id, "-" ))           begin           val1 = string_substring ( string_replace ( string_substring (in.id, 1,string _index(in.id, "-" )-1), "," , " " ),1,1);           val2= string_substring ( string_replace ( string_substring ( in.id,string_index (in.id, "-" )+ 1,string _length(in.id)), "," , "" ),3,1);           diff =(val2-val 1)+ 1;           end     else diff =1;     out.id : : if ( string_index (in.id, "-" )> 0) val 1  else in.id;     out.diff :: diff;     end ;   Normalize   out:: len...