Automic Workload Automation

 View Only
  • 1.  UNIX Command & Automic Script

    Posted Feb 08, 2017 01:02 AM

    I have a VARA object with a set of keys & values and there is one particular key with a value of length 5000 characters

    I am doing some string concatenation and using an echo command to write to a file on unix server using PREP_PROCESS_VAR. All the Key/value pair gets written to the file except the one which has around 5000 characters

    :SET &HND# = PREP_PROCESS_VAR(VARA.TEST)

    :PROCESS &HND#

    :SET &RET1# = GET_PROCESS_LINE(&HND#,KEY01)

    :SET &RET2# = GET_PROCESS_LINE(&HND#,KEY01,&COLUMN#)

    echo [&RET1#] [&RET2#] > test.txt

    ENDPROCESS

    :CLOSE_PROCESS &HND#

    This fails at the echo step when it hits the 5000 characters. If I reduce it to 1000 approx., it works. I don't remember having a limitation to unix echo command

    I tried multiple options using an Array to fill and print but it doesn't print all the characters

    The only was I could get it work for that 5000 characters is to use WRITE_PROCESS by defining a PREP_PROCESS_VAR on that specific vara, key,column. However, I am not able to combine the WRITE_PROCESS with my existing code as it uses unix commands

    I have to place the WRITE_PROCESS in a second job and execute them one after the other in order to get it work

    I looked at the JCL and it says 002 lines suppressed and WRITE_PROCESS is exactly two lines and I see it in "Script" tab but I don't see it in "JCL" tab. Is there a way that I can combine unix commands and automic scripting using WRITE_PROCESS in one single job in "process" tab?





  • 2.  UNIX Command & Automic Script

    Posted Feb 08, 2017 01:22 AM

    I guess the job has the status FAULT_OTHER and not ENDED_NOT_OK ? If it is FAULT_OTHER the issue is in the AE like your JCL has grown too large. Click details on the statistic entry and you should be able to see the error message.

    The ENDED_NOT_OK would indicate an issue with Unix. Old Unix systems had a limitation of 1024 characters on the shell. Also check the shell you're using (sh, ksh, bash...).



  • 3.  UNIX Command & Automic Script

    Posted Feb 08, 2017 08:37 AM
    It is possible that this is a limitation on the AE script variable. We ran into a similar issue concatenating long values into a single variable, which returned an error that it exceeded its 1024 character limit. 


  • 4.  UNIX Command & Automic Script

    Posted Feb 08, 2017 10:30 AM

    Thanks...

    I am able to achieve the desired result by mixing echo commands and WRITE_PROCESS but WRITE_PROCESS doesn't get processes in the same process tab. If I create two jobs, 1) With all echo commands 2) WRITE_PROCESS it works. I was able to mix unix shell commands with other scripting elements in automic script in process tab. but, this WRITE_PROCESS doesn't work that way. Does anyone know why?

     

    Another question

    Is there also a way that I can concatenate a constant string to a VARA value based on the key in PREP_PROCESS_VAR before writing it to a file using WRITE_PROCESS. WRITE_PROCESS is only accepting a handle and is not accepting string...The only way I was able to get it to work is to store the concatenated string in VARA / create a temp VARA object to hold the concatenated string.

    I even tried storing the concatenated string in an array and use that but it didn't work




  • 5.  UNIX Command & Automic Script

    Posted Feb 09, 2017 02:30 AM

    Hi Amar

    What you're trying to achive sounds adventurous. You could use write_process to create a temporary script that is executed afterwards? It's a hack but if you describe what's in the VARA and what the result should be there might be another way to achive the same.

    I wrote a marketplace solution that converts a VARA content to a CSV file. You might want to take a look at the code as I think it's similiar to what you try to achive:

     

    https://marketplace.automic.com/details/vara2csv-csv2vara



  • 6.  UNIX Command & Automic Script

    Posted Feb 14, 2017 12:34 PM
    Hi Joel

    I could leverage what you have shared and convert my current process by replacing all the echo commands to WRITE_PROCESS by creating a handle just like you did

    Even before I could do that, I am stuck again at yet another wierd rpoblem

    While working on the WRITE_PROCESS, I had a challenge where the WRITE_PROCESS is not picking a variable to the column that I am specifying.
    WRITE_PROCESS(Data-Sequence Reference, File, Agent, Login,[Mode],[CodeTable], [File Attributes], [Column])

    The [Column] attribute here is what I am referring to. If I specify as 3 because I want the WRIT_PROCESS to write only that specific column to a file, it works
    But, I created a variable &VARA_COL_NUM# and pass the value in "task properties" to be dynamic enough and use that variable in WRITE_PROCESS against [column], it writes all the columns to the file. I have tried different ways and still can't get that to work with a variable. Am I missing something

    Is it possible to specify only that specific column that I want to write as per your solution?



  • 7.  UNIX Command & Automic Script

    Posted Feb 15, 2017 03:19 PM
    Want to give an update on where I am
    Joel. Thanks for sharing your solution. I was able to leverage a part of your code (Mainly creating the Data Sequence using CREATE_PROCESS) and able to get it to work

    I was wondering about the naming convention that you have followed 
    I see few script variables named as &P_ and few as &L_. I really appreciate if you can provide some insight into it


  • 8.  UNIX Command & Automic Script

    Posted Feb 15, 2017 05:59 PM
    I have not looked at the code, but it is common to use a leading character to designate the scope of a variable, or where it is defined.  "P" might mean "PromptSet" and "L" might mean "Local". 


  • 9.  UNIX Command & Automic Script

    Posted Feb 15, 2017 11:51 PM
    Pete is absolutely right :-)


  • 10.  UNIX Command & Automic Script

    Posted Feb 21, 2017 11:16 AM
    Thanks