• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

FindFirst, FindNext, FindClose in PeopleSoft on Unix

Christian Audet

Moderator
Staff member
Hi All,

I already made some business function using FindFirst, FindNext to loop thru file on my disk with success. Now the problem is when I want to create a E-One process that do the same on the unix server.

What I want to do ?
----------------------------------------
I'm want to create a process (probably a UBE) that will delete files (4 to 7 bytes text files) on the E-One Unix Server based on the date of the file. Those file get created by one of our custom apps and we want to keep them for a week maximum. The process I want to implement will delete every day the file that are more than a week old.

Example :delete files 5 days old and over.

Did I worked on it ?
-----------------------------------------
I created the pseudo code and ready to code it, I understand all the logic I need, I already work with findfirst, findnext and findclose, the problem is that those function are not working in Unix.

Have I done some research ?
--------------------------------------------

Yes ! My research in peoplesoft lead my to a lot of B96*** BFSN which are all "1" (client only), of course because they use findfirst and findnext.

Other research on the Internet lead me to use opendir(), readdir() and closedir() from dirent.h, is that right ? I'm not sure yet but I'm trying to find out.

Did I code something ?
------------------------------------------
I did not even code anything yet. My concern is how can I use this (assuming these are the right functions) from a Peoplesoft Business Function. dirent.h does not exist on my machine which I guess is normal if this is a UNIX library only.

That's where I am, I think that these function may be a solution but I never created a Peoplesoft business function that use unix only function and did not find anything understandable on the subject.


Is there a alternative solution ?
-------------------------------------------
Yes ! creating a unix script to delete old file every night may be a quick solution but if we ever want to delete on something else that the date stamp which reside in peoplesoft only then it will not be possible.

Any advise will be appreciated and if any information is missing from this message it will be my pleasure to provide it to you.

Christian Audet
 

jolly

Reputable Poster
Heh. I actually wrote a paper on this very subject!

The short answer is that Unix has no equivalent to the Win32 findfiles APIs. You need to use readdir() and fnmatch().

Here's the full story in the attachment.

Cheers,
JohnO
 

Attachments

Christian Audet

Moderator
Staff member
Nice Document John,

Thank You, I'm reading your document tonight and let you know as soon as I test it.

Christian Audet
 

vinodasp

Member
Hi Jolly,

It is indeed very nice document.
I had some queries can you tell me?

I need to read the flat file on local Win32 machine from the Peoplesoft client machine which is Thin client web version and needs to upload in the table UNIX Enterprise server. Is it possible by developing some code or BSFN in Peoplesoft itself?
If yes can you please let me know how to do it?
Thanks for sharing the information it was worth knowing it.
 

jolly

Reputable Poster
I think the best way to do that would be to keep the flat file in a shared folder. Then your code running on some other Win32 platform can open that file by URL, e.g. \\machine\share\filename.txt or similar.

I don't recall what if any standard BSFN is available to read the flat file but you can easliy write one if you can code C. Just find-in-files in the source directory for "fopen" and you will see lots of examples.
 
Top