?
Solved

How to retrieve file names from AS400 directory

Posted on 2005-04-29
7
Medium Priority
?
767 Views
Last Modified: 2012-08-14
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
 

0
Comment
Question by:premavani
  • 2
4 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 13894197
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



0
 

Author Comment

by:premavani
ID: 13907233
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

0
 
LVL 27

Accepted Solution

by:
tliotta earned 200 total points
ID: 13911567
Prema:

Do you have QShell available? Easiest way is to use the QSH 'ls' utility to list the names. Something like:

 ==>  ls >/qsys.lib/mylib.lib/myfile.file/mymbr.mbr

Details can be added for specific examples if you need them.

If not, then you may need to write programs using IFS APIs to read the directory entries.

Tom
0
 
LVL 27

Expert Comment

by:tliotta
ID: 14997632
Note that Raj was specific in requesting a list of "directory" file names and not "library" file names.

Tom
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I came across an unsolved Outlook issue and here is my solution.
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question