Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please HELP!!! Need New Software for Install ASAP

Status
Not open for further replies.

tndinnc

IS-IT--Management
Jul 31, 2010
4
US
We were running SBT 5.0i and due to some archiving on our server the install got corrupted and we can't fix it. It was an old NT server and it's kaput. We can't run it at all. The company owner and Finance person has been trying to use Dynamics GP, PeachTree... but she's just not familiar with it and it's not doing what she needs. So we need a new install of SBT. Can anyone tell me where I can purchase a copy that she will be able to use, that coming from 5.0i she won't be totally lost. She's way behind on financials - months... and now we're back to square one.
 
ok, first at all calm down, I know it is not easy to handle but just try.

I hope you are VFP programmer, otherwise my suggestion will not work.

1. I assume that programs, reports forms,screen forms are all ok.
2. I assume that only DBF files are corrputed.

If this is the stage you have, you can still save SBT 5.0

You need a program to recover DBF structures so you can go back to the way.

Follow these steps:
1. Open VFP
2. Open a new VFP program RCVDBF, then copy and paste the lines below into it.
2. Compile it and run it following instructions you will find at the beginning of the program.

It is easy to use, works quick so you will finish soon.

It is a low level programming to recover dbf structures. Last routine should be Num2DWord() so I think I pasted the entire program.

Once you recover all SBT DBFs, you should be ready to run SBT 5.0

Good luck budy!


*---------------------------------------------------------
*- PROGRAM TO FIX DATABASE HEADER STRUCTURE RECORD
*- BY USING LOW LEVEL PROGRAMMING
*---------------------------------------------------------
*- JUL 2009
*---------------------------------------------------------
*- RUN LIKE THIS: DO RCVRDBF WITH "POTRAN01"
*---------------------------------------------------------

LPARAMETERS pcFile

LOCAL lnHandle, lcRecCnt, laFile[5], lcRecSize, lcFirstRec, ;
lnRecCnt, lnRecSize, lnFirstRec, lnRes, lnFileSize, ;
lnActRecCnt,llReturn,lcReturn

STORE "" TO lcReturn
STORE .T. TO llReturn

IF EMPTY(JUSTEXT(pcFile))
pcFile = pcFile + ".dbf"
ENDIF

*-- Get details about the file into an array
IF ADIR(laFile,pcFile)=0
llReturn = .F.
lcReturn = "File not found."
ENDIF


IF llReturn
*-- Take note of the size of the file
lnFileSize = laFile[2]

*-- Open the file
lnHandle = FOPEN(pcFile)

IF lnHandle = 0
llReturn = .F.
lcReturn = "Unable to open file"
ENDIF
ENDIF

IF llReturn

*-- Get the record size details from the file
TRY
FSEEK(lnHandle,4,0) && Record Count is bytes 4-7 in dbf header (0 offset)
lcRecCnt = FREAD(lnHandle,4)
FSEEK(lnHandle,8,0) && First Record Pos is bytes 8-9 in dbf header (0 offset)
lcFirstRec = FREAD(lnHandle,2)
FSEEK(lnHandle,10,0) && Record Size is bytes 10-11 in dbf header (0 offset)
lcRecSize = FREAD(lnHandle,2)
FCLOSE(lnHandle)

CATCH
llReturn = .F.
lcReturn = "Error reading file header."

ENDTRY

IF llReturn
*-- Convert the record details into integers
lnRecCnt = BinStrToInt( lcRecCnt )
lnFirstRec = BinStrToInt( lcFirstRec )
lnRecSize = BinStrToInt( lcRecSize )
lnActRecCnt = ROUND(((lnFileSize- lnFirstRec - 1)/lnRecSize),0)

*-- If the record count in the header is different to the actual
*-- # of records then fix the count in the header
IF lnActRecCnt<>lnRecCnt
lnHandle = FOPEN(pcFile,12) && Open file R/W, Unbuffered
FSEEK(lnHandle,4,0) && Record Count is bytes 4-7 in dbf header (0 offset)
FWRITE( lnHandle, Num2DWord(lnActRecCnt) )
FCLOSE(lnHandle)
lcReturn = "Record count fixed from " + ;
TRANSFORM(lnRecCnt) + ;
" to " + ;
TRANSFORM(lnActRecCnt)
ELSE
lcReturn = "Record count correct : " + TRANSFORM(lnRecCnt)
ENDIF
ENDIF
ENDIF

RETURN lcReturn

FUNCTION BinStrToInt( pcStr )
LOCAL lnTot, lnI
lnTot = 0
FOR lnI = 1 TO LEN(pcStr)
lnTot = lnTot + ASC(SUBSTR(pcStr,lnI)) * 256^(lnI-1)
ENDFOR
RETURN lnTot
ENDFUNC

FUNCTION Num2DWord( lnValue )
#DEFINE m0 256
#DEFINE m1 65536
#DEFINE m2 16777216
LOCAL b0, b1, b2, b3
b3 = INT(lnValue/m2)
b2 = INT((lnValue - b3*m2)/m1)
b1 = INT((lnValue - b3*m2 - b2*m1)/m0)
b0 = MOD(lnValue, m0)
RETURN CHR(b0)+CHR(b1)+CHR(b2)+CHR(b3)
ENDFUNC




 
Don't know if this is still a problem for you, but if it is trying to fix a table might be the wrong way to go. Every installation of PRO needs to have some files installed in the Windows directory to get it running. That is normally in the workstation install or on the install disk. This allows VFP to run which is necessary for PRO to run. 5.01 would run in either VFP 5.0 or VFP 6.0 as well as the newer versions of VFP. VFP 9 is the most recent.

Your install statement makes me wonder if this isn't the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top