420 pts.
 Problem in AS/400 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
ASKED: September 25, 2010  4:14 PM
UPDATED: November 15, 2011  2:22 AM

Answer Wiki:
WHERE ZHSPCODE= ' *cat &zhsp end the literal and use *cat, *tcat or *bcat to add the fields value. Phil
Last Wiki Answer Submitted:  September 25, 2010  6:44 pm  by  philpl1jb   44,630 pts.
All Answer Wiki Contributors:  philpl1jb   44,630 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 !!!!

 420 pts.

 

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

 44,630 pts.

 

yes i need zhspcode in quotes …this is where problem occurs :(

 420 pts.

 

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

 44,630 pts.

 

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

 110,165 pts.

 
 10 pts.