passing value to and from SubProcess

Posted by: Alain B

passing value to and from SubProcess - 04/15/13 03:57 PM

Hi Is there a way to pass and to retrieve data to a sub process like a function or procedure in programming language?
Posted by: Anonymous

Re: passing value to and from SubProcess - 04/16/13 10:05 AM

Hi Alain,

Using the "go sub" task will send your data to a sub process and will automatically be passed the resulting data stream when the sub is done.

If you are enquiring about variables, then you should use jobinfos and/or global variables. Local variables cannot be accessed from a subprocess since there is no way to know what process called it.

Let us know if that answers your questions. Thanks.
Regards,
Olivier
Posted by: Alain B

Re: passing value to and from SubProcess - 04/16/13 10:50 AM

Hi Olivier,

I cannot use global variable because there is more than one different process that can go sub the same subprocess at the same time. and i dont want to dupplicate global variable and subprocess for each process.

if I use %1 to %9 will both the subprocess and the process differentiate each one without error?

les say :
processA set %1 to '1234' then 'go sub' getclientemail who set %9 to '1234@email.com'

processB set %1 to '4567' then 'go sub' getclientemail who set %9 to '4567@email.com'

what I want to avoid is having ProcessA for client '1234' with the email of processB '4567@email.com'
Posted by: Anonymous

Re: passing value to and from SubProcess - 04/16/13 11:16 AM

Hi Alain,

Yes jobinfos will be thread safe and will not conflict. I would recommend starting with %9 and going down isntead of starting at 1, as jobinfos are used by input tasks and can overwrite what you assigned to them. If your data stream will not come accross any other input task along the way, then you can safely use any of them.

Thanks. Regards,
Olivier
Posted by: Alain B

Re: passing value to and from SubProcess - 04/16/13 11:19 AM

ok thanks will try to use %8 and %9
Posted by: Alain B

Re: passing value to and from SubProcess - 04/18/13 02:20 PM

Ok I did some test

ProcessA set variable %7 to 'TEST123'
ProcessA GOSUB ProcessB

ProcessB can read %7 has 'TEST123'
ProcessB setvar %8 to 'ABCDEF'
PROCESSB Exit

ProcessA get %8 has ''

So We cann pass value to the sub process but the subprocess cannot send back the information
Posted by: Anonymous

Re: passing value to and from SubProcess - 04/18/13 02:23 PM

Hi Alain,

There is an option in the GoSub task to backup job information. Make sure to toggle it and see if the job info returns with the right value. You should definitely be able to receive the job info 8 populated.

Regards,
Olivier
Posted by: Alain B

Re: passing value to and from SubProcess - 04/18/13 02:29 PM

Hi Olivier
Already tryed without success
Posted by: Philippe F.

Re: passing value to and from SubProcess - 04/18/13 05:12 PM

Make sure to UNCHECK the "Backup Job Information" option in the GoSub task.

Any changes made to the JobInfos inside the sub will then be propagated back to the calling process.

Obviously, if your Gosub task is inside a branch of the calling process, then you also need to set the same options on the branch itself if you want to access the modified JobInfos from the trunk (or from the parent branch).
Posted by: Alain B

Re: passing value to and from SubProcess - 04/19/13 08:25 AM

Hi Philippe it worked Thanks
Posted by: Alain B

Re: passing value to and from SubProcess - 04/19/13 10:59 AM

I have another question,

the main reason I want to use a subprocess is to simplify the maintenance.

for example I may call processB 90 times, so if one day we change processB we only have to change it at one place.

For example now I retrieving email address from CSV File later we will get it from database.

My question is on performance, does doing 5000 and more a gosub per day will be slower than directly do a run Script instead?
Posted by: Philippe F.

Re: passing value to and from SubProcess - 04/22/13 09:48 AM

There shouldn't be any performance issues. The Input file does indeed get duplicated before being sent to the sub process, but that would also occur if you were to simply add your script in a branch. So unless you are processing evertmely large files, you're unlikely to notice any difference in performance.