Results 1 to 9 of 9
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    suggestion to insert line in a txt file... (2000 sr-1)

    from a CICS screen i capture entire line and i want add in a text file named PROVA.TXT...
    I have maked a macro with a for next cicle to caprture the line from CICS screen
    The line capture is string of data is stored into a var named MIA_LINEA.

    How to add in txt file the line captured?

    Example:

    For i = 8 to 17
    ....
    MIA_LINEA="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa"
    ....
    Here the code to append a new line after the last line stored into txt file

    next i

    hope understand me.;-(

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    Do you want to create Prova.txt in your macroi, or does it already exist?

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    create it before run the macro...
    Happy to have understand me in "one shot", this question in only for Wizard and a good knoledgment of my English/italian/Napolitan <img src=/S/artist.gif border=0 alt=artist width=34 height=29> <img src=/S/angel.gif border=0 alt=angel width=15 height=21>...
    or... if for you is must simple, create a function to store in text file the var just filled from other code...
    Remember, now i like very a function...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    Place code to create a text file at the beginning of your macro:
    <code>
    Dim f As Integer
    f = FreeFile
    Open "CocumentiProva.txt" For Output As #f
    </code>
    Use the correct path instead of Cocumenti.
    To add a line at the end of the file:
    <code>
    Print #f, MIA_LINEA
    </code>
    At the end of the macro, you must close the text file:
    <code>
    Close #f</code>

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    WORK SUPER FINE!!!!!!!!!

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    ... ummmmmmm
    This is very hard for me...

    Assuming i use this piece of code to exclude dupes in import (is refered from a column of Excel in R)
    Now inested column in excel i have a column in text file from 78 to 154 (in this range is stored the index)...
    How to arrange this code


    Index = CONTRATTO & "-" & SOC_1 & "-" & STATO_1 & "-" & AGENZ & "-" & DATA_CTR
    Set Found_INDEX = Sheets(ELENCO).Columns("R:R").Find((Index), LookIn:=xlFormulas)
    If Found_INDEX Is Nothing Then

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    Your original question was about exporting to a text file. Are you now importing from this text file?

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    no....
    During the import from Screen CICS the var MIA_LINEA it can assuming =AAAAAAAAAAAABBB...INDEX
    , after i have inserted this line in txt file is possible to copy from from CICS screen a new data to fill the var it can assuming a valiue already inserted in text file...
    Now, to no permit to store a similar line in text file i have maked a in MIA_LINEA in position 78 to 154 an joined of value (INDEX) and i am sure is unique....

    Example: MIA_LINEA=AAAAAAAAAAAABBB...INDEX

    And before to copy a new line i want to controll in this column INDEX is is alreday present in text file this unique id...
    Hope you have anderstand me, now

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suggestion to insert line in a txt file... (2000 sr-1)

    It's not so easy to check whether an index already occurs in a text file.
    Instead, store the data from CICS in a worksheet. You already know how to prevent duplicate rows in a worksheet.
    When the import from CICS is complete, store the rows in a text file. You can then clear the worksheet, or delete it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •