IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
 View Only
  • 1.  Advanced macro scripting?

    Posted Tue April 23, 2024 10:12 AM

    Does have a contact with someone who might be able to answer some advanced ACS macro scripting questions?

    I previously reached out to Scott Forstie, who is a Senior Technical Staff Member within IBM i development, explaining that I had reached the end of my limited technical ability and asking if he could refer me to somebody that I could pay to help me work on a couple macro scripts for ACS.  He forwarded me to Ronald Bibby with IBM Systems Expert Labs, who set up a webex meeting with me.

    They must have thought it was going to be a large enterprise project because, much to my surprise, there were three or four IBM employees in the meeting.  When I made it clear I just had some scripting questions, the meeting was over pretty quickly.  Ronald asked me to email him about our questions. I did, but I never heard back from anybody.

    The HAScript language seems to be so uncommon that I got crickets at StackOverflow. ChatGPT gives me answers that might work in regular XML, but don't work in HAScript. The IBM Host On-Demand Macro Programming Guide didn't help at all.

    I literally just want to have somebody teach me how to replace any blank spaces in a variable with a plus sign.



    ------------------------------
    Greg Cornett
    ------------------------------

    #IBMiAccessClientSolutions


  • 2.  RE: Advanced macro scripting?

    Posted Wed April 24, 2024 07:59 PM

    Hello Greg,

    I've never written an HAScript before...but I've programmed in a lot of languages and environments.  I dug into the doc a bit and found that in order to do what you want, you need to import the java classes to do that conversion.  I did it with a simple String.replace() method call.  Here's my simple script:

    <HAScript name="ReplaceChars" description="" timeout="60000" pausetime="300" promptall="true" blockinput="true" author="MichaelSwenson" creationdate="Apr 24, 2024, 6:03:25 PM" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">

        <import>
            <type class="java.lang.String" name="javaString"/>
        </import>

        <vars>
          <create name="$myString$" type="javaString" value="$new javaString('This Is A Test')$" />
          <create name="$newString$" type="string" value="" />
        </vars>


        <screen name="Screen1" entryscreen="true" exitscreen="true" transient="false">
            <description >
                <oia status="NOTINHIBITED" optional="false" invertmatch="false" />
            </description>
            <actions>
                <varupdate name="$newString$" value="$myString.replace(&apos; &apos;,&apos;+&apos;)$" />
                <input value="$newString$" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
            </actions>
            <nextscreens timeout="0" >
            </nextscreens>
        </screen>

    </HAScript>



    ------------------------------
    Michael Swenson
    Software Engineer
    IBM
    ------------------------------



  • 3.  RE: Advanced macro scripting?

    Posted Thu April 25, 2024 08:20 AM

    Thank you, sir! I appreciate your help so much! You have no idea how much this helps me.



    ------------------------------
    Greg Cornett
    ------------------------------