Hello All, I ran into a roadblock writing a new purge process for my company. Here's the situation:
I have 3 files that hold EDI Data that I need to purge:
FILEA - Record Format FILEAR
FILEB - Record Format FILEBR
FILEC - Record Format FILECR
All of the above files have the same record length, field names, and all the field types are the same.
I created a Table File (lets call it TABLEFILE) that holds the File Name & Record Format name of each file I need to purge data from.
I wrote a CLLE that will read TABLEFILE and will extract the File Name and Record Format name (which are the 3 files listed above)
I want to be able to read through TABLEFILE, retrieve the file name & record format name, override the database file to the file name from TABLEFILE and process the records via an RPGLE.
When I go to do this, and it attempts to read the first record of my file it blows up because i cannot override the name of the record format, only the file. Granted, if i use a RENAME keyword on the F-Specs that would be fine. BUT each file has a different record format name, so using RENAME defeats the purpose if i don't have or can't qualify the record format name.
HERE'S THE ACTUAL QUESTIONS:
1-CAN I OVERRIDE THE RECORD FORMAT NAME TO BE USED IN AN RPGLE?
2-IF SO, HOW THE HECK CAN I DO THIS???
I have the file name, and the record format name, and i don't want to keep adding files to my RPGLE, which would defeat the purpose of putting things in the Table File. I'm just trying to make this dynamic so that anytime we need to add a new file (of the same type, record length, etc) i can just add a record to the file.