WRKLNK on iSeries – HOW CAN I LIST THE STMF FILES UNDER A DIRECTORY

45 pts.
Tags:
CL Program
STMF
WRKLNK
How can I list or retrieve in a cl program the STMF files under a specific directory? Urgent reply requested. I am running a cl program that run use a software package that runs decryption on a group of stmf data with variable name. I need to retrieve the names in my cl to do further processing. Or have a way to list them to an iSeries data file.
ASKED: April 9, 2009  5:18 PM
UPDATED: April 13, 2009  7:37 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could try using DSPLNK. In your CL set the directory using CD (CD DIRNAME). Next use DSPLNK to list the Stream File entries out to a spoolfile. The User Data value on the spoolfile will equal DSPLNK. Now use the CPYSPLF command to retrieve the spoolfile into a data file. You can declare the data file at the top of your CL. Once the file is loaded via the copy command you can start to receive the records from the file and parse out the stream file name.

————————————

In <a href=”http://www.brucevining.com/Articles/Article_PDFs/IndustryStandardAPIsfortheCLProgrammer_StructuresDataTypesandErrorNotification.pdf”>this article</a> is a sample program that returns the name of files found in a given directory. The directory name is a parameter to the program and in (N) of Figure 1 the CL variable &Name holds the name of a directory entry during each iteration of the DoWhile loop.

I hope this helps,
Bruce Vining
<a href=”http://www.brucevining.com/”>Bruce Vining Services</a>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • mcl
    If you can get to the directory through the IFS you can use QSHELL commands The command would be something like "QSH CMD(ls -l directory > qsysFile)" and then use a simple DSPPFM to view the file. "ls -l" is the Unix command to list a directory. There are lots of Unix references on the web - This is one. "directory" is the path to the directory you want to list ">" send the listing to a file "qsysFile" is the file you want to put the listing in. This should be formatted as
     "/qsys.lib/yourlib.lib/yourfile.file/yourfile.mbr"
    Then to look at the directory use the command
    DSPPFM     FILE(YOURLIB/YOURFILE)
    Hope this helps. Regards Mike
    2,740 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following