+ Reply to Thread
Results 1 to 8 of 8

Translate form data into a text string and output that string into a preformated length

  1. #1
    Registered User
    Join Date
    03-16-2012
    Location
    Moncton, NB, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Translate form data into a text string and output that string into a preformated length

    Hello all,

    I'm attempting to automate some mainframe admin functions that I'm responsible for. When creating an id in some environments it's necessary to enter a text string at the ready prompt but but each line has to be exactly 80 characters including spaces. Typically the length of the enitre string is on the order of 600 characters and includes letters numbers and symbols, and it's imperative that each element be separated by a single space.

    example of the string :

    INSERT testid000 NAME(TESTID000) PASSWORD(xxxxxxxx) IMS JOB TSO KERB-VIO(0) MAX DAYS(35) MINDAYS(3) PSWD-DAT(01/12/12)
    PSWD-INV(0) PSWD-VIO(0) DFT-PFX(testid000) INTERCOM JCL LGN-ACCT LGN-DEST LGN-MSG LGN-PROC LGN-RCVR LGN-SIZE LGN-TIME MAIL MODE MSGID NOTICES PAUSE PROMPT TSOACCT(loca-HU7001Z) TSOPROC(TSOP) TSOUNIT(SYSDA) VLD-ACCT VLD-PROC WTP CICSCL(404040) CICSID(000) CICSUFLD(00000) IDLE(30) UID01(N) UID02(A) UID03(D) UID04(S) UID05(A) UID06() UID07() UID08() UID09() UID10() UID11()
    UID12() DSA(NORTH AMERICAN DSA) DSALID(NADSA) EMPID(123456789) LIDTYPE(E) LOCTN(building) NEWS XEMAIL([email protected])


    I'm attempting to do two things here. First is to build a form to allow the elements in brackets in the example to be populated based on user input and second have the entire string output to a text box that is preformated to force each line to wrap at exactly 80 characters regardless of where it falls. The result being I open the excel sheet, enter some data on a form, press a button and the macro preformats the output string into perfect 80 character lines. I want to be able to copy the output all in one shot and simply paste it into the emulator window knowing that each line is already aligned.

    I know this is a long post and I'm really most interested in the preformatting part ..I'm fairly confident I can build the form and tranlate the user data into the output string.

    Thanks

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Translate form data into a text string and output that string into a preformated lengt

    i put together a simple excel sheet that should accomplish what you are looking for, it will also add spaces to the end of the last line to make it total 80 characters, please have a look and let me know
    Attached Files Attached Files
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    03-16-2012
    Location
    Moncton, NB, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Translate form data into a text string and output that string into a preformated lengt

    Quote Originally Posted by DGagnon View Post
    i put together a simple excel sheet that should accomplish what you are looking for, it will also add spaces to the end of the last line to make it total 80 characters, please have a look and let me know
    this is almost identicle to what I already have and on the surface it looks like this might turn the trick .. however I won't be able to test it until tomorrow ... will advise and thanks for the assist.

  4. #4
    Registered User
    Join Date
    03-16-2012
    Location
    Moncton, NB, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Translate form data into a text string and output that string into a preformated lengt

    ok I had a chance to test it out and it doesn't work quite the way I thought it would. I may have used the wrong words when describing my goal. the resultant output text needs to be 80 characters long regardless of where it falls in the line and then the next 80 characters are put on the second line and so on until all
    ~600 characters are lined up. I guess what I neglected to mention is the hard return at the end of the line .. I will simplify this greatly but what I want is more like the following

    assume this is the entire string and for the sake of demonstration I'll set the wrap at 20 char.

    output string = text(variable) text(variable) text(variable) text(variable) text(variable) text() text() text(variable) text(variable) text(variable) text(variable)

    resulting preformated block should look like this

    text(variable) text(
    variable) text(varia
    ble) text(variable) t
    ext(variable) text()
    text() text(variable
    ) text(variable) text
    (variable) text(varia
    ble)

    above is what I need to copy to clipboard for subsequent paste into the Terminal emulator.

    I've tried a hand full of things in VBA to force the line break (hard return - Not sure which is more appropriate in this context) but my VBA kung fu is weak.

    hope that clarifies what I'm trying to accomplish a little better.

  5. #5
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Translate form data into a text string and output that string into a preformated lengt

    ok, i see what you mean, i have redone it so that it would be a single string seperated by Char(10)&Char(13) this should give you the desired result
    Attached Files Attached Files

  6. #6
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Translate form data into a text string and output that string into a preformated lengt

    sorry updating attachment, i forgot to save in the last version.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-16-2012
    Location
    Moncton, NB, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Translate form data into a text string and output that string into a preformated lengt

    That is perfect ... thanks a bunch for your help on this ... your solution is fast, efficient and far simpler than I thought it would have to be. Thanks DGagnon, You rock.

  8. #8
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Translate form data into a text string and output that string into a preformated lengt

    no problem, with some formating and clean up it will be much more elegant looking, and if you have many fields that require the same data, you can just link them up in the table, reducing the number of changes needed.

    if you need to make any changes to the syntax you can do that in the strings to the far right, this is where the string is original built up in parts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1