Workload Automation

Tuesday Tip: CA Workload Automation AE Verification Exit - autoextvj 

10-05-2014 11:46 PM

An introduction to the AutoSys JIL verification exit feature.

 

This video can also be viewed on YouTube here: CA Workload Automation AutoSys JIL Verification Exit demo - YouTube

Statistics
0 Favorited
3 Views
1 Files
0 Shares
1 Downloads

Tags and Keywords

Comments

02-21-2018 01:50 PM

Mark_Hanson Hi Mark,

 

Thank you for your video sharing. I am doing JIL verification exit on Windows Server 2012 R2 (64-bits).

I tried the sample you post, and the code compiling has no problem, but nothing happens after I put the "libautoextvj.dll" into "autosys\bin" folder. During this implementation, I have two questions.

 

The first question is the " typedef PAUTOEXTVJ_JILKEYVAL (*pfn_FindJilKeyVal)(PAUTOEXTVJ_JILKEYVAL, char *); " in "autoextvj.h" file. It shows the "pfn_FindJilKeyVal" is char* type, while the value "description" is const char* type. When i build a project using the sample code in Visual studio 2017, it shows error for the const char* and char* is incompatible. So I use " (char*)"description" " to convert const char* instead your sample code. Otherwise, this sample cannot be compiled. This is the code part that I modified from the sample.

 

The second question is related to compilation. I am trying to implement this sample to link autosys but apparently it shows failed. I tried two ways to compile.

One way is using windows terminal to compile: 1. gcc -c -fPIC -Wall SampleCode.c -I..\\code -o temp.o.  2. gcc -shared -fPIC -o libautoextvj.dll temp.o. If I am wrong in windows cmd, I really appreciate your suggestions.

The second way, I tried to use Visual studio to build .dll. I added the head file "autoextvj.h" into the project, but after compiling and build, the autosys does not have anything change.

Both ways I restarted the application sever  and using "file libautoextvj.dll" (I use cygwin in Windows) to show the file: "libautoextvj.dll:  PE32 executable (DLL) (console) Intel 80386, for MS Windows".

I do not know which step makes mistake during my implementation. If you have any idea or suggestion, I really appreciate your help.

Thank you.

08-18-2017 08:53 PM

I see, I will try that next. Tks. 

08-18-2017 05:08 PM

Ah, I see your issue. The libautoextvj.so needs to be placed in the $AUTOSYS/lib directory on the app server machine. In your case, the Solaris 10 machine. So you will need to rebuild it on Solaris.

Also keep in mind that you will need the library in place on any app server machines for which you want the verification.

08-18-2017 04:32 PM

Thank you for the fast response. So the file I created for the shared lib is called "libautoextvj.so" . I had checked permissions before and also restarted the Application Server which runs on Solaris 10. I compiled and created the shared lib using a centos 7 32 bit distribution. Here is the info I see when I run the file command:

 

file libautoextvj.so
libautoextvj.so: ELF 32-bit LSB dynamic lib 80386 Version 1, dynamically linked, not stripped, no debugging information available

 

Once again, Thank you

08-18-2017 04:07 PM

Are you on Linux? Check ownership/permissions on the autoextvj.so file. Run the 'file' command against it to ensure that you have a 32-bit shared lib. Make sure you restart the application server.

08-18-2017 03:40 PM

Hello @Mark Hanson , I'm trying to implement this example but nothing happens when I place the lib at $AUTOSYS/lib. The File compiled fine and no errors were presented.

 

I tried to use also the varialbe (export ISDBGACTIV=LIGHT) for trace information, but no messages or anything helpful.

 

Please if you have any advice or idea where to go to debug this issue would very appreciated.

 

Thank you

11-03-2014 09:15 AM

Thanks for offering the additional insights, Mark Hanson

11-02-2014 06:47 PM

Thank you. I appreciate the feedback.

That was one of the first videos I produced and after viewing it again I can see that unfortunately it is a bit hurried.

 

Yes, after compiling the source it should be the only file named autoextvj.[ dll | so | sl ] in the bin or lib directory.

 

The video covers autoextvj for version 11.0. There have been some changes in 11.3.x mainly due to all of the new job types.

Here is an example for 11.3.x that is loosely based on the sample and validates that a description attribute has been included in any job insert or update operations.

 

The code:

IMPORTANT: When compiling on a 64-bit O/S you will need to compile the library as 32-bit.

For example, here are the commands I use to compile on Linux x64:

 

gcc -m32 -c -fPIC autoextvj.c -o autoextvj.o

gcc -m32 -shared -o libautoextvj.so  autoextvj.o

 

#include <stdio.h>

#include <string.h>

#include "autoextvj.h"

 

AUTOEXTVJ_RET AUTOEXTVJ_ValidateJob(AUTOEXTVJ_JILKEYVAL *pJob, AUTOEXTVJ_JOBINFO *pJobInfo, AUTOEXTVJ_CALLBACK_ROUTINES Callbacks, AUTOEXTVJ_MSG *ppReturnMsg)

{

  int return_code = 0;

  PAUTOEXTVJ_JILKEYVAL pJilKv;

 

  if( pJobInfo->action == EXTVJ_INSERT || pJobInfo->action == EXTVJ_UPDATE )

    pJilKv = Callbacks.pfnFindJilKeyVal(pJob, "description");

 

  if( pJilKv ) {

 

    return_code = AUTOEXTVJ_VALIDATED;

 

  } else {

 

    return_code = AUTOEXTVJ_DENIED;

 

  }

  return return_code;

}

 

 

Here it is in action:

 

[autosys@tesla ~]$ jil
jil>>1> insert_job: test-***
jil>>2> command: true
jil>>3> machine: localhost
jil>>4> exit
______________________________________________________________________________

CAUAJM_I_50323 Inserting/Updating job: test-***
CAUAJM_E_10295 ERROR! Job 'test-***' failed custom job validation.
CAUAJM_E_10302 Database Change WAS NOT successful.
______________________________________________________________________________

CAUAJM_E_50198 Exit Code = 1
______________________________________________________________________________

[autosys@tesla ~]$ jil
jil>>1> insert_job: test-***
jil>>2> command: true
jil>>3> machine: localhost
jil>>4> description: "this job should pass validation"
jil>>5> exit
______________________________________________________________________________

CAUAJM_I_50323 Inserting/Updating job: test-***
CAUAJM_W_10296 Job 'test-***' was modified by custom job validation.
CAUAJM_I_50205 Database Change WAS Successful!
______________________________________________________________________________

CAUAJM_I_52301 Exit Code = 0
______________________________________________________________________________

 

Hope this helps.

 

Mark Hanson

CA Support

10-31-2014 09:30 AM

Mark Hanson:

 

Just mentioning Mark by name so that he sees your question, SEAN SIMON

10-30-2014 09:27 PM

Mark, good work. I enjoyed your presentation

 

You mention that the file should be named 'autoextvj'.  After compiling it, should it be the only file named autoextvj.dll or autoextvj.so in the bin (Windows) or lib(Linux) folder respectively?   I tried compiling the sample file, autoextvj_sample_lib.c, but had no luck with example.

10-06-2014 09:37 AM

Mark Hanson:

This is great....thanks for sharing!

Related Entries and Links

No Related Resource entered.