Announcement

Collapse
No announcement yet.

Pbcc double coma

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pbcc double coma

    I needed to put a double coma in the put statment in the following
    code or else I would get error 411 "," required. In a another file
    openning statment the same put statment didn't require the double
    coma. What I am I doing wrong here?
    OPEN "DATARACE" FOR RANDOM AS #2 LEN=43
    DIM S AS RACEDATA
    S.TRK=DB$(1)
    S.DDD=DT$
    S.RC=DB$(3)
    S.DIS=DB$(6)
    S.SUR=DB$(7)
    S.TP=TYP$
    S.PAR=DB$(217)
    S.AGE=AGESEX$
    S.EARLYPAR=DB$(215)
    S.LATEPAR=DB$(218)
    S.CR=CHR$(13)
    PUT 2,, EE%
    CLOSE #2

    ------------------
    Jack Jasperson

  • #2
    Jack,

    By just looking at your code, the line:

    Code:
    PUT 2,, EE%
    the EE% needs to be a string or a struct

    Code:
    PUT 2,, S   '<----- TYPE RACEDATA
    Look at WRITE if you want the ability to write data with comma's
    between the values.



    ------------------
    -Greg
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

    Comment


    • #3
      Jack, you need to use a RECORD position in your PUT statement since
      you opened the file as RANDOM. Something like this...


      Code:
      S.TRK = DB$(1)
      S.DDD = DT$
      .....
      .....
      S.CR = CHR$(13)
      PUT 2, 1, S
          ^  ^  ^
          |  |  +- Variable Name To Save (Can Be Any Type).
          |  +- Record Position In File
          +- File Handle
        
      or
      PUT$ 2, S$   ' S$ Must be a String Type Variable in This instance
      If you Omit the RECORD Position in the PUT statement the Comma still
      has to remain.

      I hope this helps. If you want to write text data to the file OPEN
      the file for OUTPUT or APPEND and then use the PRINT# or WRITE#
      statements to write the data to your file.


      Scott


      ------------------


      [This message has been edited by Scott Slater (edited August 28, 2001).]
      Scott Slater
      Summit Computer Networks, Inc.
      www.summitcn.com

      Comment


      • #4
        Mmm. Well, there is actually nothing wrong with PUTting an integer.
        However, looking at Jack's example does suggest that the intent was
        to PUT the UDT. Possibly, EE% is mean to be the record number? In
        which case:

        PUT #2, EE%, S

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment

        Working...
        X