SAVOBJ with OBJ as variable

60 pts.
Tags:
CL
SAVOBJ
Can we use variable in SAVOBJ like SAVOBJ OBJ(&OBJLIST).? I have a file containing list of objects to be saved. I was planning to read and concatenate the object names in &OBJLIST and later use in SAVOBJ. But getting a "Value 'xxxxx xxxxx' for OBJ not a name or generic name. I think the quotes are creating problem but how to get rid of them? A character variable will always have these quotes. Not sure whether we can use variable at all here. Please clarify and explain. Regards Sudip

Answer Wiki

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

How are you building the list? Can you post the code?

A quick Google search revealed this:

http://forums.systeminetwork.com/isnetforums/showthread.php?t=46300

Discuss This Question: 4  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
  • Sloopy
    A single variable in a list command parameter can only contain a single value. The way to do what you want is to construct the command as a string, then execute it using QCMDEXC. Write a small program to build the string, assuming that you will have a variable number of items in your list. This could be in CL or RPGIV, or indeed any other language. Essentially, you need a string containing 'SAVOBJ OBJ(AAAA BBBB CCCC DDDD) DEVICE(.....' (Where ..... indicates all the rest of the command string). Each list item is placed after 'OBJ(', with a space between each item. At the end of the list, add the closing bracket and the rest of the command. Then call QCMDEXC, passing the string and the length of the string. QCMDEXC will return %ERROR if an error occurred in the command. If you will ALWAYS have the same number of items in your list, you can use a variable for each item. But this is unlikely!
    2,195 pointsBadges:
    report
  • Raju400
    I was trying with following piece of code: RCVF RCDFMT(INVOBJ) CHGVAR VAR(&OBJLIST) VALUE(%SST(&INVOBJ 1 10)) READNEXT: RCVF RCDFMT(INVOBJ) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(OUT)) CHGVAR VAR(&OBJLIST ) VALUE(&OBJLIST *BCAT %SST(&INVOBJ 1 10)) GOTO CMDLBL(READNEXT) OUT: SAVOBJ OBJ(&OBJLIST) LIB(APLPROD) DEV(*SAVF) SAVF(QGPL/VERBACKUP) .... ........ ======================================================================= I have one question using QMCDEXC. How will we trap errors using this API. Do we need to do a RCVMSG? Many thanks to Teandy and Sloopy for your reply. Sudip
    60 pointsBadges:
    report
  • Satsho
    The QCMDEXC API returns the following messages only. CPF0005 Returned command string exceeds variable provided length CPF0006 Errors occurred in command. CPF3C90 Literal value cannot be changed. CPF9872 Program or service program &1 in library &2 ended. Reason code &3. Additionally, you can also monitor for any message returned by the command that is run. DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(2500) DCL VAR(&CMD) TYPE(*CHAR) LEN(2500) Build the &CMD with the SAVOBJ...... You do not need to include the quotes - the cmd should read like this SAVOBJ OBJ(STES STAD SFAD FASD DFSF FSFS) LIB(QGPL) DEV(*SAVF)... CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) ENDPGM
    1,245 pointsBadges:
    report
  • Rorr1954
    If you need to trap errors from your command use the QCAPCMD API instead of the QCMDEXC API to run your constructed command. Here is the URL to the IBM library that explains the use of this API.. http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/apis/qcapcmd.htm Any error generate by your command (in your case SAVOBJ) will be returned in the Error Code structure.
    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