Highlighted
Respected Contributor.
Respected Contributor.
220 views

User-id or name

Jump to solution

Is there a library routine to get the User-ID or name from a Print file that a User has Created?

As the new normal is working from Home users want to just view there own print files which are in a spoollib folder.

I have looked @ I$IO and C$Fileinfo to no avail unless I missed something.

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

They are using different logons for each user. These were Wang programs that were converted to MF by Unicon out in CA. Let me change a program to open the printfile just by using straight MF code. Currently they are opened by a sub-routine in each program.I will let you know what happens. Spoollib is never recreated where the print files are created. They are purged off and transferred to backup folders. Do you think I should recreate the Spoollib folder using ???

Thanks

 

View solution in original post

0 Likes
15 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: User-id or name

Jump to solution

ACCEPT SYSTEM-INFORMATION FROM SYSTEM-INFO

will provide user-id

On Windows this uses the Windows API function GetUserName 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

I need the name or user-id associated with this print file.

 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

Here is a print file.

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: User-id or name

Jump to solution

I take it this is on Windows. If so, can you use dir

dir [<Drive>:][<Path>][<FileName>] [...] [/p] [/q] [/w] [/d] [/a[[:]<Attributes>]][/o[[:]<SortOrder>]] [/t[[:]<TimeField>]] [/s] [/b] [/l] [/n] [/x] [/c] [/4]

Parameters

TABLE 1

Parameter

Description

[<Drive>:][<Path>]

Specifies the drive and directory for which you want to see a listing.

[<FileName>]

Specifies a particular file or group of files for which you want to see a listing.

/p

Displays one screen of the listing at a time. To see the next screen, press any key on the keyboard.

/q

Displays file ownership information.

/w

Displays the listing in wide format, with as many as five file names or directory names on each line.

/d

Displays the listing in the same format as /w, but the files are sorted by column.

/a[[:]<Attributes>]

Displays only the names of those directories and files with the attributes that you specify. If you omit /a, dir displays the names of all files except hidden and system files. If you use /a without specifying Attributes, dir displays the names of all files, including hidden and system files.

The following list describes each of the values that you can use for Attributes. Using a colon (:) is optional. Use any combination of these values, and do not separate the values with spaces.

   d Directories

   h Hidden files

   s System files

   l Reparse points

   r Read-only files

   a Files ready for archiving

   i Not content indexed files

   - Prefix meaning "not"

/o[[:]<SortOrder>]

Sorts the output according to SortOrder, which can be any combination of the following values:

   n By name (alphabetical)

   e By extension (alphabetical)

   g Group directories first

   s By size (smallest first)

   d By date/time (oldest first)

   - Prefix to reverse order

TABLE 2
 

 

Note

Using a colon is optional. Multiple values are processed in the order in which you list them. Do not separate multiple values with spaces.

If SortOrder is not specified, dir /o lists the directories in alphabetic order, followed by the files, which are also sorted in alphabetic order.

/t[[:]<TimeField>]

Specifies which time field to display or use for sorting. The following list describes each of the values you can use for TimeField:

c Creation

a Last access

w Last written

/s

Lists every occurrence of the specified file name within the specified directory and all subdirectories.

/b

Displays a bare list of directories and files, with no additional information. /b overrides /w.

/l

Displays unsorted directory names and file names in lowercase.

/n

Displays a long list format with file names on the far right of the screen.

/x

Displays the short names generated for non-8dot3 file names. The display is the same as the display for /n, but the short name is inserted before the long name.

/c

Displays the thousand separator in file sizes. This is the default behavior. Use /-c to hide separators.

/4

Displays years in four-digit format.

/?

Displays help at the command prompt.

