1 Reply Latest reply: May 15, 2014 9:58 AM by Grant Perkins RSS

    Question about Fields

    Traveler _



      I have a novice question about fields.


      I have a report that is a .txt file with 1 record per line but the size of the fields change.  example:


      50000ChicagoLake Shore Dr 30025New York59th StEtc The {} Indicates the field type on the report.  So I do a preceeding string equals {} however it would be nice if I could say the field begins at the end of and the field ends at the begining of .  Everything gets screwed up when the length of the field changes.


      Is there a way to do this?  This is the first report I have had that did not have fixed field lengths.



        • Question about Fields
          Grant Perkins

          If you have a fairly recant version of Monarch you could try a floating trap which should work providing you always have the same number of fields defined on the line. (If not it might get a bit trickier).


          I Suppose it is possible that the curly brackets might cause issues. You could use the MSRP utility to change them to something else. (Or an editor of course, but MSRP is likely to be faster.


          Or you could bring the entire line into Monarch (assuming it would not be too wide for the version you are using - 1000 chars for most versions up to V7 if memory serves, 4000 for V8 - and then split the large field into smaller ones using calculated fields. Perhaps manipulate the field type identifier first with something like the REPLACE function (V8) and then perhaps the LSPLIT or RSPLIT functions to extract the fields from the whole-line field.


          There are a number of possibilities. Which is (or are) the most appropriate is rather dependent on the what your target output is (an maybe which version of Monarch.)


          HTH. I will be happy to answer any followup questions.