Submitted by Syd Nicholson on Mon, 07/28/2008 - 00:00
Forums

I am creating a simple document handling system with IceBreak and have a question regarding the IFS and symbolic links. Perhaps there is somebody that can help.

I need to know how many symbolic links a file has, and, what the path names of these links are.

For example - consider a doument called POList.doc located in a central directory or "repository". This document has two links to other locations - say - /Customer/myCustID/Documentname and /Jobs/myJobNumber/DocumentName.

The question is - using the IFS APIs, how can I find out what the links are for document POList.doc?

There are no obvious options that I can see in the IBM documentation.

I can work backwoards from the symbolic link to its root document, but I can't find a way to work forwards from the root document and find all its symbolic links.

Many thanks in advance for any suggestions received.
Syd Nicholson

Bent Rønne

Mon, 07/28/2008 - 00:00

Syd,
I think you have a problem! There is no attributes telling relations to “children” of an IFS object. You can not even find anything useful on the Sym-Link (“child”) object.
I hope another can give you an idea here. It is a pure OS problem and has nothing directly to do with IceBreak.

Good luck.

Bent

Thanks Bent,

Yes I know it is not directly related to Icebreak - I was just hoping somebody might have an answer.

I can get the number of links a file has from stat(), but I cannot find out what those links are. There are interactive tools - WRKLNK and DSPLNK that provide this info, but I can't find any APIs for use in a 'batch' (non-green screen) program.

I have similar problem with CHKOUT and CHKIN. On a green screen one can find out whether a file is checked out and by whom, but there does not seem to be an API with this information.

Definitely something missing from the OS. I am currently searching for a PASE (AIX) command that provides this info. If such a command exists then I can pipe the output into into a text file and use this in my program.

Regards
Syd

The attr command lists the attributes of an ifs file.

To find out if a file is checked out, who checked it out, and when then attr provides the answer. The output from the command can be piped into a text file:

qsh attr /myDir/myFile > /anotherDir/myOutput.txt

In the example above myOutput.txt contains the output of the attr command.

I still cannot find anything that lists the links a specific ifs file has. The search continuums

Syd

i'll look around but the best you might find is to

 

 
 DSPLNK OUTPUT(*PRINT) OBJTYPE(*SYMLNK) DETAIL(*EXTENDED)

 

and parse the spooled file.

Experience has it's benefits...unfortunately by the time you acquire it you've forgotten what you needed it for -Tommy Holden

Thanks Tom,

Actually, I am aware of this option and at a pinch it will need to use it.

I always feel that generating a spool file and then reading the contents is rather messy and an API is much cleaner.

Also the process requiring this information is interactive and involves a potentially large list of IFS objects. The results need to be converted to json and sent to client browser. There is lot of processing involved and performance may become an issue.

Another problem with this approach is that the format of the spool file is also not guaranteed, and IBM, in their ultimate wisdom, are likely to change it in future releases or PTFs. This causes support issues in commercial software. APIs do not usually suffer from this disadvantage.

I will keep looking, but I have the feeling it is a lost cause.

One possibility I have thought of is journalling. When links are added or removed a journal entry is created. Using a journal exit program I could update a DB file with the required info, the journal and its exit program will keep this information current. A sledgehammer to crack a nut perhaps - but imune to OS release updates.

Regards
Syd

Originally Posted by Syd Nicholson:
"I can work backwoards from the symbolic link to its root document, but I can't find a way to work forwards from the root document and find all its symbolic links"

may not be ideal however... you could build a temp file (stream file or PF) containing the path/link and the object it points to then refer back to that using the object name (i think a PF would be easier than lseek() ).

just a thought...that way you won't have to rely on the spooled file layout. but i've used spooled output for many output to *PRINT through the years and i can honestly say i've never been bitten by it. IBM is very good at backward compatibility. (of course i look for key words in the spooled file vs. an RRN type approach)
 

Experience has it's benefits...unfortunately by the time you acquire it you've forgotten what you needed it for -Tommy Holden