CL Variable Subsitution in QSH Command

Chan Rana

Chan Rana

Legendary Poster
Hi All,
I am writing CL script for processing a flat file from network to AS/400 OS V5R2. After FTP is completed i want to SQL the DB2 file using QSH command from the CL script. In this SQL command i want to substitute the CL vraiable where my Library is stored to be part of actual SQL when the command is run in Shell.
I tried all of the possible options using net but could not make it work. Example is as below

CL Paramater IS DATALIB with value TESTDATA

QSH command is ike below:

QSH 'db2 "Select * from &DATALIB.F55101"'

Which should give me SQL as Select * from TESTDATA.F55101

Do anyone have idea of what exact syntax is required for the CL paramter substition in QSH command. I have tried following with no success

&DATALIB
$DATALIB
${&DATALIB}

Any help is appreciated.

Thanks,
Chan
 
I could make it to work. The problem was in the CL code for text substitute syntax. I had to use *CAT.

Chan
 
Back
Top