IBM Carriage Control (ASA) Formatting

IBM Carriage Control (ASA) Formatting

1
NewbieNewbie
1

    Apr 10, 2007#1

    I have a number of files that have ibm carriage control codes in first column.
    How do I create a macro that can replace the codes with the appropriate line feeds and eliminate the extra column?

    The codes in column 1 are:
    blank Advance one line
    0 Advance 2 lines
    1 Advance 1 page
    - Advance 3 lines
    + Do not advance

    6,686585
    Grand MasterGrand Master
    6,686585

      Apr 11, 2007#2

      You can't really expect an answer with that poor description. Post an example before and after macro execution enclosed in to help us to understand what you want.
      Best regards from an UC/UE/UES for Windows user from Austria

      262
      MasterMaster
      262

        Apr 23, 2007#3

        Was waiting on is2gu to get back, but as I am quite familiar with ASA control characters:
        http://en.wikipedia.org/wiki/ASA_carria ... characters
        I offer this solution:

        Textfile with ASA control chars in 1st column:

        Code: Select all

        1first line
        0third line
        +           overlay on third line (not supported, but deleted)
        -sixth line
         seventh line
        1new page, 1st line
         Second line
        0fourth line
        
        After "expanding" the ASA control chars:

        Code: Select all

        first line
        
        third line
        
        
        sixth line
        seventh line
        ^b
        new page, 1st line
        Second line
        
        fourth line
        
        The "^b" is replaced by the actual page break control char.

        Here is the macro (could be named "asaexpand"):

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        UnixReOff
        Find RegExp "%[+]*^p"
        Replace All ""
        ColumnModeOn
        EndSelect
        Key Ctrl+END
        Key HOME
        Key RIGHT ARROW
        Key SHIFT
        SelectToTop
        StartSelect
        Key HOME
        Find "1"
        Replace All SelectText " %%%newpage%%%"
        Find "0"
        Replace All SelectText "^p "
        Find "-"
        Replace All SelectText "^p^p "
        Key DEL
        ColumnModeOff
        Top
        Find "%%%newpage%%%"
        Replace All "^b"
        Top
        IfCharGt 32
        Else
        Key DEL
        EndIf
        
        Please note, that I use "^p" so the text file should be DOS format (Use File / Conversions if not, or change the macro accordingly )