Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BLASTed directory locks, timing windows & endless loops

19 views
Skip to first unread message

Richard Maher

unread,
Jun 8, 2003, 11:40:06 AM6/8/03
to
Hi Jim

Thanks for the info, it was right on the money!

(Curiously a $search or DIR needs the lock 3 times and a DELETE or CREATE
only needs it twice?)

Can you please help with a couple of final issues: -

1) I now get told when "something" happens on a given directory and I also
check (if the second longword of the LVB has changed) if the file I'm
looking for has arrived, but I need to know when the creation of the file
has completed as opposed to started. So what I'm after is a run-of-the-mill,
missionary-position file-lock. This seems not to be the arbitration lock
that Keith Paris has talked about previously, and is very hard to track
down. (SDA> sh proc/locks Doesn't work 'cos PID is zero. And SDA> show locks
doesn't have any F11B$a locks) What is the resource name and access mode
for a simple *File* Lock?

2) Where can I find the documantation for lck$m_recover and lck$m_protect?
In this instance I don't particularly want to use this functionality but
Kernel mode locks have this annoying habit of surviving image exit and even
if I go th UWSS route my KRNL rundown routine would have to be pretty
sophisticated to track multiple File Watches and $DEQs. How to ensure
housekeeping is done with these locks? Force process exit?

3) 'Cos it's Kernel mode, do I have to ensure that my Blocking AST is
$lkpaged in memory so that a need to swap it in won't crash the machine. Am
I getting paranoid? I remember reading in the Hitchhikers Guide (or similar)
about a TSR Calendar and I had an Old BECOME routine (pre-persona system
services) that used to do this. Does anyone have a handy Kernel mode 101
cheat sheet?

Thanks again for the help!

Cheers Richard Maher

Message 5 in thread
From: Jim Brankin (Date: 2003-05-15 02:10:18 PST


The Book
========

'VMS File Systems Internals' by Kirby McCoy. It is out of print but
you might be able to pick up a used copy. It is a bit out of date now
too so you cannot rely on it 100%

The Data Structure
==================

The LVB on the serialisation lock can be viewed as

Struct { long fc_hdrseq;
long fc_dataseq;
long unused1;
long unused2;
}

The first long is incremented when the file header (or headers) is
changed. The second is only used with directories. It is incremented
when the directory data is changed. The file system uses these to
maintain its caches. When it serialises on a file it looks at the
sequence counter and, if it has not changed since it last had the
serialisation lock, it knows it can use its header or directory cache.
If it has changed then another node has been working on the file and
the cache has to be reloaded.

The New File System
===================

This had been mentioned here a few times. For instance

http://groups.google.com/groups?selm=3e3ff9c2%241_2%40hpb10302.boi.hp.com

The blurb on the planned new file systems book also hints at a new
file system.

See

http://www.amazon.com/exec/obidos/ASIN/1555582699/qid%3D1052988945/sr%3D11-1
/ref%3Dsr%5F11%5F1/002-1890565-7847252#product-details

I would be very suprised if it is Spiralog.


- Jim


Keith Parris

unread,
Jun 9, 2003, 11:40:36 AM6/9/03
to
"Richard Maher" <mahe...@hotspamnotmail.com> wrote in message news:<bbvlcl$e7i$1...@titan.btinternet.com>...

> 1) I now get told when "something" happens on a given directory and I also
> check (if the second longword of the LVB has changed) if the file I'm
> looking for has arrived, but I need to know when the creation of the file
> has completed as opposed to started. So what I'm after is a run-of-the-mill,
> missionary-position file-lock. This seems not to be the arbitration lock
> that Keith Parris has talked about previously, and is very hard to track

