Reading infile writing multiple output files

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Reading infile writing multiple output files

  • Creator
    Topic
  • #51256
    Femina Jaffer
    Participant

    Hello again.

    I am having trouble with files once again and could use any assistance you can offer.

    I have to be able to read in files and process each file for payors – eg. United, MC, BSNM etc.  I am able to do this and process.  However, I need to append the file prefix to each file that writes to an output.  For example, if I am reading a BSNM19039120489 file and it processes three output files, I need to add “BS” to each file before reading the next file, similarly with the rest of the payor files.  WHen I attempt this, it reads the first file (BSNM) appends the prefix to the output files and duplicates the output of the same file again with different prefixes appended to the file.  Please advise – I have attached my code for review.

Viewing 2 reply threads
  • Author
    Replies
    • #69403
      David Barr
      Participant

      I’m not sure how this proc is being called.  What type of thread is it running on, and what is the context?  It looks like you’re doing a lot of things in one proc that should be left to Cloverleaf: opening input files, routing messages, opening output files, etc.

      The normal way to do this would be to make an inbound thread with the fileset-ftp protocol, and route messages from that thread to an outbound thread that uses fileset-ftp protocol.  You’ll have to use message metadata to get and set the filenames as you copy them.

      If you’re splitting the inbound file, at some point you would run a proc that splits up the original message, and uses msgcopy and msgset to create new messages for each portion of the original message.

    • #69404
      Femina Jaffer
      Participant

      Thank you David for your response.  I have this proc in a stand alone thread which is off.  The thread gets turned on by a cron job.  The tcl proc is placed in the inbound tab.  The purpose of this is too process billing files in an x12 format.  Unfortunately, every few months the client wants new modifications.

      Files are placed in a directory, Cloverleaf picks up files and processes them and then places them in another directory.  There are multiple files with two different file formats – one has a CR/NL after each segment, and the other doesn’t.

      Thank you,

    • #69405
      David Barr
      Participant

      Why are you writing your output file in an inbound TPS proc instead of routing your message to an outbound fileset-ftp thread?

      As for why your script isn’t doing what you think it should, I can’t say exactly.  I see several strange things in the script.  For example, why are you opening a file (inFile), but you’re never reading from the file?  Your inbound TPS proc shouldn’t be opening the files anyway.  If it’s a fileset-ftp thread, Cloverleaf will open the files and read them for you.

Viewing 2 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,125
Forums
28
Topics
9,294
Replies
34,439
Topic Tags
287
Empty Topic Tags
10