hey thanks it works....but i need to create a code which deletes the old txt files based on date...I have created a prog to purge flat file members by reding from outfile of dspfd but wat can be done to purge members from a folder or directory.
Dspflr is throwing errors saying folder not found....I believe it work only for folders(FLR) and not directories(DIR) in which my text file is.So how do i go about deleting my txt files based on date?
Hi,
You can probably use WRKLNK - but this will only output to a spooled file, then you'll have to convert the spooled file to a readable format for your programs.
Regards,
Martin Gilbert.
Hi,
Converting to a readable format basically means creating a physical file and copying the spooled file data to the physical file using the following commands :-
CRTPF
CPYSPLF
Then you can read your physical file in CL or RPG.
Regards,
Martin Gilbert.
I created a flat file and copied a spool file output of dsplnk to this flat file.But am not sure how to extract the name of the text file from this file.
Hi,
You'll need to read the file into a CL or RPG then pick the data out using %SST (CL) or subfields on an input spec (RPG).
Read until you get a record with position 26-29 = 'STMF', then use position 2-25 as the file name. If position 26-29 is not STMF ignore the record.
Regards,
Martin Gilbert,
hey gilly thanks a lot
I was able to read the file in a cl and get the name of the txtfile.
i have another query.As you suggested i have created a flat file and then copied the spool file content to this file.
Now i have created a txt file as you know in a cl.Can the same cl be used to dsplnk to a splfile and then copy from qsysprt to a flat file.Each time the cl runs a new set of records will get added to the flat file(that is details of new txt file).Purging can be done in a seperate program i believe.Can you assist?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 11  Replies