Genie Job Name/User/Number

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
shuffman
Profound User
Posts: 22
Joined: Fri Jan 29, 2016 11:15 am
First Name: sam
Last Name: huffman
Company Name: gmdsolutions
Phone: 7122624520
Address 1: 2311 W 18th ST
City: Spencer
State / Province: Iowa
Zip / Postal Code: 51301
Country: United States
Contact:

Genie Job Name/User/Number

Post by shuffman »

Hello,

I'm trying to retrieve the job info on each session ran through genie. I found that the PUISNMETA field in PUISSNP appears to have what i am looking for but it's defined as a BINCHAR datatype.

If i run an SQL statement to retrieve a row through my PHP program it returns a bunch of gibberish. Something to do with the CCSID. I've tried several different ways of casting the field without any success. I'm guessing this was done intentionally but thought i'd ask anyways. Perhaps there is a better way to get the info i'm looking for?

Code: Select all

select puisnmeta from PUIDEV.puissnp where puisnid = '8442EC87DE98AE63FD58BD6AD24758044246C9EA60F0B8101DACCCC2ED56E4D4'
Returns:
���������@@����������������"3���P��������������

I should also mention that when i query the file on a green screen it is somewhat readable.

Here is the PHP code:

Code: Select all

$sessionId = $_GET['sessionId'];

$conn = db2_pconnect("*LOCAL", "", "");
if ($conn) echo  "";
else echo 'Connection failed: '.db2_stmt_error().' : '.db2_stmt_errormsg();

$instance = strtoupper(explode('/',$_SERVER['DOCUMENT_ROOT'])[2]);

$sql = "select puisnmeta from $instance.puissnp where puisnid = '$sessionId'";
$stmt = db2_prepare($conn, $sql);
$result = db2_execute($stmt);
$row = db2_fetch_array($stmt);
$meta = $row[0];
echo $sql;
echo '<br>';
echo $meta;
Thanks,
Sam
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Genie Job Name/User/Number

Post by Scott Klement »

That field contains some binary data (data that is not text). Also, when you query it from PHP, the system will try to convert it to ASCII, which will change it's value.

Can you explain why you are doing this?
shuffman
Profound User
Posts: 22
Joined: Fri Jan 29, 2016 11:15 am
First Name: sam
Last Name: huffman
Company Name: gmdsolutions
Phone: 7122624520
Address 1: 2311 W 18th ST
City: Spencer
State / Province: Iowa
Zip / Postal Code: 51301
Country: United States
Contact:

Re: Genie Job Name/User/Number

Post by shuffman »

I would like to be able to have a quick way to do a DSPJOB from the session itself. I thought I could create a shortcut key or something similar that could launch another genie session that i could pass this to. All of our screens are rich displays and are ran through atrium so you have to hunt around sometimes to find the job you are looking for.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Genie Job Name/User/Number

Post by Scott Klement »

I'm not sure I understand. You said that you're running Rich Displays from Atrium, and that means you have to hunt around. But, you also refer to it as a "Genie Job Name/User/Number" and say "launch another Genie session". If you are launching a Rich Display from Atrium, you aren't using Genie. Unless you mean that you are launching a Genie macro from Atrium, which in turn runs a Rich Display in the 5250 job?

But if you are indeed using Genie macros to launch Rich Displays inside 5250 jobs, then the jobs are regular 5250 jobs... so shouldn't be that hard to figure out, right? Unless there are just so many of them that it's hard to figure which is which, I guess.

Well, anyway, I may have a solution for you:

First, if you plan to launch this new session from within your Rich Display or Genie session (if that's where the shortcut key will be set up) then the job info is actually already there in JavaScript variables. The JS code thats attached to your shortcut key can do something like this:

Code: Select all

var url = "/profoundui/auth/genie?skin=YOUR-SKIN&macro=YOURMACRO&var1=name&value1=" + encodeURIComponent(pui.appJob.name) + "&var2=user&value2=" + encodeURIComponent(pui.appJob.user) + "&var3=number&value3=" + encodeURIComponent(pui.appJob.number)
window.open(url);
Obviously, the skin name, macro name, and variable names will depend on how you named things on your end, but hopefully you get the idea. the appJob variables already contain the job information.

Second, if you're not planning to call it from within the session, but rather want to call it from somewhere else... there are User Defined Table Functions (UDTFs) in Profound UI that have all of the job information. They are a little bit slow because they have to read inside each job to get the right information and cross-reference it, but if you don't mind waiting a few seconds, they'll do the job.

I'm not exactly sure how you'd go about picking the right job info, though... But if you look through the data, maybe you can figure it out?

Code: Select all

select * from table(PUI_GetInstJobs('PROFOUNDUI')) as x where PuiJobType='GENIEAPP' or PuiJobType='RDFAPP'
GENIEAPP and RDFAPP are the Genie Application and Rich Display Application jobs, respectively. (There are other jobs used to run things like controller code, SQL code, etc, that you probably aren't interested in.)

Third, if its important to look up the job info from the session id, we provide an API called pui_RtvJobInfo() that can be called from any ILE program that will retrieve the job info from the session id. This is a regular ILE subprocedure that you can call from any ILE language. It is documented here: http://www.profoundlogic.com/docs/displ ... ation+APIs

Hopefully one of those three options will help you?
shuffman
Profound User
Posts: 22
Joined: Fri Jan 29, 2016 11:15 am
First Name: sam
Last Name: huffman
Company Name: gmdsolutions
Phone: 7122624520
Address 1: 2311 W 18th ST
City: Spencer
State / Province: Iowa
Zip / Postal Code: 51301
Country: United States
Contact:

Re: Genie Job Name/User/Number

Post by shuffman »

Code: Select all

var url = "/profoundui/auth/genie?skin=YOUR-SKIN&macro=YOURMACRO&var1=name&value1=" + encodeURIComponent(pui.appJob.name) + "&var2=user&value2=" + encodeURIComponent(pui.appJob.user) + "&var3=number&value3=" + encodeURIComponent(pui.appJob.number)
This worked perfectly. I created a macro to receive the parms and run the DSPJOB command. Turned out pretty simple with the job info already being accessible through JavaScript.

Your guess was right that we are running genie macros from atrium that then run rich displays.

Thanks for all the info.

Sam
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests