[NEWSboard IBMi Forum]

Hybrid View

  1. #1
    Registriert seit
    Jan 2003
    Beiträge
    759

  2. #2
    Registriert seit
    Jul 2008
    Beiträge
    7
    OK.
    Ich habe mir mal die Funktionen angesehen und den Code geschrieben (nur die für die IFS Dateien relevanten Zeilen). Kann sich jemand, der sich damit auskennt den Code einmal ansehen und mir mitteilen, warum die Datei immerwieder überschrieben wird und ein anhängen von Streams nicht funktioniert? Wäre wirklich dankbar. Ich kann übrigens keine Datei hochladen!?
    Bernd

    * +--------------------------------------------------------------+
    * | |
    * | Erstellt ...: 01.07.2008 |
    * | |
    * | Geändert ...: |
    * | Grund ......: |
    * +--------------------------------------------------------------+
    * | BDE Scannen der Teile und schreiben in IFS |
    * +--------------------------------------------------------------+
    *
    **-- Control Specs: ----------------------------------------------**
    H Option( *SrcStmt ) DftActGrp( *No ) BndDir( 'QC2LE' )
    **
    ** Dateien (Workstation, Printer etc.) ...
    **
    **
    **-- Globale Variablen -------------------------------------------**
    D FILE_o S * ist Cursor
    D String S 512A ist String
    D rc S 10I 0 ist Ganzzahl
    D Idx S 5U 0 ist Ganzzahl o. Vorz
    *
    **-- Globale Konstanten ------------------------------------------**
    D FileName C '/MetallPro/scans001.log' Datei in IFS
    D LF C x'25' Hex(25) = Linefeed
    *
    **-- IFS Streamfile Funktionen ----------------------------------**
    Dopen Pr * ExtProc( '_C_IFS_fopen' ) Prozedur 1
    D * Value Options( *String )
    D * Value Options( *String )
    **
    Dfgets Pr * ExtProc( '_C_IFS_fgets' ) Prozedur 2
    D * Value
    D 10i 0 Value
    **
    Dfputs Pr 10i 0 ExtProc( '_C_IFS_fputs' ) Prozedur 3
    D * Value Options( *String )
    D * Value
    **
    Dclose Pr 10i 0 ExtProc( '_C_IFS_fclose' ) Prozedur 4
    D * Value
    **
    * +--------------------------------------------------------------+
    * | |
    * | Main |
    * | |
    * +--------------------------------------------------------------+
    **
    **...
    ** ... Code für interaktive Verarbeitung
    ** ...
    **-- Open Files, Konvertierung zu Job Codepage:
    **
    C Eval FILE_o = open( %TrimR( FileName ) Öffnen
    C : 'w, codepage=273'
    C )
    **
    C If FILE_o <> *Null
    ** izeile ist Scancode
    C Eval rc = fputs( izeile +
    C %Char( Idx ) +
    C LF
    C : FILE_o Schreibe Zeile
    C )
    **
    C Eval rc = close( FILE_o )
    C EndIf Schliessen
    **
    **...
    ** ... weiterer Code
    ** ...
    **-- Ende der Verarbeitung
    C Eval *InLr = *On
    C Return

  3. #3
    Registriert seit
    Feb 2001
    Beiträge
    20.695
    Du musst dir den Open mit den Parametern aus dem C-Handbuch mal genauer ansehen.

    Mit "w" wird geöffnet und zurückgesetzt, Länge also wieder auf 0.

    Siehe hier:

    Mode Description
    r
    Open a text file for reading. The file must exist.

    w
    Create a text file for writing. If the given file exists, its contents are
    destroyed unless it is a logical file.

    a
    Open a text file in append mode for writing at the end of the file. The

    fopen()
    function creates the file if it does not exist and is not a logical file.

    r+
    Open a text file for both reading and writing. The file must exist.

    w+
    Create a text file for both reading and writing. If the given file exists, its
    contents are cleared unless it is a logical file.

    a+
    Open a text file in append mode for reading or updating at the end of the
    file. The
    fopen() function creates the file if it does not exist.

    rb
    Open a binary file for reading. The file must exist.

    wb
    Create an empty binary file for writing. If the file exists, its contents are
    cleared unless it is a logical file.

    ab
    Open a binary file in append mode for writing at the end of the file. The
    fopen function creates the file if it does not exist.

    r+b
    or rb+

    Open a binary file for both reading and writing. The file must exist.
    w+b
    or wb+

    Create an empty binary file for both reading and writing. If the file exists,
    its contents will be cleared unless it is a logical file.
    a+b
    or ab+

    Open a binary file in append mode for writing at the end of the file. The
    fopen()
    function creates the file if it does not exist.

    Ich denke du musst "a" verwenden, was allerdings nicht funktioniert, wenn die Datei neu ist.

    Wenn alse der Open(..., "a, ...") fehlschlägt, dann mit Open(..., "w, ...") wiederholen.

    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  4. #4
    Registriert seit
    Jul 2008
    Beiträge
    7

    Smile

    Hallo!
    Ein dickes Lob für den Moderator. Die Informationen waren Gold wert. Alles funktioniert nun genauso, wie ich es wünsche - und zudem noch richtig schnell. Viel Dank also noch einmal
    Bernd

  5. #5
    Registriert seit
    May 2002
    Beiträge
    1.121
    Hallo Bernd,

    wenn Du ne weile dabei bleibst, wirst DU merken das dir hier in 99,9 % der Fälle geholfen wird. Und über kurz oder lang wirst auch du hier jemanden helfen können.

    Gruß Ronald

  6. #6
    Registriert seit
    Feb 2001
    Beiträge
    20.695
    Dat hasse aber schön jesacht
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

Similar Threads

  1. Datei im IFS auf iSeries verschlüsseln
    By jo400 in forum IBM i Hauptforum
    Antworten: 1
    Letzter Beitrag: 21-10-06, 17:57
  2. IFS Datei Daten hinzufügen
    By sim in forum NEWSboard Programmierung
    Antworten: 11
    Letzter Beitrag: 18-05-06, 08:00
  3. Datei aus IFS holen
    By jogisarge in forum NEWSboard Programmierung
    Antworten: 1
    Letzter Beitrag: 15-05-06, 13:47
  4. Datei im IFS löschen (root)
    By Karo in forum IBM i Hauptforum
    Antworten: 2
    Letzter Beitrag: 29-07-05, 14:00
  5. IFS Datei aus Verzeichnis löschen
    By PGMR in forum NEWSboard Programmierung
    Antworten: 2
    Letzter Beitrag: 24-06-04, 14:30

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •