Midrange News for the IBM i Community

Posted by: SF00001
has no ratings.
Published: 27 Sep 2011
Revised: 23 Jan 2013 - 4138 days ago
Last viewed on: 20 May 2024 (7623 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

STRQSH Published by: SF00001 on 27 Sep 2011 view comments(3)

Is it possible to parameterize the directory path instead of hardcoding for the below command

STRQSH     CMD('cd /gisflr/telstratest/; ls -l E* > filelist.txt')   

I am using this command in a CL.

Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: Paulster
Premium member *
Sweden and The Netherlands
Comment on: STRQSH
Posted: 12 years 7 months 26 days 19 hours 15 minutes ago
Edited: Tue, 27 Sep, 2011 at 05:51:56 (4622 days ago)

Hi S,


Yep, should be something like:

CHGVAR VAR(&CMD) VALUE('cd /gisflr/telstratest/; ls -l E* > filelist.txt')


There should be plenty of examples to demonstrate the above on the www.


Happy shelling


Posted by: SF00001
Premium member *
Comment on: STRQSH
Posted: 12 years 7 months 26 days 17 hours 42 minutes ago

Hi Paulster,

Thanks for your reply. I tried as below

PGM        PARM(&FR_PATH)  


              ls -l E* > filelist.txt')                  



but the command does not seem to be containing valid characters at run time. Any ideas what could be the reason ?




Posted by: DaleB
Premium member *
Reading, PA
Comment on: STRQSH
Posted: 12 years 7 months 26 days 17 hours 32 minutes ago

Debug. Display &FR_PATH. Display &CMD after it's built. Is it what you expected?

Does &FR_PATH start with '/' (absolute path)? If not, you'd have to 'cd /' *CAT ...

btw, you don't need spaces before or after the semicolon that separates the commands.