Problem in AS/400 string

435 pts.
Tags:
AS/400
CL variables
CLLE
String
hi

i jaust want to put following string in a variable .

arsdoc delete -h CSPAY -v -i "WHERE ZHSPCODE= 'abc'" -f PRYW2E -G PRYW2E

here i am picking 'abc' part from file .Suppose field is zhsp that contains this part.So string will look something like this :

arsdoc delete -h CSPAY -v -i "WHERE ZHSPCODE= &zhsp" -f PRYW2E -G PRYW2E

But when a am putting this in a variable this is taking &zhsp rather than abc.

please help me out



Software/Hardware used:
as400

Answer Wiki

Thanks. We'll let you know when a new response is added.

WHERE ZHSPCODE= ‘ *cat &zhsp
end the literal and use *cat, *tcat or *bcat to add the fields value.
Phil

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • munduuu
    i used this VAR(&COM) VALUE('arsdoc delete -h CSPAY + -v -i "WHERE ZHSPCODE=' *cat &ZHSP + *tcat ''" -f PRYW2E -G PRYW2E') its not working this is showing error : String ''" -f PRYW' contains a character that is not valid. Character ''' not valid following string 'PRYW2E ' A matching apostrophe not found. help me out !!!!
    435 pointsBadges:
    report
  • philpl1jb
    Assuming this is a chgvar command VAR(&COM) VALUE(’arsdoc delete -h CSPAY + -v -i “WHERE ZHSPCODE=’ *cat &ZHSP + *bcat ' -f PRYW2E -G PRYW2E"') Right 1. I don't think you want a *tcat which would install the value of &ZHSP no space -f but a *bcat 2. then string must restart '-f PRYW2E -G PRYW2E" ') 3. don't know if value of &ZHSP needs to be presented enclosed in quotes ..because I do not know the type of ZHSPCODE or the command you are building arsdoc. But try 1 and 2 and then we'll deal with 3 if it's necessary Phil
    50,860 pointsBadges:
    report
  • munduuu
    yes i need zhspcode in quotes ...this is where problem occurs :(
    435 pointsBadges:
    report
  • philpl1jb
    VAR(&COM) VALUE(’arsdoc delete -h CSPAY + -v -i “WHERE ZHSPCODE= ''’ *cat &ZHSP + *tcat ‘'' -f PRYW2E -G PRYW2E”‘) ZHSPCODE = ''' -- three single quotes because two singles mean "paste one quote here" and the third one terminates the string.. *tcat ''' use *tcat is you don't want to include any trailing spaces in &ZHSP or *cat if you want to use &ZHSP as is followed by ''' three single quotes. One quote to start string and two qotes to print a single quote after the value of &ZHSP Phil
    50,860 pointsBadges:
    report
  • TomLiotta
    This might be a case where a new variable helps clear things up. Create a variable like this one:
       dcl   &quote       *char    1     value( '''' )
    The VALUE() parameter contains four consecutive single-quote marks. Then change:
    CHGVAR  VAR(&COM) VALUE(’arsdoc delete -h CSPAY +
             -v -i “WHERE ZHSPCODE=’ *cat &ZHSP +
             *tcat ”” -f PRYW2E -G PRYW2E’)
    Make it look like this:
    CHGVAR  VAR(&COM) VALUE(’arsdoc delete -h CSPAY +
             -v -i “WHERE ZHSPCODE=’ *cat &quote *cat &ZHSP +
             *tcat &quote *cat '” -f PRYW2E -G PRYW2E’)
    Unfortunately, that's partially a guess because I can't tell how many single- and/or double-quote marks are supposed to be in that to begin with. Tom
    125,585 pointsBadges:
    report
  • Baldy222
    Nice.
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following