Genie Job Name/User/Number
Posted: Fri Apr 28, 2017 3:12 pm
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?
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:
Thanks,
Sam
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'
���������@@����������������"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;
Sam