Help with fix in True Basic code (beginner)

I'm a (complete) beginner trying to run a program in True Basic and I keep getting the following runtime error message:

"No such file. (9003)

occurred at line 55 in sit_read

called from line 55 in Main program"

It seems as though the program is having issues calling SIT_read in the DATLIB library. The code uses three .trc libraries that I cannot seem to open to look at (DATLIB, DATLIB01, and PBSA-KQP). The program code:

!Program PBSA-KQP.tru

!Program TTB with Stripping approximation 3-25-01

!originally Program "STORM"


!This version is designed to calculate both the SA and KQP

!spectrum and include the shape function from KQP

!for any thin target.

!Written by CAQ 3-26-01; revised 8-5-03 to fix PB shape function, enter version 2


!Version one of STORM is written by M.E. Semaan, August 1999




!First we have to define the libraries where the databases are



LIBRARY "C:\lib\DATLIB01.trc"



LOCAL Z, Ezero, Eta, DeltaE, N, flag, direc$, file1$, path$,outfile$, PBflag

LOCAL cz, mz, crc, beta2, theta, E1s,E2p3, E2p1, E2p2,Z$, conv,ver$!Added 3-2001 for L3..

DIM muc(121), mur(121), mup(121), mup2(121),Attn(121,121),spectrum(121)

DIM shape(121),IEZK(121),STORM(121,121),tot(121,121),ratio2(121),PB(121)

DIM mukbe(121),mukdet(121),mukau(121),mukkap(121),winattn(121),totwattn(121) !added mukkap for kapton win

DIM Muk(121),Xn(121), En(121),IEzerK(121), k(120)

DIM BackSK(121),DeDxR(121)

LOCAL thkbe,thkdet,thkau,thkkap,thkBdet ! added thkkap 12-2k


LOCAL i, j, ii, jj,ij,nn,nm

LOCAL zbe,zdet,zau,zkap,FACT,mufac, ATWT


INPUT PROMPT "Atomic Number of Target=": Z

!INPUT PROMPT "Atomic Weight=": ATWT


INPUT PROMPT "Beam Energy in keV=": EZERO


INPUT PROMPT "Delta E in keV =": DeltaE ! could be 0.25

INPUT PROMPT "Photon Emission Angle=": theta

INPUT PROMPT "version number=": ver$

LET direc$ = "C:\Lib\" !path to library

LET path$ = "C:\lib\output\" !output file path

call SIT_read(direc$)

call SIT_INFO(Z,9,E1s,Z$,ATWT,conv) !1s shell ionization energy in keV

call SIT_INFO(Z,6,E2p1,Z$,ATWT,conv) !L1 shell ionization energy in keV

call SIT_INFO(Z,7,E2p2,Z$,ATWT,conv) !L2 shell

call SIT_INFO(Z,8,E2p3,Z$,ATWT,conv) !L3 shell

!and the atomic weight



LET Ezero = Ezero+DeltaE ! we add a constant to reach Ezero



! Output diskfile name


LET outfile$ = Str$(z) & str$(theta) & str$(int(Ezero)) & ver$ & ".txt"


LET file1$= path$ & outfile$ !



FOR ii=1 to 120

LET k(ii)= (ii-1)*DeltaE






OPEN #1: name file1$, access outin, create newold, organization text

RESET #1: end

PRINT # 1: "z=";Z;"Ezero=";Ezero;"theta=";theta


CALL KQP_Read(direc$)


FOR ii= 1 to 120

LET spectrum(ii) = 0

LET shape (ii) = 1

LET IEZK(ii) = 0


FOR ij = 2 to 120

CALL SASpectrum(Z,E1s,E2p3,E2p2,E2p1,Ezero,k(ij),IEZK(ij))

CALL KQP_InitEo(z,Ezero)

CALL KQP_Spectrum(Z,Ezero,k(ij),spectrum(ij))

CALL KQP_Shape(Z,Ezero,k(ij),theta,shape(ij))

!fix PB shape to 0.11

LET PB(ij)=(IEZK(ij)-spectrum(ij))*0.11!find PB ang. dist. from SA-KQP * shape = .11

LET spectrum(ij)= spectrum(ij)*shape(ij)! fomd OB ang. dist. from shape function

LET IEZK(ij) = PB(ij)+spectrum(ij)! find total brem as PB+OB

!print out k*dsig *beta^2/Z^2

PRINT k(IJ),IEZK(IJ),spectrum(ij)!

PRINT #1: k(ij),IEZK(ij),PB(ij),spectrum(ij),shape(ij)!print out K,total Brem,PB,KQP,KQP shape




