added LSL2 stored procedures
This commit is contained in:
136
LSL2/STPROC/TABLE_INFO.txt
Normal file
136
LSL2/STPROC/TABLE_INFO.txt
Normal file
@ -0,0 +1,136 @@
|
||||
Compile Subroutine Table_Info(Table, Process)
|
||||
|
||||
|
||||
If Assigned(Table) else Table = ""
|
||||
If Assigned(Process) else Process = ""
|
||||
|
||||
If Process EQ "" then Process = "ALL"
|
||||
|
||||
TableInfo = ""
|
||||
MaxLens = ""
|
||||
HeadInfo = ""
|
||||
MaxFMs = ""
|
||||
ColInfo = ""
|
||||
Open Table to handle then
|
||||
Open "DICT.":Table to hDict then
|
||||
GoSub Pull_Dict_Items
|
||||
Done = 0
|
||||
Counter = 0
|
||||
Select handle
|
||||
Loop
|
||||
Readnext ID else Done = 1
|
||||
If Num(Process) then
|
||||
// go this many times
|
||||
If Counter GT Process then Done = 1
|
||||
end
|
||||
Until Done
|
||||
Read Rec from Handle, ID then
|
||||
NumFms = Count(Rec, @FM) + (Rec NE "")
|
||||
If NumFMs GT MaxFMs then
|
||||
MaxFMs = NumFMs
|
||||
end
|
||||
For FMLoop = 1 to NumFms
|
||||
CurVal = Rec<FMLoop>
|
||||
Begin Case
|
||||
Case Index(CurVal, @SVM, 1)
|
||||
If Index(ColInfo<FMLoop>, "SVM,", 1) else
|
||||
ColInfo<FMLoop> = ColInfo<FMLoop>:"SVM,"
|
||||
end
|
||||
Case Index(CurVal, @VM, 1)
|
||||
If Index(ColInfo<FMLoop>, "VM,", 1) else
|
||||
ColInfo<FMLoop> = ColInfo<FMLoop>:"VM,"
|
||||
end
|
||||
NumVms = Count(CurVal, @VM) + (CurVal NE "")
|
||||
For VMLoop = 1 to NumVMs
|
||||
CurVMVal = CurVal<0, VMLoop>
|
||||
CurLen = Len(CurVMVal)
|
||||
If CurLen GT MaxLens<FMLoop> then
|
||||
MaxLens<FMLoop> = CurLen
|
||||
end
|
||||
Next VMLoop
|
||||
Case 1
|
||||
CurLen = Len(CurVal)
|
||||
If CurLen GT MaxLens<FMLoop> then
|
||||
MaxLens<FMLoop> = CurLen
|
||||
end
|
||||
End Case
|
||||
|
||||
Next FMLoop
|
||||
Counter += 1
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
end
|
||||
|
||||
FinalVar = ""
|
||||
For FMLoop = 1 to MaxFms
|
||||
FinalVar := HeadInfo<1, FMLoop>:@VM:ColInfo<FMLoop>:@VM:MaxLens<FMLoop>:@FM
|
||||
Next FMLoop
|
||||
|
||||
Open "SYSLISTS" to hSyslists then
|
||||
Write FinalVar to hSyslists, "TABLE_INFO" else null
|
||||
Call SRP_Editor_Open("Record", "SYSLISTS":@FM:"TABLE_INFO")
|
||||
end
|
||||
|
||||
Return
|
||||
|
||||
|
||||
Pull_Dict_Items:
|
||||
HeadInfo = ""
|
||||
DictList = ""
|
||||
// If Dictlist is Null then make a list of all data dicts.
|
||||
Clearselect
|
||||
Select hDict
|
||||
Done = 0
|
||||
Loop
|
||||
Readnext DictID else Done = 1
|
||||
Until Done
|
||||
Read DictRec from hDict, DictID then
|
||||
If DictRec<1> _EQC "F" then
|
||||
If DictRec<2> GT 0 then
|
||||
DictList<DictRec<2>> = DictID
|
||||
end
|
||||
end
|
||||
end
|
||||
Repeat
|
||||
// Now put the ID in place.
|
||||
* DictList = Insert(DictList, 1, 0, 0, "ID")
|
||||
|
||||
NumCols = Count(DictList, @FM) + (DictList NE "")
|
||||
For ColLoop = 1 to NumCols
|
||||
CurDictID = DictList<ColLoop>
|
||||
VMPos = Field(CurDictID, "*", 2, 1)
|
||||
If VMPos then
|
||||
If VMPos[1, 2] _EQC "VM" then
|
||||
VMPos[1, 2] = ""
|
||||
end
|
||||
CurDictID = Field(CurDictID, "*", 1, 1)
|
||||
Swap " " with "_" in CurDictID
|
||||
Convert @Lower.Case to @Upper.Case in CurDictID
|
||||
end else
|
||||
Swap " " with "_" in CurDictID
|
||||
Convert @Lower.Case to @Upper.Case in CurDictID
|
||||
If CurDictID EQ "ID" then
|
||||
expDictID = "MAIN_ID"
|
||||
end else
|
||||
expDictID = CurDictID
|
||||
end
|
||||
end
|
||||
Read DictRec from hDict, CurDictID else DictRec = ""
|
||||
Begin Case
|
||||
Case DictList<ColLoop> EQ "ID"
|
||||
HeadInfo<1, ColLoop> = "ID"
|
||||
HeadInfo<2, ColLoop> = 0
|
||||
HeadInfo<3, ColLoop> = ""
|
||||
HeadInfo<4, ColLoop> = ""
|
||||
HeadInfo<5, ColLoop> = ""
|
||||
Case DictRec
|
||||
HeadInfo<1, ColLoop> = DictList<ColLoop>
|
||||
HeadInfo<2, ColLoop> = DictRec<2> ; * FM
|
||||
HeadInfo<3, ColLoop> = DictRec<7> ; * Oconv
|
||||
HeadInfo<4, ColLoop> = VMPos
|
||||
HeadInfo<5, ColLoop> = ""
|
||||
End Case
|
||||
Next ColLoop
|
||||
return
|
||||
|
Reference in New Issue
Block a user