You are SOOOOOO right!!!

I really blew it here - I was helping a co-worker out with their CL code - which wasn't working.

Instead of starting over, I tried to fix their code - and couldn't see the obvious.

It was confusing as my co-worker was so focused on the quotes - but that was blinding me too.

I will build separate parms and that should work fine.

Thanks to all for the assistance!!




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S Waterbury
Sent: Friday, November 08, 2013 3:15 PM
To: Midrange Systems Technical Discussion
Subject: Re: battle with quotes in CL ---- round 2

Hi, Joel:

I think you may have some misconceptions, because you appear to be going
about this "all wrong" (in my opinion). CL is not some scripting
language, it gets compiled.

When you compile a CL program, a command has parameters, and each
individual parameter can have a "variable" value, such as:

SAV DEV(&DEV) OBJ(&OBJ)

but you cannot do something like this:

CHGVAR VAR(&PARMS) VALUE('DEV''/QSYS,LIB/QTEMP.LIB/SAVF.FILE''')
SAV &PARMS

As far as I know, this has never been supported and will not work.

But you can accomplish the equivalent, like this:

DCL &CMD *CHAR 2000
CHGVAR &CMD VALUE('SAV DEV(/QSYS.LIB/QTEMP.LIB/SAVF.FILE') OBJ('
*CAT &OBJ *TCAT ')''')
CALL PGM(QSYSQCMDEXC) PARM(&CMD 2000)

Hope that helps,

Mark S. Waterbury

On 11/8/2013 4:03 PM, Stone, Joel wrote:
Thanks for all the supportive comments (except for Robs snide comment - what is that all about???)


I tried all the suggestions and none of them seem to work.

I have successfully done this in the past with STRQMQRY strings and OPNQRYF strings but there is something different going on here I am thinking.


I broke it down to a simpler CL so people can see it easier.

PGM
DCL VAR(&SAVEFILE) TYPE(*CHAR) LEN(10) value('myfile')
DCL VAR(&LIBNAME) TYPE(*CHAR) LEN(10) value('mylib')
DCL VAR(&OBJPARM) TYPE(*CHAR) LEN(30) value('/HOME/CONTRACTS')
DCL VAR(&DEVICE) TYPE(*CHAR) LEN(36)
DCL VAR(&OBJPARM2) TYPE(*CHAR) LEN(40)
DCL VAR(&qt) TYPE(*CHAR) LEN(1) value(X'7D')


chgvar &DEVICE value('/QSYS.LIB/' || &libname *tcat '.LIB)')

chgvar &OBJPARM2 value(' OBJ' || '(' || &QT || &OBJPARM *TCAT ')')

SAV (&DEVICE *TCAT &OBJPARM2)
ENDPGM



Here is the result of the job run:

At the marker labeled M1, I need a single quote. At the marker labeled M2, I need a single quote. Unfortunately, I either get a double quote (using the methods suggested) or no quote at all. Any ideas???

This must be do-able. Or are CL variables not used for the SAV type commands?


CALL PGM(jstone/aaa1) M1 M2
1400 - SAV DEV('/QSYS.LIB/mylib.LIB) OBJ(''/HOME/CONTRACTS)')
Matching quote not found in path name.
Error found on SAV command.


Thanks!


______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.