CSV INFO Data Structure

 3 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Robert
Veteran Member
Posts: 82
Veteran Member

    Back to well once again.
    boy...just about every time I want to use an API.

    I have a workdef file with a DED prefix.  I want to make sure the interface is found prior to a 800-READCSV, else I get a run-time-exception.  According to the API doc, I use INFO-FOUND.
    So, I added the following to my code:

    INITIALIZE DEDINFO-FOUND.

    STRING WS-DEDUCTION-FILE DELIMITED BY SIZE
      INTO WS-FILE-SYSTEM.
    DISPLAY DEDINFO-FOUND.

    For the moment, I am leaving the remainder of the code out...but my program compiles, and I can open and read the file.  What I discovered is DEDINFO returns a 0 if the file is there or not.  I must not be using it correctly.  Any guru out there familiar with the data structure.

     

    Sam Simpson
    Veteran Member
    Posts: 239
    Veteran Member
      Here's some example on how to open a csv file:
      PERFORM 800-OPENINPUTCSV-MYCSV or
      800-OPENAPPENDCSV-MYCSV or
      800-OPENOUTPUTCSV-MYCSV or
      and close them with 800-CLOSECSV-MYCSV.

      There are also APIs on how to write records into the file.
      John Henley
      Posts: 3353
        XXX-FOUND/XXX-NOTFOUND is used to signal the existence of a record, not the file itself.
        Use 900-FILEEXISTS:

        MOVE TO SYSCMD-FILENAME
        PERFORM 900-FILEEXISTS
        IF (SYSCMD-ERROR NOT = ZERO)

        Thanks for using the LawsonGuru.com forums!
        John
        Robert
        Veteran Member
        Posts: 82
        Veteran Member

          Much apprecate John

          Bear with me here...Lawson 9.0 4GL API, page 194.
          Field Description
          INFO-FOUND Indicates whether the file exists

          That is why I used it leading to yet another bug hunt.
          900-FILEEXISTS is not referenced in the doc. Thank you John.

          ** don't append the null character to the file name.