× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



" Not with CL"

Can you explain why you can't do this in CL?


-----Original Message-----
From: Patrik Schindler [mailto:poc@xxxxxxxxxx]
Sent: Saturday, February 08, 2020 3:28 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: renaming file on IFS

Hello Duane,

Am 07.02.2020 um 23:44 schrieb Danner, Duane <ddanner@xxxxxxxxxxxx>:

Is there a way to have a cl check the folder and if there is a file that starts with %BMOCOM then rename it to CLRBMO.TXT

Not with CL but with qsh, you can pick up the first filename and rename like this:

cd /path/in/ifs; mv `ls -1 '%BMOCOM'* |head -1` CLRBMO.TXT

Please note that in the example above the backticks are essential. These are in function like braces in mathematics: The expression within will be evaluated first and replaced by the evaluated value.

My Example is very crude because,
- it doesn't check if the destination file already exists and blindly overwrites,
- it takes only the first file (to suppress errors if multiple files with a similar name exist).

Pack this into a qsh call and it will do what you need.

(Tested successfully in qsh V4R5 :-) )

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.