pick

Extracting information from a file variable in d3 pick basic


I have a file variable in d3 pick basic and I am trying to figure out what file it corresponds to.

I tried the obvious thing which was to say:

print f *suppose the file variable's name is f in this case

but that didn't work, because:

SELECTION: 58[B34] in program "FILEPRINTER", Line 7:  File variable used 
where string expression expected.

I also tried things like:

list f *didn't compile
execute list dict f *same error
execute list f *same error

but those also did not work.

In case any one is wondering, the reason I am trying to do this in the first place is that there is a global variable that is passed up and down in the code base I am working with, but I can't find where the global variable gets its value from.


Solution

  • That file pointer variable is called a "file descriptor". You can't get any information from it.

    You can use the file-of-files to log Write events, and after a Write is performed by the code, check to see what file was updated. The details for doing this would be a bit cumbersome. You really should rely on the Value-Add Reseller or contract with competent assistance for this.

    If this is not a live end-user system, you can also modify an item getting written with some very unique text like "WHAT!FILE!IS!THIS?". Then you can do a Search-System command to search the entire account (or system) to find that text. See docs for proper use of that command.

    This is probably the best option... Inject the following:

    IF @USER = "CRISZ" THEN ; * substitute your user ID
      READU FOO FROM F,"BLAH" ELSE
        DEBUG
        RELEASE F,"BLAH"
      END
    END
    

    That code will stop only for one person - for everyone else it will flow as normal. When it does stop, use the LIST-LOCKS command to see which file has a read lock for item "BLAH". That's your file! Don't forget to remove and recompile the code. Note that recompiling code while users are actively using it results in aborts. It's best to do this kind of thing after hours or on a test system.

    If you can't modify the code like that, diagnostics like this can be difficult. If the above suggestions don't help, I think this challenge might be beyond your personal level of experience yet and recommend you get some help.

    If suggestion here Does help, please flag this as the answer. :)