AS400  IFS file rename

Oramcle
Oramcle used Ask the Experts™
on
I am Running a process which read each month  control record by reading one record for each month from Physical file & that process create 3 csv files on each month in ifs (/home/one) for each month same name which I have this automated through CL.

Now I have to add another functionality so that will move the  files from /home/one/*.csv  to /home/two/Jan_2017_*.csv and read the next month control record.

I Have the prefix Jan_2017  to Dec_2017  also in the physical file.

How can I add this functionality into my CL for each month?

Thank you in advance as always.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Application Consultant
Commented:
I advise to use the Qshell option to rename the files

But is it's archive only you also can zip them from the as/400, with qshell
e.g.

QSH CMD('cd /HOME/ONE')
QSH CMD('jar -cfM /HOME/TWO/Jan_2018.zip  *')


Or from CL:
CHGVAR     VAR(&CMD)  VALUE(' jar -cfM /home/tku/two/Jan_2018.zip  *' )
STRQSH     CMD(&CMD)

of course you can create the &CMD parameter dynamically
Phillip KnoxSenior Systems Analyst

Commented:
"Now I have to add another functionality so that will move the  files from /home/one/*.csv  to /home/two/Jan_2017_*.csv and read the next month control record."

So you have a Jan_2017_.csv file in /home/one that you want moved to /home/two?
Theo KouwenhovenApplication Consultant
Commented:
MOV OBJ('/home/one/*.csv')    
               TODIR('/home/two/Jan_2017/*csv')      
Theo KouwenhovenApplication Consultant

Commented:
both are good options

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial