Created
December 12, 2017 12:17
-
-
Save chukShirley/32fbae2b82a94114f44e93e20c62b96b to your computer and use it in GitHub Desktop.
Start Journal Physical File for all table objects in a library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment