Aug 20, 2012

PeopleSoft : PeopleCode to find special characters in file other than ASCII characters


Local string &File_path, &File_path1;

&File_path = "C:\temp\ascii.xml";
&bud_rep = GetFile(&File_path, "r", %FilePath_Absolute);
&File_path1 = "C:\temp\ascii_1.txt";
&bud_rep1 = GetFile(&File_path1, "a", %FilePath_Absolute);
&count = 0;

While &bud_rep.readline(&line)
   &line1 = Len(&line);
   &count = &count + 1;

   For &i = 1 To &line1
      &char = Substring(&line, &i, 1);
      &naciichar = Code(&char); /* returns the number corresponds to character */
      /* check whether the character is in the range of ascii char's or not */
      If &naciichar >= 128 Or
            &naciichar < 0 Then
         &bud_rep1.writeline(&count | " " | &char); /* write special character to file */
      End-If;

   End-For;

End-While;

No comments:

Post a Comment