Stuart Baker Software offers high quality consulting services and products to users of IBM PCs and compatibles (DOS and Windows)
    as well as Interdata, Perkin-Elmer and Concurrent Computer Corporation 3200 series machines (OS/32).

Using OS/32's Wildcards


Using OS/32's Wildcards

by Stuart Baker
Stuart Baker Software
9370 Golondrina Drive
La Mesa, CA 91941-5654
(619) 466-8811

This article outlines one approach you could use to implement wildcard file handling in the OS/32 R08-03 environment. Before getting started in the technical details, I would like to divert to the Interchange 90 conference. It was my pleasure to introduce the most vibrant and energetic speaker at the conference, Clifford Stoll -- the author of the "The Cuckoo's Egg". Cliff and I go back a long way. In the late 1970s we spent many hours on the phone discussing changes to the BIOC driver I created for OS/32. I even made several visits to the University of Arizona, Lunar and Planetary Lab where Cliff and I spent many enjoyable hours working on their Perkin-Elmer system. I finally have a chance to use the phrase "I knew him when ...". Cliff -- keep up the good work!

Now on to the technical discussion. As many of you know, I have been working with Interdata, Perkin-Elmer and Concurrent equipment since 1970. When I started to implement the wildcard code for my Kermit program, I discovered a definite lack of documentation. This lack of documentation cost me several hours of looking through source code. I hope the results of my research will benefit other programmers. Since I had unanswered questions, in spite of my considerable OS/32 experience, I am sure I am not alone.

So, how does one go about accessing file names using wildcards? Very carefully!! No, seriously, it is all in place and it all works, you just need to understand the quirks. For my implementation I created three routines: WC.INIT, WC.NEXT and WC.KILL. The following describes each of these routines.

The WC.INIT routine calls WC.KILL to insure no filenames remain queued by OS/32. The wildcard file name is then packed using a SVC 2 Code 16. The option I used for Kermit was X'4C', the bit you must set to handle wildcards is X'04'. If the condition code reflects good status, you are ready to start the filename search.

The wildcard search is performed using the X'FF07' option of the SVC 7. This option allows a user program to access data from the disk directory. Options define whether you receive just a filename or a complete directory entry. In addition, you may restrict searches to private group or system accounts. The equates and structures for this SVC 7 are found in the macro $SVC7EXT located in SYSSTRUC.MLB. In our example we request only filenames by setting the X07.XOP to X07X.FNO. You must also supply the address of a buffer that receives the filenames in X07.BUFF and the length of the buffer in X07.SIZ. If you request only filenames, the buffer must be a multiple of 12 bytes. After the SVC 7, the condition code indicates the status of the request. Since we want to access all files on all volumes we would code the condition code checking as follows:


* Handle filenames here ---

The filenames returned by this request are in disk directory format. This is where the fun begins. If your program does not have ACP privileges, you will not be able to use the data in its present format! The way around this dilemma is to use the SVC 2 Code 29 (option X'40' or X'00') to convert the filename to ASCII. You then use SVC 2 Code 16 to convert it back to the proper SVC 7 format. If your program runs from MTM, you need to perform a SVC 2 Code 19 Option 3 to determine if you are currently running with ACP enabled. If you do not have ACP privileges, you need to use option X'40' with the SVC 2 Code 29 to properly unpack the disk directory format. This option converts the directory format into the PGS format needed by your program. If you have ACP, you can use option X'00' to unpack the filenames.

This gets us to the WC.NEXT routine. Since you must convert the filename to ASCII, I chose to let WC.NEXT return the ASCII string instead of the SVC 7 format. You form the filename to unpack by combining the volume (X07.VOL) with the next 12 characters from your buffer. The X07.LXF field defines the number of characters of data returned by each SVC 7 request. Since you may use wildcards in the volume field, you must fetch the current volume from the X07.VOL field after each SVC 7 is issued. Returning the ASCII format makes implementation of a simple directory command a snap.

The last routine, WC.KILL simply issues a SVC 7 request with X07.XOP set to X07X.CAN. Issuing this SVC purges any remaining filenames from OS/32's queue. The kill is necessary in case a file transfer or directory display is aborted before all of the filenames have been accessed.

With these three routines in place, all you have to do is call WC.INIT with your wildcard file descriptor and then repeatedly call WC.NEXT until all file names have been accessed. This new facility offers great flexibility to OS/32 tasks. One can see the opportunity to use this facility in many different utilities. Since multiple volumes may be accessed, utilities like BACKUP, FASTCOPY and COPY32 could access multiple volumes in a single operation. Since programs can obtain the complete directory entry, the display files command could be enhanced outside the MTM environment. Keep up the good work on OS/32, I love the new features.

Well that about does it for this issue. It sure was a pleasure seeing so many of you at Interchange 90. I hope that the information in this article will save time for others out there that are venturing unto the world of wildcards. I am delighted that OS/32 finally offers non-privileged user tasks access to directory information.

Return to Index
Article Copyright 1980 Stuart J. Baker

This SBSW.COM page has been optimized for printing.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.

Please use our Feedback form to submit questions or comments about this web site.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.
This site was last modified: Wednesday, December 29, 2010