#!/usr/local/bin/perl

$PRAM_HOME_DIR = "/home/pram/";
$PRAM_BIN_DIR  = $PRAM_HOME_DIR."bin/";
$PRAM_PB_JOBS  = $PRAM_BIN_DIR."pb-jobs";


open(JOBS, "$PRAM_PB_JOBS|") || die "Can't execute $PRAM_PB_JOBS\7\n";

$first_line=<JOBS>;

if($first_line =~ "There are presently no jobs submitted.")
{
    print "nix los\n";
}
else
{
    while($line=<JOBS>)
    {

	@items=split(/[ \t\n]*\|/, $line);

	$job_id  = $items[0];
	$status  = $items[1];
	$owner   = $items[2];
	$timeout = $items[3];
	$upterm  = $items[4];
	($program) = split(/[ \t\n]+/,$items[7]);
	$program = substr($program, rindex($program, "/")+1);

	print "Job-Id : $job_id";
	print "Status :	$status";
	print "Owner  :	$owner";
	print "Timeout:	$timeout";
	print "UpTerm :	$upterm";
	print "Program: $program\n";
    }
}
