i5_ function for file date/timestamp

The place for general PHP questions and hints for PHP on IBM i
ahaithcox
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

i5_ function for file date/timestamp

Post by ahaithcox » Mon Oct 03, 2011 5:27 pm

Hey everyone!

I've been looking for a built in function in Zend that would allow me to get the date/time for a specified file by iSeries library/filename. That's the great thing about the Zend i5 functions in that you can get access to the user/password protected files, but I can't seem to find one that will allow me to get any info on a file other than i5_info (which doesn't include date or time). What I'm trying to do is get the difference between the modification date of a file and the current system/time.

Any help would be greatly appreciated.

erich_hieden
Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: i5_ function for file date/timestamp

Post by erich_hieden » Tue Oct 04, 2011 11:43 am

Try using i5_objects_list. You can find the complete documentation for Easycom over here

It gives you all of the information you get by using WRKOBJ combined with DSPFD.

Though be aware that I'm getting completely broken output of this function at the moment.

Regards

ahaithcox
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

Re: i5_ function for file date/timestamp

Post by ahaithcox » Tue Oct 04, 2011 4:45 pm

Man, that's perfect, except I'm missing a ton of info. Not sure why. This is how I retrieved it:

Code: Select all

<?php

include 'i5Connect.php';

$obj = i5_objects_list('CONLIBV', 'PFMENUSEC', '*FILE', $conn);
if (!$obj) {
    echo 'no obj';
}
else {
    $arr = i5_objects_list_read($obj);
}

print_r($arr);

?>
But my array is missing a lot of values:

Array ( [NAME] => PFMENUSEC [LIBRARY] => CONLIBV [TYPE] => *FILE [STATUS] => [EXT_ATTR] => PF [DESCRIP] => Menu Security Physical File [USR_ATTR] => [FILER1] => [AUX_POOL] => 1077952576 [OWNER] => [DOMAIN] => [CRE_DAT] => [CHG_DAT] => [STORAGE] => [COMPRESS] => [ALWPGMCHG] => [PGM_CHG] => [AUDIT] => [FILLER2] => [SRC_FILE] => [SRC_LIB] => [SRC_MBR] => [SRC_TIME] => [CREATOR] => [SYS_NAME] => [SYS_LEVEL] => [COMPILER] => [OBJ_LEVEL] => [USR_CHG] => [LIC_PGM] => [PTF] => [APAR] => [FILER3] => [SAV_TIME] => [RST_TIME] => [SAV_SIZE] => 1077952576 [SAV_MLTP] => 1077952576 [SAV_SEQNBR] => 1077952576 [SAV_CMD] => [SAV_VOLID] => [SAV_DEV] => [SAV_FIL] => [SAV_LIB] => [SAV_LABEL] => [SAV_ACTTIM] => [FILER4] => [USE_TIME] => [RESET_TIME] => [USE_DAYS] => 1077952576 [USE_INFUPD] => [FILER5] => [OBJ_SIZE] => 1077952576 [SIZE_MLTP] => 1077952576 [OVF_ASP] => [FILER6] => )

When I look at the description via PDM, all the values are there. Wonder what I'm doing wrong??

erich_hieden
Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: i5_ function for file date/timestamp

Post by erich_hieden » Tue Oct 04, 2011 5:17 pm

As I said, my output looks even worse than yours. Maybe you could contact Aura support to bring light into this?

Another possibility would be to take a look at the new XML Toolkit from Zend, which is available as a beta since ZendServer 5.1.0, though I don't know if and how you could do that with it.

Regards

ahaithcox
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

Re: i5_ function for file date/timestamp

Post by ahaithcox » Tue Oct 04, 2011 5:20 pm

Ok. Thanks for the help thus far. Greatly appreciated.

I'll battle on :)

erich_hieden
Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: i5_ function for file date/timestamp

Post by erich_hieden » Wed Oct 05, 2011 4:30 pm

I wish you good luck and let us know when you find something. :-)

User avatar
kentatzend
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: i5_ function for file date/timestamp

Post by kentatzend » Thu Oct 06, 2011 4:36 pm

you might also try the new XML toolkit being developed by IBM and Zend as an alternative. It may provide what you need.

ahaithcox
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

Re: i5_ function for file date/timestamp

Post by ahaithcox » Thu Oct 06, 2011 4:44 pm

I'll have to look into that, kentatzend. Erich mentioned that alternative as well. May be a good route.

Thanks for the help.

chris_hird
Posts: 171
Joined: Fri Apr 10, 2009 12:41 am
Location: Toronto
Contact:

Re: i5_ function for file date/timestamp

Post by chris_hird » Thu Oct 06, 2011 6:43 pm

The XMLSERVICE has no Object support as of yet. It only supports the PGM calls and some DB requests. Zend have said it will become GA soon.. Why not create a program which will return the information for you and use the i5_program calls to get the information.

Chris...
Shield Advanced Solutions Ltd
Home of JobQGenie and the Receiver Apply Program
http://www.shield.on.ca/Blog

ahaithcox
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

Re: i5_ function for file date/timestamp

Post by ahaithcox » Thu Oct 06, 2011 6:58 pm

Yeah, Chris, it's looking like a program will be my only real option at this point. I just didn't want to write, read, then clean up yet another file just to get the info I wanted. It's always nice to have a function that does it for you: $poo = my_awesome_function;

Thanks for the help. First time I've posted anything to the Zend forum; I've been impressed at the responses.

Post Reply