> down. (SDA> sh proc/locks Doesn't work 'cos PID is zero. And SDA> show locks
> doesn't have any F11B$a locks) What is the resource name and access mode
> for a simple *File* Lock?

How about the RMS file lock? (Documented in the IDSM appendix on "Lock
and resource use by OpenVMS Components") Resource name is of the form
RMS$<FileID><sharing_flag><device_name> (where sharing_flag is a byte
with value 2 for a volume mounted /SYSTEM). I expect that lock will
be held until the file population is completed.

Chris Scheers

unread,
Jun 9, 2003, 4:33:11 PM6/9/03
to


Page faults are allowed during AST delivery and execution.

However, if you raise your IPL above IPL$_ASTDEL, it is necessary to
lock any pages accessed at eleveated IPL.

It is probably not necessary to $LCKPAG the pages. It is sufficient to
$LKWSET the pages as long as the code that uses them is scheduled as
part of your process.

-----------------------------------------------------------------------
Chris Scheers, Applied Synergy, Inc.

Voice: 817-237-3360 Internet: ch...@applied-synergy.com
Fax: 817-237-3074

Richard Maher

unread,
Jun 12, 2003, 1:56:23 AM6/12/03
to
Hi Keith,

I just don't seem to be able to find these locks with SDA. What am I doing
wrong?

Could you please go to one session and do a $create x.x and then go to
another session and do a SDA> show locks/brief/name="your choice" or SDA>
show proc/locks so that I can see an example resource name?

Regards Richard Maher

Keith Parris <keithparr...@yahoo.com> wrote in message
news:cf15391e.03060...@posting.google.com...

Richard Maher

unread,
Jun 12, 2003, 1:56:38 AM6/12/03
to
Thanks.
Chris Scheers <ch...@applied-synergy.com> wrote in message
news:3EE4EF07...@applied-synergy.com...

Keith Parris

unread,
Jun 12, 2003, 1:40:37 PM6/12/03
to
"Richard Maher" <mahe...@hotspamnotmail.com> wrote in message news:<bc94m7$mg7$1...@sparta.btinternet.com>...

> I just don't seem to be able to find these locks with SDA. What am I doing
> wrong?

It appears I gave you a bum steer on the RMS$ lock idea. Sorry. See
below.

> Could you please go to one session and do a $create x.x and then go to
> another session and do a SDA> show locks/brief/name="your choice" or SDA>
> show proc/locks so that I can see an example resource name?

OK. On node SKYWAY I did:

SKYWAY $ create x.x
This is a test This is a test

and on second thought did a control-T to get the process name:

SKYWAY::PARRIS 12:59:30 CREATE CPU=00:00:00.20 PF=746 IO=415
MEM=188

and then just left it hanging there. In another session on the same
node:

SKYWAY $ sh us parris/full
OpenVMS User Processes at 12-JUN-2003 12:31:05.64
Total number of users = 1, number of processes = 3

Username Node Process Name PID Terminal
PARRIS GALXY1 PARRIS 248105C1 TNA100:
PARRIS SKYWAY PARRIS 2A800514 TNA8:
PARRIS SKYWAY _TNA9: 2A800515 TNA9:

Ignoring the session on another node, and looking for the matching
process name "PARRIS", we know the process ID of interest is 2A800514.
(This other session we're using must be 2A800515.)

SKYWAY $ anal/sys

OpenVMS (TM) Alpha system analyzer

SDA> set proc/id=2A800514
SDA> show proc/chan

Process index: 0114 Name: PARRIS Extended PID:
2A800514
--------------------------------------------------------------------


Process active channels
-----------------------

Channel CCB Window Status Device/file accessed
------- --- ------ ------ --------------------
0010 7FBF0000 00000000 DSA99:
0020 7FBF0020 827DD040
$1$DGA149:[VMS$COMMON.SYSEXE]CREATE.EXE;1
0030 7FBF0040 824AD200
$1$DGA149:[VMS$COMMON.SYSLIB]LIBOTS.EXE;1 (section file)
0040 7FBF0060 00000000 Busy TNA8:
0050 7FBF0080 824AD180
$1$DGA149:[VMS$COMMON.SYSLIB]LIBRTL.EXE;1 (section file)
0060 7FBF00A0 00000000 TNA8:
0070 7FBF00C0 82820F80 DSA99:[PARRIS]X.X;3
0090 7FBF0100 824C21C0
$1$DGA149:[VMS$COMMON.SYSEXE]DCL.EXE;1 (section file)
00A0 7FBF0120 824AD000
$1$DGA149:[VMS$COMMON.SYSLIB]DCLTABLES.EXE;365 (section file)

Total number of open channels : 9.

We see the open channel to the file X.X. (Guess how many times I
tried the $CREATE command before I found what I was looking for... :-)
)

SDA> show proc/lock

Process index: 0114 Name: PARRIS Extended PID:
2A800514
--------------------------------------------------------------------
%SDA-I-NOPRLOCK, no locks taken out by this process
SDA>

Uh-oh, this isn't going to be easy. The locks aren't owned by the
process. Must be kept by the XQP. We'll have to go fishing.

Most resource names associated with files use some form of the File
ID, so let's find that out:

SKYWAY $ dir/file_id x.x

Directory USRD:[PARRIS]

X.X;3 (162261,1,0)
X.X;2 (162260,1,0)
X.X;1 (162259,1,0)

Total of 3 files.

$DIRECTORY gives the File ID as (File Number, Sequence number,
Relative Volume Number). These values are in decimal. SDA will
display them in hexadecimal.

SKYWAY $ x = 162261
SKYWAY $ show sym x
X = 162261 Hex = 000279D5 Octal = 00000474725

So the hex value of the File Number will be 0279D5. The RVN is 00
(we're not on a Bound Volume Set), and the Sequence Number will be
0001.

In memory, a File ID is stored in an odd manner, because it was
extended at one time. The order as stored is: File number extension
(top byte), Relative Volume Number (1 byte) File sequence number (2
bytes), and low-order 2 bytes of the File Number, which would appear
in order in our case as 02 00 0001 79D5 .

Another way the File ID may be represented in lock names is the Lock
Basis, which discards the Sequence Number and fits the RVN and
contiguous File Number into a single longword: RVN (1 byte), File
number (3 bytes), which would appear in memory as 00 0279D5 .

The disk volume name often appears in resource names, so I need to
know what that is:

SKYWAY $ show dev usrd

Device Device Error Volume
Free Trans Mnt
Name Status Count Label
Blocks Count Cnt
DSA99: Mounted 0 USERDISK1
1204379 2 10
$10$DUA962: (GALXY1) ShadowSetMember 0 (member of DSA99:)
$10$DUA963: (GALXY1) ShadowSetMember 0 (member of DSA99:)

So the volume name is "USERDISK1".

I pop back into SDA, and do:

SKYWAY $ ANAL/SYS
SDA> SET OUTPUT TEMP.FILE
SDA> SHOW LOCKS/ALL
SDA> EXIT

and then search TEMP.FILE for the volume name and File ID, keeping in
mind that they may be split across lines or fields in SDA's output.
Since the File ID and Lock Basis have different formats, searching for
the low-order two bytes (79D5) has a better chance of success.
"RDISK1" proved to be a good string to search for the volume name.

I didn't find any RMS locks (probably because this file is not open
for shared access?) but did find some associated XQP locks:
---
Lock id: 2E00445D PID: 00000000 Flags: VALBLK
CONVERT NOQUEUE
Par. id: 00000000 SUBLCKs: 0 SYNCSTS
NOQUOTA CVTSYS
LKB: FFFFFFFD.773B5880 BLKAST: 81910158
Priority: 0000

Granted at EX 00000000-FFFFFFFF

RSB: FFFFFFFD.775C6480
Resource: 53556124 42313146 F11B$aUS Status: NOQUOTA
VALBLKR VALBLKW
Length 22 20314B53 49445245 ERDISK1
Kernel mode 00000002 79D52020 Õy....
System 00000000 00000000 ........

Local copy
---
Referring to the "Lock and Resource Usage by OpenVMS Components"
appendix in the IDSM, this one looks like a File Access Arbitration
Lock. Its resource name is of the form
F11B$a<volume_name_blank_filled><lock_basis> and it's a root lock
(see, the parent Lock ID is zero), system-owned, kernel mode,
EXclusive mode lock.

Here's another:
---
Lock id: 29004471 PID: 00000000 Flags: VALBLK
CONVERT SYNCSTS
Par. id: 01000CA4 SUBLCKs: 0 CVTSYS
LKB: FFFFFFFD.77452A80 BLKAST: 00000000
Priority: 0000

Granted at NL 00000000-FFFFFFFF

RSB: FFFFFFFD.7713D380
Resource: 79D57324 42313146 F11B$sÕy Status: NOQUOTA
VALBLKR VALBLKW
Length 10 00000000 00000002 ........
Kernel mode 00000000 00000000 ........
System 00000000 00000000 ........

Process copy of lock 2400A67D on system 00010053 (GALXY2)
---
This appears to be a File Serialization lock, and its resource name is
of the form F11B$s<lock_basis>. Note that it has a Parent Lock with
Lock ID 01000CA4 -- let's look at that:
---
Lock id: 01000CA4 PID: 00000000 Flags: CONVERT
SYNCSTS CVTSYS
Par. id: 00000000 SUBLCKs: 13
LKB: FFFFFFFD.772D5080 BLKAST: 818D57E0
Priority: 0000

Granted at CR 00000000-FFFFFFFF

RSB: FFFFFFFD.77349B80
Resource: 53557624 42313146 F11B$vUS Status: NOQUOTA
VALBLKR VALBLKW
Length 18 20314B53 49445245 ERDISK1
Kernel mode 00000000 00002020 ......
System 00000000 00000000 ........

Process copy of lock 01008C3D on system 00010053 (GALXY2)
---
This looks to be a Volume Allocation Lock, with a resource name of the
form F11B$v<volume_name_blank_filled>. This is a root resource (its
parent Lock ID is zero), and our lock is one of the 13 sub-locks.

You could probably use either of these two paths, but it looks like
the easiest lock for you to use is probably the File Access
Arbitration Lock, since you don't have to dig down a level and sift
through several sub-locks to find that.

David Froble

unread,
Jun 12, 2003, 11:03:35 PM6/12/03
to
Keith Parris wrote:

> "Richard Maher" <mahe...@hotspamnotmail.com> wrote in message news:<bc94m7$mg7$1...@sparta.btinternet.com>...
>
>>I just don't seem to be able to find these locks with SDA. What am I doing
>>wrong?
>>
>
> It appears I gave you a bum steer on the RMS$ lock idea. Sorry. See
> below.

Can I get you guys to back up a bit and explain what you're trying to do? I
may, or may not, have something to contribute.

Dave

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. Fax: 724-529-0596
DFE Ultralights, Inc. E-Mail: da...@tsoft-inc.com
T-Soft, Inc. 170 Grimplin Road Vanderbilt, PA 15486

Jim Brankin

unread,
Jun 15, 2003, 8:21:05 AM6/15/03
to
David Froble <da...@tsoft-inc.com> wrote in message news:<3EE93F07...@tsoft-inc.com>...
> Keith Parris wrote:

> Can I get you guys to back up a bit and explain what you're trying to do? I
> may, or may not, have something to contribute.
>

The problem is to send an event to a process when a file is closed.

One way is to queue for a the arbitration lock on the file. The lock
name is make up of

"F11B$a" + <label of the disk> + <lock id>

It is a top level lock and is system owned.

You can see these locks in SDA with show lock /name="F11B$a"

One major problem is that these locks are only used on clustered systems.
On standalone systems the file system uses flags in the FCB and this a
approach will not work.

This may be more trouble than it is worth. You could have another thread
or another process poll the file trying to open it and when it succeeded
close the file again and fire an AST in the main process/thread.

Returning to issues raised earlier:

The rule for locks going away are:

1. If you want it to go away at image rundown, make it user mode

2. If you want it to go away at process rundown, make it kernel or
exec mode.

3. If you want it to outlive the process, make it system owned.

System owned locks are a pain. They hang around forever making debugging
and testing difficult. You are forever rebooting to get rid of old locks.

The paging issue has been covered. You can page in kernel mode so long
as you keep IPL below 2. So unless you take a spinlock or similar there
is no need to lock the code down.

- Jim

Richard Maher

unread,
Jul 6, 2003, 6:11:56 AM7/6/03
to
Hi Keith, Jim

Keith, thanks very much for taking the time to get and translate the SDA
output for me! As Jim explains, the reason I didn't believe/understand you
about the arbitration lock was that I'm on a stand alone-machine (which
apparently doesn't use these locks) and you were on a cluster.

Jim, I hope we never fall out 'cos you've got this great habit of telling me
exactly what I want to know and not much else. I'm not gonna bother with the
File-Closed/File-Creation-Finished thing at the moment as most people seem
to use trigger files anyway but if I ever do I assume the FCB address is in
skb$l_fcb and the bits of interest are somewhere in fcb$l_status(rmslock or
excl) or fcb$b_acclkmode?

I was waiting until I'd come up with a UWSS version of the code with a
lovely Kernel mode rundown routine that ensures all locks are dequeued but I
don't have the time at the moment, so I attached the COBOL code I've been
using to test this stuff out. WARNING: DO NOT run this in a production
environment!!! This code can easily crash your system. One way is a simple
Ctrl-Y that stops the image but leaves the lock there, so when someone does
a DIR of the directory in question the blocking AST can't be delivered and
good-night.

While you're here a couple of other questions:

1) I use lck$_prmode so that I can't invalidate the lock value block but I'm
incorrectly treating the an invalid lock value block as a "No Change"
condition when I should really check to see if my file has been created. But
if the io$_access didn't revalidate the LVB then my endless loop would
happen again. Will a $DIR or $CREATE revalidate the LVB?

2) With the lck$m_cvtsys locks that you spoke about, how does one recover or
resume control (if not ownership) of these locks from another process when
the initiating process dies? Like an Rdb recovery process?

