|
SELCOPY
Examples Menu
Problem:
A very large CMS library needs modification to the directory date to force
reorganisation.
Record 1 of the file holds the Directory record number as a 2 byte binary
field at position 38. In the Directory record, position 107 contains a date
in YYMMDD format which must change to set the Day number to zero. The year
is 95, so we can verify this before the update.
XEDIT says it's too large.
EXECIO says the lrecl is greater than 256.
COPY says insufficient disk space - and anyway it takes too long.
Solution:
SELCOPY will fix it!
Just key it in:
l lib1 usrlib b ( alloc
FILENAME FILETYPE FM FORMAT LRECL RECS BLOCKS
LIB1 USRLIB B1 F 8192 8200 16400
R;
SELC
READ LIB1.USRLIB.B
READ LIB1.USRLIB.B REC 2 AT 38 TY B
IF P 107 '95'
THEN P 111 '00'
THEN UPDATE LIB1.USRLIB.B
THEN LOG FR 101 LEN 50 TYPE B
THEN STOP
ELSE GOTO CANCEL
INPUT OUTPT SEL
RECNO RECNO ID. 1 2 3 4 5
----- ----- --- ....,....0....,....0....,....0....,....0....,....0
0 2 1 5 950700 USRLIB Q w 48
000000FFFFFF00EDCDCC0E0100DE00040EA0B000FF05000022
00001095070001474392CF09018E005A3F63710048FF000009
R;
|
Or write an EXEC:
* NEWDAY EXEC * +++ LEVEL 002 +++ 94/04/21 17:07:32 +++
* Alters library's directory date to force REORG.
FILEDEF LIB DISK LIB1 USRLIB B
&BEGSTACK
read LIB * Read 1st record.
read LIB rec 2 at 38 ty b * Read specific record
if p 1 = '--- KEY/REC NOT FOUND ---'
then log '+++ DIR POINTER INVALID +++'
then goto cancel
if p 107 ones '000000' * Date will be numeric.
and p 107 ge '75' le 2 at date * Check for valid Year.
and p 109 ge '01' le '12' * Check for valid Month.
and p 111 ge '01' le '31' * Check for valid Day.
then p 111 = '00' * All OK - Zeroise Day No
then update lib * Rewrite record to disk.
then print type b * Print whole record, both char and hex.
then eoj
else log '+++ EXISTING DATE INVALID +++'
then goto cancel
&END
&STACK
EXEC SELC
&EXIT &RETCODE
|
|