Start Journal Physical File for all table objects in a library
<?php
$library = 'MYLIB';
$journalLibrary = 'MYLIBJRN';
$journal = 'JRNL';
// Use DB2 for i service
$connection = db2_connect('*LOCAL', '%USER%', '%PASSWORD%');
$sql = 'SELECT * FROM QSYS2.TABLES where table_schema=? and table_type=? order by table_name asc';
$params = [$library, 'BASE TABLE'];
$statement = db2_prepare($connection, $sql);
$result = db2_execute($statement, $params);
while ($row = db2_fetch_assoc($statement)) {
$row = array_map('trim', $row);
$command = 'STRJRNPF FILE(' . $row['TABLE_SCHEMA'] . '/' . $row['TABLE_NAME'] . ' JRN(' . $journalLibrary . '/' . $journal . ')';
shell_exec("system '$command'");
}