[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

2497.0. "BUG CITY!!!!!" by NZOV01::MCKENZIE (Help STOP the greenhouse effect!) Sun Apr 23 1989 13:18

    OK BOYS AND GIRLS....Time for MORE random access file questions....
    
    Ive been writing a database to store records from my paintball
    social club...I'm also going to do other stuff with the info like
    print membership cards etc...
    
    now I've come up against a weird problem
    
    I open a random acces file (that doesnt exist)
    I get all the information i need - then gosub to a routine
    which LSETs all variables to random file buffers
    
    the problem is that one field - the membership number field
    keeps right justifying and dropping a digit from the variable at
    LSET time...I have checked record lengths,field definitions etc
    all- seems to be ok...the routine looks something like this
   
    
    I%=1:[ALL TMPVARIABLES CHECKED HERE] 
    OPEN "R",#1,"DF1:SOCIAL-MEMBERS.DAT",117
    FIELD #1,15 AS SURNAM$,5 AS ID$,15 AS INITIAL$,11 AS DOB$,....
    GET #1,I%:X=EOF(1):IF X=-1 GOTO [SET variables]
    [set variables]
    LSET SURNAM$=TMPSURNAM$
    LSET ID$=TMPID$
    .
    .
    .
    PUT #1,I%:CLOSE #1:RETURN....
    
	every field is correctly written except the member number
    field...instead of being "10001" it is written as " 1000"
    
    what am I doing wrong - Randy/Ed/anyone - Help!
    
T.RTitleUserPersonal
Name
DateLines
2497.1whoopsNZOV01::MCKENZIEHelp STOP the greenhouse effect!Sun Apr 23 1989 13:191
    forgot to mention that all this is done from Amigabasic....
2497.2Perhaps a leading sign space in ID$DISCVR::HAXTONMon Apr 24 1989 00:0913
    It looks like the problem may be with ID$.  When it is initially
    made into a string from a numeric value it probably has a leading
    space inherent (since it is a positive number) and the fieldwidth
    for that particular variable is 5 characters.  Hence, it keeps the
    leading space and the other 4 characters and drops the trailing
    character.  I suggest that you perform an 
    
    ID$=RIGHT$(ID$,len(ID$)-1)

    prior to the LSET which should remove the leading sign space from
    the ID$ string.
    
                                       Kevin
2497.3rather...DISCVR::HAXTONMon Apr 24 1989 00:217
    Let's rephrase that a little so that it matches your program better.  Try
    
    LSET ID$=RIGHT$(TMPID$,LEN(TMPID$)-1)
    
    Anyway, you get the idea...
    
                                       Kevin
2497.4thank you...NZOV01::MCKENZIEHelp STOP the greenhouse effect!Mon Apr 24 1989 02:301
    re .-1 - thanks Kevin - I'll try that...
2497.5done - thank you for your helpNZOV01::MCKENZIEHelp STOP the greenhouse effect!Tue Apr 25 1989 21:586
    Kevin - IT WORKED - Thank you very much
    
    
    regards
    
    Phil