Announcement

Collapse
No announcement yet.

PB35 fielding statement to PBCC5 Field statement

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

  • PB35 fielding statement to PBCC5 Field statement

    The following is a excert from a PB35 source. How can this be translated to PBCC5. It appears the I can't have an array for Field Variables.


    FIELD #4, wid%(1) AS ent$(1), wid%(2) AS ent$(2), wid%(3) AS ent$(3), wid%(4) AS ent$(4) etc.

    I'm fielding a file record where the fielding information is read in from the first 2 records of the file. These are read in opening the file as input (via input#filenu). The lines ae comma delimited getting the widths for each
    ent$().

    Anyone have any suggestions

  • #2
    Code:
    DIM ent(1 TO 4) AS FIELD
    DIM wid(1 TO 4) AS INTEGER
    FIELD #4, wid%(1) AS ent$(1), wid%(2) AS ent$(2), wid%(3) AS ent$(3), wid%(4) AS ent$(4)
    How long is an idea? Write it down.

    Comment


    • #3
      >The lines ae comma delimited getting the widths for each

      Um, if the fields are delimited, why are you even looking at 'width' constants?
      You can just...
      Code:
        LINE INPUT hFIle, S$
        nField =  PARSCOUNT (S$)    ' comma assumed if not specified
        REDIM    ent$(nField-1) 
        PARSE    S$, Ent$()
      (Verb-for-verb statement-for-statement function-for-function ports from one language/OS to another. Stone losers.)

      [later]
      Oh, never mind. The data are not delimited, are they? Only the width data are delimited, right?

      That is, the file looks like
      Code:
      1,2,3,4
      5,6,7,8
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH
      ...
      ???

      Or maybe...
      Code:
      8                           <<< record one = number of fields
      1,2,3,4,5,6,7,8         <<< record two = widths of those fields
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH   << data
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH
      ABBCCCDDDDEEEEEFFFFFFGGGGGGGHHHHHHHH
      ...
      ???


      (Enough code not shown)

      MCM
      Last edited by Michael Mattias; 26 Jul 2009, 10:20 AM.
      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment

      Working...
      X