Code useful to open a file

No votes yet

Write the code in PeopleCode Action:
&FileName = ;
&ret = GetAttachment("RECORD://CSGC_CSHT_ATACH", &FileName, "/" | &FileName, "PS_SERVDIR", True);
&PS_SERVDIR = (GetEnv("PS_SERVDIR")) | "/";
&FilePath = &PS_SERVDIR | &FileName;

If &ret = %Attachment_Success And
FileExists(&FilePath, %FilePath_Absolute) Then

&TxtFile = (GetFile(&FilePath, "R", %FilePath_Absolute));

While &TxtFile.ReadLine(&Input)
&Input = LTrim(RTrim(&Input, " "), " ");
;
End-While;
End-If;

&TxtFile.Close();

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
16 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.