Sub SASpectrum(Z,E1s,E2p3,E2p2,E2p1,TE,KE,Sig)



!Stripping approximation of bremstrahlung spectrum from

!Avdonina and Pratt, J. Phys. B: At. Mol. Opt. Phys. 32 (1999) 4261-4276


Local Ti,Tf,Pi,Pf,Ef,Ei,k,betai,betaf,qplus,qminus, alpha, mc2,Zion,nui

Local lamda0sq,lamdaionsq,nfac,Gbion,GBH,Gcor,Fmod,Felw,G,L,D,epsi,epsf,C

Local sigkr,scale,pig


Let mc2 = 511 !electron rest mass

let alpha = 1/137

Let pig = 3.14159265

Let scale = 1 !scale factor not needed

Let Ti = TE/mc2

Let k = KE/mc2

Let Tf = Ti - k

Let Pf = sqr((2+Tf)*Tf)

Let Pi = sqr((2+Ti)*Ti)

Let Ei = Ti + 1

Let Ef = Tf + 1

Let betai= Pi/Ei

Let betaf=Pf/Ef

Let nui = Z*alpha/betai

let sigkr = 5.61 !to get cross section in mb units

let nfac = Z*(1/3 - 0.002*Z) !near eq (17)

Let qplus = Pi + Pf

Let qminus = Pi - Pf

If nui < 1 then

Let lamda0sq = 0.798*Z !near eq (17)


Let Lamda0sq = 0.225 +0.205*Z - 0.00086*Z^2 !eq (19)

end if

If KE > E1s then

Let Zion = Z

Let lamdaionsq=lamda0sq*(nfac+1)


if KE >E2p3 then!LIII

let Zion = Z-2!**


if KE > E2p2 then ! LII

Let Zion = Z-6


if KE > E2p1 then ! LI

Let Zion=Z-8


Let Zion=Z-10

end if

end if

end if


Let lamdaionsq = lamda0sq*(1-(Zion/Z)^(nfac+1))/(1-Zion/Z) !EQ (17)

end if


! calculate eq (15)


Let Gbion = (Z-Zion)^2*(qminus^2/(qminus^2+lamdaionsq)-qplus^2/(qplus^2+lamdaionsq))

Let Gbion = Gbion + (Z^2-Zion^2)*log((qplus^2+lamdaionsq)/(qminus^2+lamdaionsq))

Let Gbion = 1.732/2/Z^2/pig*(2*Zion^2*log(qplus/qminus)+Gbion)


If nui < 1 then

Let C = 1 + (Z*alpha)^2*(2-Ti)/4 !eq (11)


! calculation of eq (8)


Let L = 2*log((Ei*Ef+Pi*Pf -1)/k)

Let epsi = 2*log(Ei+Pi)

Let epsf = 2*log(Ef+Pf)

Let D = 8*Ei*Ef/(3*Pf*Pi)+k^2*(Ei^2*Ef^2+Pf^2*Pi^2)/(Pf^3*Pi^3)

Let D = D+k*(epsi*(Ei*Ef+Pi^2)/(2*Pf*Pi^4)-epsf*(Ei*Ef+Pf^2)/(2*Pi*Pf^4)+k*Ei*Ef/(Pf^3*Pi^3))

Let D = L*D + epsi*Ef/Pi^3+epsf*Ei/Pf^3-epsi*epsf/(Pi*Pf)

Let D = D +4/3-2*Ei*Ef*(Pf^2+Pi^2)/(Pf^2*Pi^2)

Let GBH = 3*sqr(3)/16/pig*Pf/Pi*D*betai^2 ! eq (8)


Let Fmod = Pi*(1-exp(-2*pig*Z*alpha/Pi))/(Pf*(1-exp(-2*pig*Z*alpha/Pf)))

Let Gcor = C*GBH*Fmod !eq (12)

Let G = Gbion - 1.732/pig*log(qplus/qminus) + Gcor !eq (16)


let Felw = Pi*(1-exp(-2*Z*pig/Pi))/(Pf*(1-exp(-2*Z*pig/Pf))) !eq (9)

Let G = Gbion*Felw !eq (18)

End if

let sig = G*sigkr !scaled cross section in the same units as KQP spectrum


end sub



Any help (and patience!) is appreciated.


help with code

The program that these SUBs come from is not part of True Basic that I am aware of. (DATLIB, DATLIB01, and PBSA-KQP). Did these come with version 6 of TB? I do not have these Libraries/SUBs and have no idea what they are concerned with.

