Link to home
Start Free TrialLog in
Avatar of premavani
premavani

asked on

How to retrieve file names from AS400 directory

Hello,

We need to get only file names from AS400 directory. Is there anyway to get job number of a specific job?

EG: We have created a spool file with default name that has a job number that identifies different spool files.
How to retrieve this job number during the file creation time?

Eg for 1st situation: We have created a directory in AS400. The files keep on adding to the directory. How to retrieve all these file names at any time?

Please respond quickly.

Thanks in Advance
 

Avatar of Theo Kouwenhoven
Theo Kouwenhoven
Flag of Netherlands image

Hello premavani,

First:  We need to get only file names from AS400 directory

Just run the dspobjd command:

DSPOBJD OBJ(MYFILELIB/*ALL)          
        OBJTYPE(*FILE)            
        OUTPUT(*OUTFILE)          
        OUTFILE(MYLIB/FILELIST)    

Now you have a file FILELIST in library MYLIB. and you can browse the contents.
if you just want to have the file names run a query or copy the file with *MAP *DROP option
to a new file by:
creating file ODOBNM with  CRTPF FILE(MYLIB/ODOBNM) RCDLEN(10)

And copy the contents of the FILELIST with:

CPYF FROMFILE(MYLIB/FILELIST)
     TOFILE(MYLIB/ODOBNM)  
     MBROPT(*REPLACE)        
     CRTFILE(*NO)            
     OUTFMT(*CHAR)          
     FMTOPT(*MAP *DROP)      


> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

About the jobnumber:

type WRKACTJOB
and press 2 times the F11 there you see all the jobnumbers.

Regards,
Murph



Avatar of premavani
premavani

ASKER

Hi Murph,

DSPOBJD will retreive file names that are there in the library.
I want to retrieve file names from an AS400 directory.

EG: we have created a directory called tmp in AS400. In that directory we have kept few xml files.
To process these files, we need the xml file name. Is there any CL command to retrieve these file names?

Please respond ASAP.

Thanks
Prema

ASKER CERTIFIED SOLUTION
Avatar of Member_2_276102
Member_2_276102

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that Raj was specific in requesting a list of "directory" file names and not "library" file names.

Tom