Need to list out files in IFS directory to PF in qtemp
Last Post 29 Jan 2013 10:23 AM by Emmanuel. 10 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
cat5ive
New Member
New Member
Posts:45

--
22 Jan 2013 07:33 PM

Hi,

I need to list out files in IFS directory to PF in qtemp. I have used qshell command, below, in other program. But problem  with qshell cmd is  I cannot put result in qtemp.

QSH CMD('LS -lT /home/mydir/ > /qsys.lib/mylib.lib/myfile.file/mymbr.mbr')

Reason that I have to put in qtemp is because multiple users will run this program at the same time. So I don't want the listing result to override each other. 

Other alternative will be list the files out in spoolfile then copy spool file to qtemp. The only command that I know that will print out the ifs files is DSPLNK. Problem with this command is it doesn't give the date/time stamp for each file. I would like to have either time stamp of when the file was created, modified, or put in the IFS folder. Another problem with the DSPLNK is when the file name is too long then it get truncated. Files that have long name will be list out at the bottom separate from the files that have short name.

result form DSPLNK

 

Object . . . . . . . :   /mydir/*                   
Object type  . . . . :   *ALL                          
Detail . . . . . . . :   *PRV                          
Display option . . . :   *PRV                          
Directory  . . . . :   /mydir                       
Object link             Type      Attribute     Text   
.                          DIR  
..                         DIR  
customer_-0256937.xl >     STMF 
Customer-1.XLS             STMF
* * * Full text of truncated lines * * * 
customer_-0256937.xls  

 

Thanks in advance for any help.

Terry Winchester
Advanced Member
Advanced Member
Posts:406

--
23 Jan 2013 03:58 AM
We use an older IBM utility: http://www-912.ibm.com/s_dir/SLKBas...enDocument

It will place the information directly into a file in QTEMP...or any other library.

Terry


Emmanuel
Veteran Member
Veteran Member
Posts:809
Avatar

--
23 Jan 2013 07:36 AM

RTVDIRINF will do this - note that the command is shipped with *PUBLIC authority set to *EXCLUDE.

Cheers,

Emmanuel

Brian Rusch
Advanced Member
Advanced Member
Posts:554

--
23 Jan 2013 10:00 AM
If you want to stick with QSHELL, this is should work:

OVRDBF FILE(STDOUT) TOFILE(QTEMP/myfile) OVRSCOPE(*JOB)
QSH CMD('LS -lT /home/mydir/')
cat5ive
New Member
New Member
Posts:45

--
23 Jan 2013 01:02 PM
Hi,

I tried RTVDIRINF. It won't allow outputting to qtemp. I got below errors.
Constraint is not valid.
Constraint cannot be added to file QAEZD0001D.
QAEZD0001D in QTEMP not valid for operation.
Error occurred retrieving directory information.

I download the old IBM utility like Terry suggest. It works like what I wanted but when I download I only got the object. There's no source code. Where can I get the source code?
It's for program QRYIFSLIB.

Brian, thank you. I will try that.
Scott Mildenberger
New Member
New Member
Posts:66

--
23 Jan 2013 01:12 PM

Look at this http://www.scottklement.com/rpg/ifs.html

It has examples how to read a directory in the ifs, you can modify it to do whatever you want with the list of files.

Terry Winchester
Advanced Member
Advanced Member
Posts:406

--
23 Jan 2013 01:19 PM

IBM doesn't provide the source code for QRYIFSLIB.   Why do you need the source code?

Terry

cat5ive
New Member
New Member
Posts:45

--
23 Jan 2013 02:39 PM
Terry, ok never mind then.

Thank you evevry one for your help.
Emmanuel
Veteran Member
Veteran Member
Posts:809
Avatar

--
24 Jan 2013 09:16 AM

Did not realize there was an issue with output to QTEMP using RTVDIRINF, and neither did IBM.

I've opened a PMR, and will update when IBM provides a fix.

Cheers,

Emmanuel

amc
Basic Member
Basic Member
Posts:111
Avatar

--
24 Jan 2013 04:46 PM
have a look at EASY400 IFSTool, the readdir command does exactly what you want

http://www.easy400.net/easy400h/ifstool.htm
Emmanuel
Veteran Member
Veteran Member
Posts:809
Avatar

--
29 Jan 2013 10:23 AM

Here's the response from IBM:

"This is not a defect, and this is not a limitation of the RTVDIRINF command itself. It's a limitation of SQL, which the command uses to build and populate the database files produced by the command. The RTVDIRINF command isn't specifically requesting this constraint. We create one of these files (the "D" file) with a primary key. It is apparently a limitation of SQL that you cannot create a file with a primary key in QTEMP. I believe this has to do with the fact that QTEMP is not a unique library name on the system.

Yes this is working as designed.   The message they are getting is probably CPD32B0 and rc = 15 (15 - The file cannot be in the QTEMP library. )    I was told they can't  have a constraint or trigger in QTEMP because they have to store cross reference information about it and you can't do that so it is working as intended."

I suggested that this limitation should be added to the command documentation.

IBM has created a KB document which indicates the QTEMP restriction:

http://www-912.ibm.com/s_dir/SLKBas...enDocument

 Cheers,

Emmanuel

You are not authorized to post a reply.

Acceptable Use Policy