Automic Workload Automation

 View Only
  • 1.  Need some with with a PREP_PROCESS_REPORT

    Posted Dec 12, 2019 10:34 AM
    Hi,
    I'm trying to do an PREP_PROCESS_REPORT to pull out Codes.

    My report looks like this and I basically want to pull out the 2 codes listed below and inset into a VARA.


    I've tried a few things, this being my most recent, but the blank lines are causing me to get this error.

    Runtime error in object 'TOAD.QUERY(2)', line '00008'. The start column for the sub-string statement ('000') is not within the string (length '0072').


    :SET &HND# = PREP_PROCESS_REPORT(,,,)
    :PROCESS &HND#
    : SET &LICENCE_KEY#=GET_PROCESS_LINE(&HND#)
    : SET &FIRST_CHAR# = SUBSTR( &LICENCE_KEY#,1,1)
    : SWITCH &FIRST_CHAR#
    : CASE '*'
    : PRINT '* Skip'
    : CASE ''
    : PRINT 'Blank Skip'
    : CASE ' '
    : PRINT 'Space Skip'
    : OTHER
    : PRINT "INSERTING INTO VARA"
    : PUT_VAR TOAD_LICENCE_RESULTS &LICENCE_KEY#
    : ENDSWITCH
    :ENDPROCESS


    I'm sure there is an easier way of doing this but can't figure it out...

    John.


  • 2.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 12, 2019 12:32 PM
    Edited by Reed Byers Dec 12, 2019 12:35 PM
    Sounds like your SUBSTR is causing the problem.

    Check for a blank line BEFORE doing the substr to get the first character.  :)

    Something like:

    : SET &HND# = PREP_PROCESS_REPORT(,,,)
    : PROCESS &HND#

    : SET &LICENCE_KEY#=GET_PROCESS_LINE(&HND#)
    : IF &LICENCE_KEY# = ''
    : PRINT 'Blank Skip'
    : ELSE
    : SET &FIRST_CHAR# = SUBSTR( &LICENCE_KEY#,1,1)
    : SWITCH &FIRST_CHAR#
    : CASE '*'
    : PRINT '* Skip'
    : CASE ' '
    : PRINT 'Space Skip'
    : OTHER
    : PRINT "INSERTING INTO VARA"
    : PUT_VAR TOAD_LICENCE_RESULTS &LICENCE_KEY#
    : ENDSWITCH
    : ENDIF

    : ENDPROCESS

    Let us know if that works (or not)... :)



    ------------------------------
    Reed Byers
    Programmer/Analyst
    Oregon State University
    ------------------------------



  • 3.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 13, 2019 02:21 AM
    Edited by Christoph Rekers Dec 13, 2019 02:22 AM
    ...I don't know why my last post isn't visible...well..-

    As I don't have the original file output I put the Unix job report into a text file and used PREP_PROCESS_FILE instead of PREP_PROCESS_REPORT

    :set &complete_LICENCE_KEY# = ""
    :SET &HND#=PREP_PROCESS_FILE(WIN01, "C:\temp\CR\TTT.txt", "**")
    !: : SET &HND# = PREP_PROCESS_REPORT(,,,)
    :PROCESS &HND#
    : SET &LICENCE_KEY#=GET_PROCESS_LINE(&HND#)
    : set &LICENCE_KEY# = str_trim(&LICENCE_KEY#)
    : SET &FIRST_CHAR# = SUBSTR(&LICENCE_KEY#, 1, 1)
    : SWITCH &FIRST_CHAR#
    : CASE '*'
    : PRINT '* Skip'
    : OTHER
    : set &complete_LICENCE_KEY# = str_cat(&complete_LICENCE_KEY#, &LICENCE_KEY#)
    : PRINT "INSERTING INTO VARA &complete_LICENCE_KEY#"
    : PUT_VAR TOAD_LICENCE_RESULTS, "Licence-Key", &complete_LICENCE_KEY#
    : ENDSWITCH
    :ENDPROCESS


  • 4.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 13, 2019 06:20 AM
    Hi Christoph,
    You sent the other posts as "Messages" so they didn't appear on this thread.


  • 5.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 13, 2019 06:26 AM
    That for both Christoph and Reed for you suggestions.
    Unfortunately neither worked as I was generating full blank likes which are not getting detected by '' or STR_TRIM.

    I went back to my shell script hat is pulling these licence keys. This script is doing a series of Greps and String commands and was able to put in an IF statement around these commands to make sure I don't get blank lines anymore..

    thanks anyway for your help, appreciated...

    filetype=`file &MACHINE#`
    if [ "$filetype" = "&MACHINE#: data" ]
    then
    strings &MACHINE# | grep '<LicenseKey>' | awk -v FS="(<LicenseKey>|</LicenseKey>)" '{print $2}'
    strings &MACHINE# | grep 'qsauth11.key;1;' | awk -v FS="(qsauth11.key;1;|\r)" '{print $2}'
    strings &MACHINE# | grep 'QSAuthorize93.key;1;' | awk -v FS="(QSAuthorize93.key;1;|\r)" '{print $2}'
    else
    grep '<LicenseKey>' &MACHINE# | awk -v FS="(<LicenseKey>|</LicenseKey>)" '{print $2}'
    grep 'qsauth11.key;1;' &MACHINE# | awk -v FS="(qsauth11.key;1;|\r)" '{print $2}'
    grep 'QSAuthorize93.key;1;' &MACHINE# | awk -v FS="(QSAuthorize93.key;1;|\r)" '{print $2}'
    fi



  • 6.  RE: Need some with with a PREP_PROCESS_REPORT
    Best Answer

    Posted Dec 13, 2019 08:05 AM
    Hi John,

    just as suggestion: why not using :register_variable?
    This avoids the prep_process construct that creates definitely more workload on AE than the 2 script lines :-)
    In my opinion its ideal for your purpose...

    https://docs.automic.com/documentation/webhelp/english/AA/12.3/DOCU/12.3/Automic%20Automation%20Guides/help.htm#Script/Reference/REGISTER_VARIABLE.htm%3FTocPath%3DReference%7CAutomation%2520Engine%2520Script%2520Reference%7CScript%2520Elements%2520Ordered%2520by%2520Purpose%7CVariables%2520and%2520VARA%2520Objects%7C_____17

    cheers, Wolfgang

    ------------------------------
    Support Info:
    if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
    Otherwise update/upgrade your system and check if the problem still exists.
    ------------------------------



  • 7.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 13, 2019 09:00 AM
    WOW!
    Never heard of this function before. It looks perfect for what I'm trying to do here and countless other similar script I have.

    Thanks so much....


  • 8.  RE: Need some with with a PREP_PROCESS_REPORT

    Posted Dec 13, 2019 09:05 AM
    Welcome :-)

    ------------------------------
    Support Info:
    if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
    Otherwise update/upgrade your system and check if the problem still exists.
    ------------------------------