Remarks

  • To use multiple FileName parameters, separate each file name with a space, comma, or semicolon.

  • You can use wildcard characters (* or**?**), to represent one or more characters of a file name and to display a subset of files or subdirectories.

    Asterisk (*): Use the asterisk as a substitute for any string of characters, for example:

    • dir *.txt lists all files in the current directory with extensions that begin with .txt, such as .txt, .txt1, .txt_old.

    • dir read*.txt lists all files in the current directory that begin with "read" and with extensions that begin with .txt, such as .txt, .txt1, or .txt_old.

    • dir read*.* lists all files in the current directory that begin with "read" with any extension.

    The asterisk wildcard always uses short file name mapping, so you might get unexpected results. For example, the following directory contains two files (t.txt2 and t97.txt):

    C:\test>dir /x
    Volume in drive C has no label.
    Volume Serial Number is B86A-EF32
    
    Directory of C:\test
    
    11/30/2004  01:40 PM <DIR>  .
    11/30/2004  01:40 PM <DIR> ..
    11/30/2004  11:05 AM 0 T97B4~1.TXT t.txt2
    11/30/2004  01:16 PM 0 t97.txt
    

    You might expect that typing dir t97* would return the file t97.txt. However, typing dir t97* returns both files, because the asterisk wildcard matches the file t.txt2 to t97.txt by using its short name map T97B4~1.TXT. Similarly, typing del t97* would delete both files.

    Question mark (?): Use the question mark as a substitute for a single character in a name. For example, typing dir read???.txt lists any files in the current directory with the .txt extension that begin with "read" and are followed by up to three characters. This includes Read.txt, Read1.txt, Read12.txt, Read123.txt, and Readme1.txt, but not Readme12.txt.

  • Specifying file display attributes

    If you use /a with more than one value in Attributes, dir displays the names of only those files with all the specified attributes. For example, if you use /a with r and -h as attributes (by using either /a:r-h or /ar-h), dir will only display the names of the read-only files that are not hidden.

  • Specifying file name sorting

    If you specify more than one SortOrder value, dir sorts the file names by the first criterion, then by the second criterion, and so on. For example, if you use /o with the e and -s values for SortOrder (by using either /o:e-s or /oe-s), dir sorts the names of directories and files by extension, with the largest first, and then displays the final result. The alphabetic sorting by extension causes file names with no extensions to appear first, then directory names, and then file names with extensions.

  • Using redirection symbols and pipes

    When you use the redirection symbol (>) to send dir output to a file or a pipe (|) to send dir output to another command, use /a:-d and /b to list the file names only. You can use FileName with /b and /s to specify that dir is to search the current directory and its subdirectories for all file names that match FileName. Dir lists only the drive letter, directory name, file name, and file name extension (one path per line), for each file name it finds. Before you use a pipe to send dir output to another command, you should set the TEMP environment variable in your Autoexec.nt file.

  • The dir command, with different parameters, is available from the Recovery Console.

Examples

To display all directories one after the other, in alphabetical order, in wide format, and pausing after each screen, make sure that the root directory is the current directory, and then type:

dir /s/w/o/p

Dir lists the root directory, the subdirectories, and the files in the root directory, including extensions. Then, dir lists the subdirectory names and file names in each subdirectory in the tree.

To alter the preceding example so that dir displays the file names and extensions, but omits the directory names, type:

dir /s/w/o/p/a:-d

To print a directory listing, type:

dir > prn

When you specify prn, the directory list is sent to the printer that is attached to the LPT1 port. If your printer is attached to a different port, you must replace prn with the name of the correct port.

You can also redirect output of the dir command to a file by replacing prn with a file name. You can also type a path. For example, to direct dir output to the file dir.doc in the Records directory, type:

dir > \records\dir.doc

If dir.doc does not exist, dir creates it, unless the Records directory does not exist. In that case, the following message appears:

File creation error

To display a list of all the file names with the .txt extension in all directories on drive C, type:

dir c:\*.txt /w/o/s/p

Dir displays, in wide format, an alphabetized list of the matching file names in each directory, and it pauses each time the screen fills until you press any key to continue.

Additional references

Command-Line Syntax Key

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

Well here is what I got. I was hoping I would get the username. (APWIRES should be adaanen)

Doc_0-1588704505468.png

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: User-id or name

Jump to solution

I saved your file, which changed who the owner is, when I used dir /q filename I saw this

dir /q 2778593.txt
Volume in drive C is Windows
Volume Serial Number is 309C-706F

05/05/2020 10:58 AM 250,267 CORPDOM\SHjerpe 2778593.txt

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

Well here is what I get, always administrators which is the group they are in.

Any other ideas?

Doc_1-1588706055045.png

 

 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

Here is what I get with all files in spoollib.

There is only one (me) that has a user-name of sklotz.

Doc_0-1588706412827.png

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: User-id or name

Jump to solution

How are these spool files created? I assume that they are created with the credentials of the user creating the file, just like most files.

If the files are written to a server using AcuServer (C$COPY), then it is the user running AcuServer that will own the files.

If the files are created by a runtime host controlled by a thin client, then the files will be owned by the user that started AcuRCL.

With one caveat - in both server cases, there is a way to connect to the server as the actual logged in user of the client machine. If the SECURITY-METHOD variable is set to LOGON, then the user will actually have to enter their domain credentials when connecting. In that case, both AcuServe and AcuRCL will impersonate that user whenever they have control, in particular when writing (or reading) files, and files created in this mode should be owned by the real user, not by the AcuRCL or AcuServe user.

Of course, doing this requires users to do an additional step when connecting to the server. If this is not something you want to do, then you will need to write the application in such a way that print files like this get named on the server with some unique identifier per workstation so that you can determine who owns which file.

If the files are not created using AcuServer or AcuThin, then the way they are created will still change the answer to this question, so more information would be helpful.

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: User-id or name

Jump to solution

The files are created via cobol programs using version 10.3.0.

Any other info you need?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: User-id or name

Jump to solution

Are all users logged into Windows as the same user? Is there some other process that copies the files after the COBOL program creates them? It seems that the directory is not a standard Windows directory. But I suppose you are calling the Windows spooler to create the files.

I'm just trying to understand why all of the files are owned by Administrator. Without actual user information, there probably isn't any way to distinguish the files created by me than the files created by you.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.