The FINFO 51 does indeed look like garbage but it can be deciphered.
I did this the hard way and later found the layout for it somewhere
in the intrinsics manual I believe, (this was back when I had more
time on my hands than I do now).
The following is a command file which does this and generates a temp
file which will create an empty file structured the same as the file
given. I also did a couple variations of it, one to repack a KSAM file
(without changing it file limit) and another to expand (or contract)
the limit (with a test against existing EOF).
Obviously this is quite dependent on the layout staying the same, so one
must test it after any update.
No warranties expressed or implied, enjoy:
:HELP COPYKSAM
USER DEFINED COMMAND FILE: COPYKSAM.CMD.SYS
PARM FILE="?",NEWSIZE=""
IF "!FILE" = "?" THEN
ECHO
ECHO This command file creates a temporary file "BLDTMP" which will
ECHO contain the required build command to create an empty KSAM file
ECHO identical in structure to the named file, with a new limit if
ECHO specified. Blocking factor is ignored since it is not readily
ECHO available from any source, and MPEXL essentially ignores it.
ECHO
ECHO First parameter is a FILE name which must be a KSAMXL file
ECHO Second parameter is desired new file limit, if omitted the current
ECHO file limit will be used. If REUSE is set for the KSAM file
ECHO the BUILD command will increase this by 15%
RETURN
ENDIF
FILE !FILE=!FILE,OLD
IF FINFO("*!FILE","FILETYPE") <> "KSAMXL"
ECHO !FILE is NOT a KSAMXL file, cannot continue
RETURN
ENDIF
IF "!NEWSIZE" = ""
SETVAR SETSIZE,FINFO("*!FILE","LIMIT")
ELSE
SETVAR SETSIZE,!NEWSIZE
ENDIF
SETVAR LINEOUT "BUILD !FILE ;KSAMXL;TEMP;DISC=!SETSIZE;"
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >BLDTMP
SETVAR LINEOUT," "
SETVAR KSAMPARAMS,STR(FINFO("*!FILE","KSAMPARAM"),1,255)
COMMENT byte 32 is a set of bit flags, extract those of interest
SETVAR HEADPARAMS,ORD(STR(KSAMPARAMS,32,1))
SETVAR OPTMBLK,HEADPARAMS BAND 128
SETVAR REUSE,HEADPARAMS BAND 8
SETVAR FIRSTREC,HEADPARAMS BAND 2
IF OPTMBLK > 0
SETVAR LINEOUT,LINEOUT+"OPTMBLK;"
IF LEN(LINEOUT) > 65
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
ENDIF
IF REUSE > 0
SETVAR LINEOUT,LINEOUT+"REUSE;"
IF LEN(LINEOUT) > 65
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
ENDIF
IF FIRSTREC > 0
SETVAR LINEOUT,LINEOUT+"FIRSTREC=1;"
IF LEN(LINEOUT) > 65
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
ENDIF
SETVAR RECSIZE, FINFO("*!FILE","RECSIZE")
SETVAR RECTYPE, STR(FINFO("*!FILE","RECTYPE"),1,1)
IF STR(FINFO("*!FILE","FMTFOPT"),1,1) = "A"
SETVAR FILEFMT,"ASCII"
ELSE
SETVAR FILEFMT,"BINARY"
IF RECSIZE < 0
SETVAR RECSIZE ABS(RECSIZE / 2)
ENDIF
ENDIF
SETVAR LINEOUT, LINEOUT + "REC=![RECSIZE],,!RECTYPE,!FILEFMT;"
IF LEN(LINEOUT) > 65
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
IF LEN(LINEOUT) > 30
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
SETVAR LINEOUT,LINEOUT+ "KEY=("
SETVAR NUMKEYS,ORD(STR(KSAMPARAMS,34,1))
SETVAR KEYNUM,1
COMMENT --------------------LOOP FOR EACH KEY
WHILE KEYNUM <= NUMKEYS
SETVAR KEYARRAY,STR(KSAMPARAMS,27+KEYNUM*8,8)
SETVAR KEYTYPE,ORD(STR(KEYARRAY,1,1)) / 16
SETVAR KEYLGTH,ORD(STR(KEYARRAY,2,1))
SETVAR KEYSTART,ORD(STR(KEYARRAY,3,1)) * 256 + ORD(STR(KEYARRAY,4,1))
SETVAR KEYDUP,ORD(STR(KEYARRAY,5,1))
SETVAR KEYRDUP,ORD(STR(KEYARRAY,8,1))
IF KEYTYPE = 1
SETVAR SHOWTYPE,"BYTE"
ELSE
IF KEYTYPE = 3
SETVAR SHOWTYPE,"INTEGER"
ELSE
IF KEYTYPE = 6
SETVAR SHOWTYPE,"NUMERIC"
ELSE
IF KEYTYPE = 7
SETVAR SHOWTYPE,"PACKED"
ELSE
IF KEYTYPE = 5
SETVAR SHOWTYPE,"REAL"
ELSE
IF KEYTYPE = 8
SETVAR SHOWTYPE,"*PACKED"
ELSE
IF KEYTYPE = 9
SETVAR SHOWTYPE,"IEEEREAL"
ELSE
ECHO Unknown keytype: !keytype, operation aborted
RETURN
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
IF KEYDUP > 0
IF KEYRDUP > 0 OR REUSE > 0
SETVAR SHOWDUP ",RDUP"
ELSE
SETVAR SHOWDUP ",DUP"
ENDIF
ELSE
SETVAR SHOWDUP, ""
ENDIF
IF KEYNUM < NUMKEYS
SETVAR KEYEND ";"
ELSE
SETVAR KEYEND ")"
ENDIF
SETVAR LINEOUT,LINEOUT+"!SHOWTYPE,!KEYSTART,!KEYLGTH!SHOWDUP!KEYEND"
IF KEYNUM < NUMKEYS AND LEN(LINEOUT) > 60
SETVAR LINEOUT,LINEOUT + " &"
ECHO !LINEOUT >>BLDTMP
SETVAR LINEOUT," "
ENDIF
SETVAR KEYNUM, KEYNUM + 1
ENDWHILE
COMMENT --------------------END OF KEY LOOP
ECHO !LINEOUT >>BLDTMP
ECHO
ECHO Command to build !FILE (Temporary command file BLDTMP):
ECHO
PRINT BLDTMP
ECHO
IF REUSE > 0
ECHO NOTE: REUSE flag will cause limit to be set at ![setsize*115/100]
ECHO
ENDIF
Bob
> -----Original Message-----
> From: HP-3000 Systems Discussion [mailto:[log in to unmask]]On
> Behalf Of Glenn Cole
> Sent: Monday, August 23, 1999 4:36 PM
> To: [log in to unmask]
> Subject: Re: KSAM XL - Memory Lapse - (Mine)
>
>
> Joe Howell writes:
>
> > Though I would SWEAR the key is correct, I need to verify the
> > structure of this file. Under CM, we used KSAMUTIL,
> VERIFY. I don't
> > recall, but how do I do this to a KSAM XL file?
>
> You're welcome to try the grab bag of LISTF,x numbers, but I must be
> getting tired, because I'm tired of remembering new option numbers.
> (I still use them, though, to cycle through a list of options.)
>
> Try: LISTFILE filename,UNIQUE
>
> But of course the real leap here was knowing that is was SOME option
> with LISTF and/or LISTFILE.
>
> (I just found out that finfo option 51 ["KSAM LABEL" or "KSAMPARAM"]
> supposedly returns a string of "KSAM XL parameters", but a quick test
> just gave me garbage.)
>
> --Glenn
>
> ..............................................................
> .........
>
> Item Subject: cc:Mail Text
>
|