ko0g+@andrew.cmu.edu (Kevin O'Neill) (12/06/90)
I may be in the wrong place, but I'll give it a try anyway. I am trying my hand at writing a program in IBM BASICA that I had previously done for an Apple, and I'm having a problem figuring out the routine for saving the data created in the program to a file. The problem is that about 50 variables are defined by the program, but I haven't figured out how to get the FIELD statements to work properly. For example, I try ... 100 OPEN "DATAFILE" 200 FIELD #1,3 AS MN$, 4 AS AP$, 4 AS RG$, {etc.} 300 LSET MN$=NM$: AP$=A1$: RG$=R1$: {etc.} 400 PUT #1,1 500 CLOSE I cannot get the fields set for all of the variables on a single line; I've tried a second FIELD line, but it overwrites the variables from part of the first line. What am I doing wrong, and how do I correct it? <ko0g+@andrew.cmu.edu>
drack@titan.tsd.arlut.utexas.edu (Dave Rackley) (12/07/90)
In article <EbLaI=y00WBNI1QUUk@andrew.cmu.edu> ko0g+@andrew.cmu.edu (Kevin O'Neill) writes: > I may be in the wrong place, but I'll give it a try anyway. > I am trying my hand at writing a program in IBM BASICA that I had previously > done for an Apple, and I'm having a problem figuring out the routine for > saving the data created in the program to a file. The problem is that about > 50 variables are defined by the program, but I haven't figured out how to > get the FIELD statements to work properly. For example, I try ... > 100 OPEN "DATAFILE" > 200 FIELD #1,3 AS MN$, 4 AS AP$, 4 AS RG$, {etc.} > 300 LSET MN$=NM$: AP$=A1$: RG$=R1$: {etc.} > 400 PUT #1,1 > 500 CLOSE > I cannot get the fields set for all of the variables on a single line; I've > tried a second FIELD line, but it overwrites the variables from part of the > first line. > What am I doing wrong, and how do I correct it? It seems to me that your open statement is causing the problem. Try the following: 100 open "datafile" for random as #1 len=your_rec_len Without setting 'your_rec_len' basica defaults to 128 bytes, which may not be large enough for your records. Hope this helps! -- DISCLAIMER? I don't know anything 'bout any ol' disclaimer! +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+ | David Rackley | | | Applied Research Laboratories | Remember, you can tuna fish, | | The University of Texas | But you can't tuna piano! | | Austin, TX. 78758 | | +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
is@athena.cs.uga.edu ( Bob Stearns) (12/07/90)
In article <EbLaI=y00WBNI1QUUk@andrew.cmu.edu> ko0g+@andrew.cmu.edu (Kevin O'Neill) writes: >I may be in the wrong place, but I'll give it a try anyway. > >I am trying my hand at writing a program in IBM BASICA that I had previously >done for an Apple, and I'm having a problem figuring out the routine for >saving the data created in the program to a file. The problem is that about >50 variables are defined by the program, but I haven't figured out how to >get the FIELD statements to work properly. For example, I try ... > > 100 OPEN "DATAFILE" 100 open "r",1,"datafile" > 200 FIELD #1,3 AS MN$, 4 AS AP$, 4 AS RG$, {etc.} > 300 LSET MN$=NM$: AP$=A1$: RG$=R1$: {etc.} 300 lset mn$=nm$ : lset ap$=a1$ : LSET RG$=r1$ : {etc} > 400 PUT #1,1 > 500 CLOSE > >I cannot get the fields set for all of the variables on a single line; I've >tried a second FIELD line, but it overwrites the variables from part of the >first line. > >What am I doing wrong, and how do I correct it? > ><ko0g+@andrew.cmu.edu> The lines as corrected above should fix your problem. I do have a recommendationhowever. Buy a copy of QUICKBASIC if you want to do BASIC programming. It is much better than BASICA, runs much faster since it is compiled and gives you a better (IMO) working environment. Better suggestion if you are not committed to BASIC: buy Turbo Pascal from Borland and use it.