So I really can't offer any other suggestion. Unfortunately there is apparently no support of a technical nature at TB, unless someone happens along with an answer. BigJohn is the only guy I know of who has a good understanding of the workings of TB; he wrote the "new" editor which comes with v.6, and possibly some of the other stuff with that version. Perhaps he might know something about these LIBs. The basic core of True Basic itself is the same as it's always been; nobody knows how to change it.

What is the software that's involved? Your code above looks as if it may have to do with physics or chemistry, but I can't tell what these subs are supposed to do.

Mike C.

Help with TB code...

Hello scw024000,

Normally, to invoke a Library, statements such as:

LIBRARY "[complete path to the Library]\[name of the Library itself]"

are placed anywhere prior to the CALL to a SUB which is in that LIBRARY.

You have done this in the lines:


LIBRARY "C:\lib\DATLIB01.trc"

I do not know what the Libraries 'DATLIB' and 'DATLIB01' are; as they are not in the files that I have which came with the GOLD and SILVER version 5's or any other versions that I have.

They must be something which is included in version 6. Anyway, if the path 'C:\Lib\' is correct, and those libraries are in fact in that location, then those two lines should be correct, and would be sufficient to invoke those LIBRARies.

Next are the lines:

LET direc$ = "C:\Lib\" !path to library

LET path$ = "C:\lib\output\" !output file path

call SIT_read(direc$)

Now if 'SIT_read' is a SUB in one of the two LIBRARies defined above, you should be able to CALL it using whatever arguments it requires. Your line 'call SIT_read(direc$)' implies that the argument to the SUB 'SIT_read' is supposed to be the directory 'direc$' which was assigned the value '"C:\Lib\"'.

Are you sure that the argument required by the SUB 'SIT_read' is its PATH, and not some other thing, such as a FILENAME that is supposed to be read and processed in some way? I have never encountered a situation where a SUB wants its own path as an argument. At any rate, if you have the pdf manuals for the TB version you have, it should be possible to check what the argument(s) to that SUB are supposed to be.

My guess is that the proper CALL would be: 'CALL SIT_read([some valid path\file name of some file to be read])'. There may even be other arguments needed along with the path\file name. Certainly a special LIBRARY and special SUB to read a plain file is not necessary.

In any case, if the SUB 'SIT_read' is expecting a valid 'path\filename' and you send it a 'path' only, such as 'direc$', then this would give you the 'NO SUCH FILE' ERROR.

Finally, you have 'LET path$ = "C:\lib\output\" !output file path' which sounds like this is a directory where the results of the program's processing is to be saved. If this be the case, then a folder named 'output' had better exist in the directory '"C:\Lib\"', or you will get another ERROR when you try to save a file there. It appears that the lines:

LET outfile$ = Str$(z) & str$(theta) & str$(int(Ezero)) & ver$ & ".txt"!

LET file1$= path$ & outfile$ !

indeed define the output filename you intend to store in "C:\lib\output\". Then as long as you had created the folder 'output' in the "C:\lib\" folder this should work correctly.

There's another 'CALL KQP_Read(direc$)' with a LONE PATH as an argument. I don't know what these SUBs do, but if they are trying to read some kind of file, then once again, if the argument isn't a valid 'path\filename' the 'NO SUCH FILE' is gonna pop up again.

(And lastly, you cannot peruse 'trc' files because they are compiled, but if you want to look at the gobbledy-gook that's inside them, just drag one over into any text editor and you will see. Sometimes, TB supplies uncompiled versions of the LIBs in a folder called 'sources', and you CAN read those. And by the way, all uncompiled TB programs are nothing but plain text files. They will run even if the extension is '.txt' instead of '.tru".)

This is my best guess as to what the problem is. Hope this has helped.

Mike C.

Help with code

In some of the documentation that came with the code, it says:

Initializes the module by reading the compressed file [SIT.dat]

INPUT: [direc$] is the directory where [SIT.dat] is located

NOTES: This call must be made ONCE otherwise no SIT call will work
eg: call SIT_Read("c:\library\")"

So it looks like the program is looking for the SIT.dat file. I tried changing the line to:
call SIT_read("C:\Lib\SIT.dat")
but I got the same error message (obviously, I've named the folder containing the libraries "Lib" instead of "library," as in the documentation).
Without being able to see the what's in the library, is there any thing else that you suggest trying?
A few moments after posting, I realized that the "c" in "trc" stands for "compiled," which explains why I can't see any of the library contents.
Thanks for your help!