Thanks again to both of you for the help with this! (And sorry for the late
reply. VMS engineering's refusal to fix a bug with $getdti has left me doing
a lot more work than I thought, and my selfish arse landlord decided to sell
the place so we're busy moving house.)

Cheers Richard Maher

Obviously replace the & with space.

$on&warning&then&exit
$create&serial_lock.cob
identification&division.
program-id.&&&&serial_lock.
author.&&&&&&&&Richard&Maher.
*
environment&division.
configuration&section.
special-names.
&&&&symbolic&characters&fab$c_bid&is&&4,&
&&&&&&&&&&&&&&&&&&&&&&&&fab$c_bln&is&81,
&&&&&&&&&&&&&&&&&&&&&&&&nam$c_bid&is&&3,
&&&&&&&&&&&&&&&&&&&&&&&&nam$c_bln&is&97.
*
data&division.
working-storage&section.
01&&io$_access&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&io$_access
.
01&&dc$_disk&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&dc$_disk.
01&&nam$m_node&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&nam$m_node
.
01&&nam$m_wildcard&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&nam$m_wild
card.
01&&nam$m_search_list&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&nam$m_sear
ch_list.
01&&lib$_nowild&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&lib$_nowil
d.
01&&rms$_normal&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&rms$_norma
l.
01&&ss$_wasset&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_wasset
.
01&&ss$_wasclr&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_wasclr
.
01&&ss$_nosuchfile&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_nosuch
file.
01&&ss$_valnotvalid&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_valnot
valid.
01&&ss$_unsupported&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_unsupp
orted.
01&&ss$_ivlockid&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_ivlock
id.
01&&ss$_normal&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_normal
.
01&&sys_status&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
01&&parse_fab.
&&&&03&&fab$b_bid&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&fab$c_bid.
&&&&03&&fab$b_bln&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&fab$c_bln.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(6)&&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&fab$l_sts&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&fab$l_stv&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(24)&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&fab$l_nam&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&parse_nam.
&&&&03&&fab$l_fna&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&in_name.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(4)&&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&fab$b_fns&&&&&&&pic&x&&&&&&&&&&&&&&&&&&&value&&&x"3C".
&&&&03&&&&&&&&&&&&&&&&&&pic&x(27)&&&&&&&&&&&&&&&value&&&low-values.
*
01&&parse_nam.
&&&&03&&nam$b_bid&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&nam$c_bid.
&&&&03&&nam$b_bln&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&nam$c_bln.
&&&&03&&nam$b_rss&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(5).
&&&&03&&nam$l_nop&&&&&&&pic&9(4)&&&&&&&&comp&&&&value&&&external&&nam$m_noco
nceal.
&&&&03&&nam$b_ess&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&high-values.
&&&&03&&nam$b_esl&&&&&&&pic&x(1).
&&&&03&&nam$l_esa&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&expanded_f
ile.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(4)&&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&nam$t_dvi.
&&&&&&&&05&&dvi_len&&&&&pic&x.
&&&&&&&&05&&dvi_name&&&&pic&x(15).
&&&&03&&&&&&&&&&&&&&&&&&pic&x(6).
&&&&03&&nam$t_did.
&&&&&&&&05&&did_num&&&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&did_seq&&&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&x(1).
&&&&&&&&05&&did_rvn&&&&&pic&x(1).
&&&&03&&&&&&&&&&&&&&&&&&pic&x(4)&&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&nam$l_fnb&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(20)&&&&&&&&&&&&&&&value&&&low-values.
&&&&03&&nam$l_name&&&&&&&&&&&&&&&&&&&&&&pointer.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(16)&&&&&&&&&&&&&&&value&&&low-values.
*
01&&name_buff_addr&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&&&&&&&expa
nded_file.
01&&expanded_file&&&&&&&pic&x(255).
01&&expanded_file_len&&&pic&9(4)&&&&&&&&comp.
01&&file_name_desc.
&&&&03&&file_name_len&&&pic&9(4)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(4)&&&&&&&&comp.
&&&&03&&file_name_addr&&&&&&&&&&&&&&&&&&pointer.
01&&name_offset&&&&&&&&&pic&9(4)&&&&&&&&comp.
01&&result_file&&&&&&&&&pic&x(255).
01&&result_file_len&&&&&pic&9(4)&&&&&&&&comp.
01&&in_name&&&&&&&&&&&&&pic&x(60).
*
01&&disk_chan&&&&&&&&&&&pic&9(4)&&&&&&&&comp.
01&&iosb.
&&&&03&&iosb_status&&&&&pic&9(4)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(6).
*
01&&cvt_word&&&&&&&&&&&&pic&9(4)&&&&&&&&comp.
01&&cvt_byte&&&&&&&&&&&&&&&&&&&&&&&&&&&&redefines
&&&&cvt_word&&&&&&&&&&&&pic&x.
01&&bit_result&&&&&&&&&&pic&9(9)&&&&&&&&comp.
01&&dvi_iosb.
&&&&03&&dvi_cond_val&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(2).
*
01&&dvi_list.
&&&&03&&item_volnam.
&&&&&&&&05&&&&&&&&&&&&&&pic&9(4)&&&&&&&&comp&&&&value&&&12.
&&&&&&&&05&&&&&&&&&&&&&&pic&9(4)&&&&&&&&comp&&&&value&&&external&&dvi$_volna
m.
&&&&&&&&05&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&volume_nam
e.
&&&&&&&&05&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&volume_nam
e_len.
&&&&03&&item_class.
&&&&&&&&05&&&&&&&&&&&&&&pic&9(4)&&&&&&&&comp&&&&value&&&4.
&&&&&&&&05&&&&&&&&&&&&&&pic&9(4)&&&&&&&&comp&&&&value&&&external&&dvi$_devcl
ass.
&&&&&&&&05&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&dev_class.
&&&&&&&&05&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
01&&volume_name&&&&&&&&&pic&x(12).
01&&volume_name_len&&&&&pic&9(4)&&&&&&&&comp.
01&&dev_class&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
01&&sys$deq&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&sys$deq.
01&&deq_args.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&4.
&&&&03&&deq_lkid&&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(12)&&&&&&&&&&&&&&&value&&&low-values.
*
01&&sys$enqw&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&sys$enqw.
01&&parent_enq_args.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&12.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&lck$k_nlmo
de.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&lksb.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&parent_fla
gs.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&parent_res
nam_desc.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(28)&&&&&&&&&&&&&&&value&&&low-values.
*
01&&sys$enq&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&sys$enq.
01&&child_enq_args.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&12.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&lck$k_prmo
de.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&lksb.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&child_flag
s.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&child_resn
am_desc.
&&&&03&&parent_id&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&comp_ast.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&ast_block.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&block_krnl
_ast.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(12)&&&&&&&&&&&&&&&value&&&low-values.
*
01&&parent_resnam_desc.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&18.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&&&&&&&pare
nt_resnam.
01&&parent_resnam.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(6)&&&&&&&&&&&&&&&&value&&&"F11B$v".
&&&&03&&parent_volnam&&&pic&x(12).
01&&child_resnam_desc.
&&&&03&&&&&&&&&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&10.
&&&&03&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&pointer&value&&&reference&&&&&&&chil
d_resnam.
01&&child_resnam.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(6)&&&&&&&&&&&&&&&&value&&&"F11B$s".
&&&&03&&child_did_num&&&pic&9(4)&&&&&&&&comp.
&&&&03&&&&&&&&&&&&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&low-value.
&&&&03&&child_did_rvn&&&pic&x(1).
*&&&
01&&ast_block.
&&&&03&&door_bell&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&lksb.
&&&&&&&&05&&lksb_cond&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&xx.
&&&&&&&&05&&lock_id&&&&&pic&9(9)&&&&&&&&comp.
&&&&&&&&05&&value_block.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(4).
&&&&&&&&&&&&07&&dataseq&pic&9(9)&&&&&&&&comp.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(8).
*
01&&file_found&&&&&&&&&&pic&x(1)&&&&&&&&&&&&&&&&value&&&"N".
*
*&File&Information&Block&(FIB).
*
01&&fib.
&&&&03&&fib$l_acctl&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&fib$t_fid.
&&&&&&&&05&&fid_num&&&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&fid_seq&&&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&x(1).
&&&&&&&&05&&fid_rvn&&&&&pic&x(1).
&&&&03&&fib$t_did.
&&&&&&&&05&&fib$w_did&&&pic&9(4)&&&&&&&&comp&&&&occurs&3.
&&&&03&&fib$l_wcc&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&fib$w_nmctl&&&&&pic&9(4)&&&&&&&&comp.
*
01&&last_seq&&&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
procedure&division.
kick_off&section.
00.
&&&&call&"lib$get_ef"&using&door_bell&giving&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&display&"Filename:&"&erase&screen&no&advancing.
&&&&accept&in_name&protected&reversed.

&&&&call&"sys$parse"
&&&&&&&&using&&&by&reference&&&&parse_fab
&&&&&&&&&&&&&&&&by&value&&&&&&&&0,&0
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&not&=&rms$_normal&call&"lib$stop"&using&by&value&sys_statu
s.

&&&&move&nam$b_esl&to&cvt_byte.
&&&&move&cvt_word&to&expanded_file_len.
&&&&display&"ESLen&=&",&expanded_file_len&with&conversion.
&&&&display&"Expand&File:&",&expanded_file(1:expanded_file_len).

&&&&call&"mth$jiand"&using&nam$l_fnb,&nam$m_node&giving&bit_result.
&&&&if&bit_result&not&=&zeros
&&&&&&&&display&"Illegal&Node&specification.&Local&files&only."
&&&&&&&&go&to&fini.

&&&&call&"mth$jiand"&using&nam$l_fnb,&nam$m_wildcard&giving&bit_result.
&&&&if&bit_result&not&=&zeros&call&"lib$stop"&using&by&value&lib$_nowild.

&&&&call&"mth$jiand"&using&nam$l_fnb,&nam$m_search_list&giving&bit_result.
&&&&if&bit_result&not&=&zeros&call&"lib$stop"&using&by&value&lib$_nowild.

&&&&if&nam$t_did&=&low-values&call&"lib$stop"&using&by&value&ss$_unsupported
.

&&&&move&dvi_len&to&cvt_byte.
&&&&call&"sys$assign"
&&&&&&&&using&&&by&descriptor&&&dvi_name(1:cvt_word)
&&&&&&&&&&&&&&&&by&reference&&&&disk_chan
&&&&&&&&&&&&&&&&by&value&&&&&&&&0,&0,&0
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&call&"sys$getdviw"
&&&&&&&&using&&&by&value&&&&&&&&0,&disk_chan,&0
&&&&&&&&&&&&&&&&by&reference&&&&dvi_list,&dvi_iosb
&&&&&&&&&&&&&&&&by&value&&&&&&&&0,&0,&0
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&=&ss$_normal&move&dvi_cond_val&to&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&if&dev_class&not&=&dc$_disk
&&&&&&&&display&"Illegal&device&class.&Only&DISK&class&devices&permitted"
&&&&&&&&call&"lib$stop"&using&by&value&ss$_unsupported.

&&&&move&volume_name(1:volume_name_len)&to&parent_volnam.

&&&&call&"sys$cmkrnl"
&&&&&&&&using&&&by&value&&&&&&&&sys$enqw
&&&&&&&&&&&&&&&&by&reference&&&&parent_enq_args
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.
&
&&&&move&lock_id&to&parent_id.
&&&&move&zeros&to&lock_id.

&&&&move&did_num&to&child_did_num.
&&&&move&did_rvn&to&child_did_rvn.

&&&&perform&watch_dir&until&file_found&=&"Y".
*
fini.
&&&&if&lock_id&not&=&zeros
&&&&&&&&move&lock_id&to&deq_lkid
&&&&&&&&call&"sys$cmkrnl"
&&&&&&&&&&&&using&&&by&value&&&&&&&&sys$deq
&&&&&&&&&&&&&&&&&&&&by&reference&&&&deq_args
&&&&&&&&&&&&giving&&sys_status
&&&&&&&&if&sys_status&not&=&ss$_normal&and&ss$_ivlockid
&&&&&&&&&&&&call&"lib$stop"&using&by&value&sys_status.
*
&&&&move&parent_id&to&deq_lkid.
&&&&call&"sys$cmkrnl"
&&&&&&&&using&&&by&value&&&&&&&&sys$deq
&&&&&&&&&&&&&&&&by&reference&&&&deq_args
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&call&"sys$dassgn"&using&by&value&disk_chan&giving&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.
*
&&&&stop&run.
*
watch_dir&section.
00.
&&&&call&"sys$clref"&using&by&value&door_bell&giving&sys_status.
&&&&if&sys_status&not&=&ss$_wasset&and&ss$_wasclr&call&"lib$stop"&using&by&v
alue&sys_status.

&&&&call&"sys$cmkrnl"
&&&&&&&&using&&&by&value&&&&&&&&sys$enq
&&&&&&&&&&&&&&&&by&reference&&&&child_enq_args
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&call&"sys$hiber"&giving&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&if&lksb_cond&not&=&ss$_normal&and&ss$_valnotvalid
&&&&&&&&call&"lib$stop"&using&by&value&lksb_cond.

&&&&if&dataseq&not&=&last_seq
&&&&&&&&move&dataseq&to&last_seq
&&&&&&&&perform&check_for_file
&&&&&&&&if&file_found&=&"Y"&
&&&&&&&&&&&&go&to&fini.

&&&&display&"Waiting&for&door_bell.&.&.".

&&&&call&"sys$waitfr"&using&by&value&door_bell&giving&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.
*
fini.
*
check_for_file&section.
00.
&&&&move&low-values&to&fib.
&&&&move&nam$t_did&to&fib$t_did.

&&&&move&nam$l_name&to&file_name_addr.
&&&&subtract&name_buff_addr&from&file_name_addr&giving&name_offset.
&&&&subtract&name_offset&from&expanded_file_len&giving&file_name_len.

&&&&call&"sys$qiow"
&&&&&&&&using&&&by&value&&&&&&&&0,&disk_chan,&io$_access
&&&&&&&&&&&&&&&&by&reference&&&&iosb
&&&&&&&&&&&&&&&&by&value&&&&&&&&0,&0
&&&&&&&&&&&&&&&&by&descriptor&&&fib
&&&&&&&&&&&&&&&&by&reference&&&&file_name_desc,&result_file_len
&&&&&&&&&&&&&&&&by&descriptor&&&result_file
&&&&&&&&&&&&&&&&by&value&&&&&&&&0,&0
&&&&&&&&giving&&sys_status.
&&&&if&sys_status&=&ss$_normal&move&iosb_status&to&sys_status.

&&&&evaluate&&&&sys_status
&&&&&&&&when&&&&ss$_nosuchfile&&display&"File&not&found.&Better&luck&next&ti
me."
&&&&&&&&when&&&&ss$_normal&&&&&&move&"Y"&to&file_found
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&display&"Bingo!"
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&display&"RSL&=&",&result_file_len&with&conve
rsion
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&display&"result&file&=&*",&result_file(1:res
ult_file_len),&"*"
&&&&&&&&when&&&&other&&&&&&&&&&&call&"lib$stop"&using&by&value&sys_status
&&&&end-evaluate.
*
fini.
*
end&program&serial_lock.
identification&division.
program-id.&&&&block_krnl_ast.
data&division.
working-storage&section.
01&&psl$c_user&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&psl$c_user
.
01&&block_user_ast&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&block_user
_ast.
01&&ss$_wasclr&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_wasclr
.
01&&ss$_normal&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_normal
.
01&&sys_status&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
linkage&section.
01&&ast_block.
&&&&03&&door_bell&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&lksb.
&&&&&&&&05&&lksb_cond&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&xx.
&&&&&&&&05&&lock_id&&&&&pic&9(9)&&&&&&&&comp.
*
procedure&division&using&ast_block.
00.
&&&&call&"sys$deq"&using&by&value&lock_id,&0,&0,&0&giving&sys_status.
&&&&if&sys_status&not&=&ss$_normal&call&"lib$stop"&using&by&value&sys_status
.

&&&&move&zeros&to&lock_id.

&&&&call&"sys$dclast"&
&&&&&&&&using&&&by&value&&&&&&&&block_user_ast
&&&&&&&&&&&&&&&&by&reference&&&&ast_block
&&&&&&&&&&&&&&&&by&value&&&&&&&&psl$c_user
&&&&&&&&giving&sys_status.

&&&&exit&program.
*
end&program&block_krnl_ast.
identification&division.
program-id.&&&&block_user_ast.
data&division.
working-storage&section.
01&&ss$_wasset&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_wasset
.
01&&ss$_wasclr&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_wasclr
.
01&&ss$_normal&&&&&&&&&&pic&9(9)&&&&&&&&comp&&&&value&&&external&&ss$_normal
.
01&&sys_status&&&&&&&&&&pic&9(9)&&&&&&&&comp.
*
linkage&section.
*&&&
01&&ast_block.
&&&&03&&door_bell&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&lksb.
&&&&&&&&05&&lksb_cond&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&xx.
&&&&&&&&05&&lock_id&&&&&pic&9(9)&&&&&&&&comp.
&&&&&&&&05&&value_block.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(4).
&&&&&&&&&&&&07&&dataseq&pic&9(9)&&&&&&&&comp.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(8).
*
procedure&division&using&ast_block.
00.
&&&&display&"In&AST".

&&&&call&"sys$setef"&using&by&value&door_bell&giving&sys_status.
&&&&if&sys_status&not&=&ss$_wasclr&call&"lib$stop"&using&by&value&sys_status
.
*
fini.
&&&&exit&program.
*
end&program&block_user_ast.
identification&division.
program-id.&&&&comp_ast.
data&division.
working-storage&section.
*&&&
linkage&section.
*
01&&ast_block.
&&&&03&&door_bell&&&&&&&pic&9(9)&&&&&&&&comp.
&&&&03&&lksb.
&&&&&&&&05&&lksb_cond&&&pic&9(4)&&&&&&&&comp.
&&&&&&&&05&&&&&&&&&&&&&&pic&xx.
&&&&&&&&05&&lock_id&&&&&pic&9(9)&&&&&&&&comp.
&&&&&&&&05&&value_block.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(4).
&&&&&&&&&&&&07&&dataseq&pic&9(9)&&&&&&&&comp.
&&&&&&&&&&&&07&&&&&&&&&&pic&x(8).
*
procedure&division&using&ast_block.
00.
&&&&call&"sys$wake"&using&by&value&0,&0.
&&&&exit&program.
*
end&program&comp_ast.
$!
$cobol/lis&serial_lock
$create&serial_lock_def.mar

&&&&&&&&.title&serial_lock_def

&&&&&&&&$namdef&&&&&&&&&GLOBAL
&&&&&&&&$lckdef&&&&&&&&&GLOBAL
&&&&&&&&$psldef&&&&&&&&&GLOBAL
&&&&&&&&$atrdef&&&&&&&&&GLOBAL

&&&&&&&&parent_flags&&&&==&<lck$m_noqueue!lck$m_system!lck$m_nodlckwt!lck$m_
nodlckblk!lck$m_expedite>
&&&&&&&&child_flags&&&&&==&<lck$m_system!lck$m_nodlckwt!lck$m_nodlckblk!lck$
m_valblk>

&&&&&&&&.end

$!
$macro/lis&serial_lock_def
$link&serial_lock,serial_lock_def
$!
$exit

Jim Brankin <jbra...@ntlworld.com> wrote in message
news:863f19d6.03061...@posting.google.com...

0 new messages