LB Booster
Programming >> Compatibility with LB4 >> Works in LB, not in LBB
http://lbb.conforums.com/index.cgi?board=compatibility&action=display&num=1422326982

Works in LB, not in LBB
Post by Alincon on Jan 27th, 2015, 01:49am

I have some programs that work in LB4, but not in LBB.
In one program LBB seems to cutoff the four leftmost characters of a file name leading to a file not found error.

Code:
[specialList]
    pgCtr = 0 : lnCtr = 99 : listCount = 0 : sectCtr = 0
    menu #rept, "Close", "Close", [reptClose]
    open " STRUCTURE LIST" for text_fs as #rept
    #rept, "!trapclose [reptClose]"
    rptTtl$ = "  Structure Listing by Department and Section with Time Codes " + date$()
    gosub [newPage]
    files path$, info$(
    fc = val(info$(0, 1))    ' dept folders
    for cf = 1 to fc
        foldName$ = info$(cf, 0)
        files foldName$,  info2$(
        folCt = val(info2$(0,1))   'section folders
        for cf2 = 1 to folCt
            fold2Name$ = info2$(cf2,0)
            if right$(fold2Name$,5) = "Admin" then
                fileName$ = fold2Name$ + "\Admin.dat"   
                open fileName$ for input as #head  ' error on this line
                    line input #head, deptHead$
                close #head
                #rept, chr$(10);"  ";getFldr$(foldName$);"    Dept. Head = "; deptHead$
            else
              fileName$ = fold2Name$ + "\Admin.dat"
              open fileName$ for input as #supv
                 line input #supv, sectData$
              close #supv
            f$ =  getFldr$(fold2Name$)
            #rept, space$(5);f$; space$(20-len(f$));"Supervisor = ";word$(sectData$,1,"|")
            namLine$ = space$(10)
            for n = 2 to 9
                namLine$ = namLine$ + tb$(word$(sectData$,n,"|"),17)
                if namLine$ = "" then exit for
            next
           #rept, namLine$
           lnCtr = lnCtr + 1
           end if
        next
        sectCtr = sectCtr + folCt
    next
    #rept " "
    #rept str$(fc); " Departments   "; sectCtr; " Sections"
    wait

 [reptClose]
    close #rept
    wait

 


r.m.
Re: Works in LB, not in LBB
Post by Alincon on Jan 27th, 2015, 01:57am

In this program LBB does not print the employee information line. (namLine$), but in LB those lines print.

Code:

    pgCtr = 0 : lnCtr = 99 : listCount = 0
    menu #rept, "Close", "Close", [reptClose]
    open " EMPLOYEE LIST" for text_fs as #rept
    #rept, "!trapclose [reptClose]"
    rptTtl$ = tw$ + " Listing by Department and Section  " + date$()
    gosub [newPage]
    files path$, info$(

    dfc = val(info$(0, 1))    ' dept folder count
    for cf = 1 to dfc
        foldName$ = info$(cf, 0)
        #rept, chr$(10);"  ";getFldr$(foldName$)
        files foldName$,  info2$(
        sfc = val(info2$(0,1))      'section folder count
        sfc2 = val(info2$(0,0))      'section file count
        for cf2 = sfc2+1 to sfc + sfc2    'sfc2+1 is first folder
            fold2Name$ = info2$(cf2,0)
            #rept, space$(5);getFldr$(fold2Name$)
            files fold2Name$, ent$, info3$(
            efc = val(info3$(0,0))  'employee file count
            for cf3 = 1 to efc
                fileName$ = fold2Name$ + "\" + info3$(cf3,0)
                rgt$ = right$(fileName$,3)
                if INSTR("hlysal", rgt$) = 0 then [skip]

                y$ = "" : z$ = ""
                open fileName$ for input as #6
                    input #6,x$ 
                    if not(eof(#6)) then input #6, y$
                    if not(eof(#6)) then input #6, z$
                close #6
                x$ = info3$(cf3,0)
                perName$ = left$(x$,len(x$)-4)
                namLine$ = space$(10)  + tb$(word$(x$,3,"|"),17) + word$(x$,4,"|") + " " + word$(x$,5,"|") _
                     + space$(15 - len(word$(x$,4,"|"))) _
                     + tb$(word$(x$,6,"|"),5) + tb$(word$(x$,12,"|"),14) + tb$(word$(x$,13,"|"),27)
                namLine$ = space$(10)  +  tb$(perName$,20) +" "+ word$(y$,4,"|") +" "+ word$(y$,6,"|")
                listCount = listCount + 1          ' count name records
                #rept, namLine$; "  "; z$
                lnCtr = lnCtr + 1
           [skip]
           'if z$ <> "" then #rept, space$(30);z$
           next
        next
    next
    #rept " "
    #rept str$(dfc); " Departments   "; listCount; " persons"
    wait

 [reptClose]
    close #rept
    wait

 


r.m.
Re: Works in LB, not in LBB
Post by Alincon on Jan 27th, 2015, 02:01am

The third program is not mine. It is a Pyramid Solitare game by "WebbSoft" I am not sure where I got the source code.

I compiled it into an executable using LBB, but when I run it, nothing happens, or else it goes so fast that it looks like nothing happens

r.m.
Re: Works in LB, not in LBB
Post by Richard Russell on Jan 27th, 2015, 07:31am

on Jan 27th, 2015, 01:49am, Alincon wrote:
I have some programs that work in LB4, but not in LBB.

I presume you've already checked the Compatibility section of the LBB docs to make sure you are not relying on a feature that is not fully supported?

I am of course very happy to investigate, but as you'll appreciate I need to be able to reproduce the issue here. So I must have some code which is sufficiently self-contained that I can run it and observe the effect for myself.

Please contact me by private email, either with the entire program attached, or if it's too unwieldy (or confidential) to send in its entirely, please try to 'boil down' the code to something smaller which still exhibits the effect.

You can find my email address in the LBB Help menu.

Richard.

Re: Works in LB, not in LBB
Post by Richard Russell on Jan 27th, 2015, 08:11am

on Jan 27th, 2015, 01:57am, Alincon wrote:
Code:
                namLine$ = space$(10)  + tb$(word$(x$,3,"|"),17) + word$(x$,4,"|") + " " + word$(x$,5,"|") _
                     + space$(15 - len(word$(x$,4,"|"))) _
                     + tb$(word$(x$,6,"|"),5) + tb$(word$(x$,12,"|"),14) + tb$(word$(x$,13,"|"),27)
                namLine$ = space$(10)  +  tb$(perName$,20) +" "+ word$(y$,4,"|") +" "+ word$(y$,6,"|") 

Did you mean to have two consecutive statements that assign to the same variable (namLine$)? The first will of course have no effect, and could be deleted without changing the end result. I'm assuming function tb$() doesn't have some side-effect that you are relying on.

Richard.

Re: Works in LB, not in LBB
Post by Richard Russell on Jan 29th, 2015, 5:58pm

on Jan 27th, 2015, 01:57am, Alincon wrote:
In this program LBB does not print the employee information line. (namLine$), but in LB those lines print.

OK, with the help of the OP I have tracked down the incompatibility. It arises because LBB assumes that the first parameter of the FILES statement will be a full path name, i.e. a string starting with the drive letter; for example:

Code:
    FILES "C:\path", info$() 

However in his code the OP is passing the first parameter of FILES without the drive letter, for example:

Code:
    FILES "\path", info$() 

This is causing LBB to misbehave.

The LB docs simply refer to the first parameter as pathSpec$; all of the examples include a drive letter but it isn't stated whether one should always be supplied.

I ought probably to modify LBB to be more compatible with LB in this respect, but in the meantime the problem is easily fixed in the OP's code by replacing:

Code:
    files foldName$, info2$( 

with:

Code:
    files "c:";foldName$, info2$( 

This will not affect compatibility with LB 4.04.

Richard.

Re: Works in LB, not in LBB
Post by Richard Russell on Jan 30th, 2015, 1:07pm

on Jan 29th, 2015, 5:58pm, Richard Russell wrote:
I ought probably to modify LBB to be more compatible with LB

I've updated LBB to v2.86; it is no longer necessary for the first parameter of FILES to include the drive letter. The OP's program now runs without modification.

Richard.

Re: Works in LB, not in LBB
Post by Alincon on Jan 31st, 2015, 8:36pm

Good detective work. I never would have suspected that the drive letter was missing. I just took what FILES gave me.
Anyway, I expect that this fix should also explain why the second program I mentioned above does not work.
But where do I download 2.86?
Re: Works in LB, not in LBB
Post by Richard Russell on Jan 31st, 2015, 10:01pm

on Jan 31st, 2015, 8:36pm, Alincon wrote:
But where do I download 2.86?

The usual place, i.e. at the LBB website. I've simply updated it 'in situ', which means anybody downloading LBB now will automatically pick up the latest version.

Richard.

It's baaaak
Post by Alincon on Mar 5th, 2015, 02:22am

The files command still omits the drive letter in v3.0; my program does not work unless I add it.

Code:
    fileName$ = "c:" + info$(index,0) + "\"+ areaTbl$(index)+".dat"