opnqryf

pts.
Tags:
AS/400
i am a new programmer. my question is can you move a field that is being put into a dspf to a query using the cl program that is also calling the dspf without using rpg. i have been unsuccessful so far

Answer Wiki

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

Can you supply a sample of the CL code you are using?

Discuss This Question: 3  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
  • Cowboypgmr
    TOFMT(*YYMD) TOSEP(*NONE) MONMSG MSGID(CPF0555) EXEC(DO) CHGVAR VAR(&IN39) VALUE('1') GOTO CMDLBL(START) ENDDO CHGVAR VAR(&DATEBG) VALUE(&BDATE) CHGVAR VAR(&DATEED) VALUE(&EDATE) CHGVAR VAR(&DTEBEG) VALUE(&DATEBG) CHGVAR VAR(&DTEEND) VALUE(&DATEED) RUNQRY QRY(CWQUERY/query) OOP: OVRDBF FILE(fileFINAL) TOFILE(QTEMP/file) + SHARE(*YES) OPNQRYF FILE((QTEMP/File)) OPTION(*ALL) QRYSLT('(ODITM *EQ + *AND (ODINVN *NE 0) *AND (&DATEBG +*LE ODITE *LE &DATEED)')
    0 pointsBadges:
    report
  • WaltZ400
    The QRYSLT parameter on the OPNQRYF command does not work well if you include program variables. The best thing to do is create a variable named &QRYSLT which is character and large enough to hold your selection criteria. Because you only provided a snippet of code, I am going to assume some things. 1. &DATEBG and &DATEED are character representations of a date and the date field you are comparing to is also. 2. You are comparing field ODITM to a character value as well although your code doesn't show it. I am going to call this variable &ITEM for this example. Set the &QRYSLT variable using the CHGVAR command like so: CHGVAR VAR(&QRYSLT) VALUE('ODITM *EQ "' *CAT &ITEM + *TCAT '" *AND (ODINVN *NE 0) *AND ODITE + *EQ %RANGE("' *CAT &DATEBG *TCAT '" "' + *CAT &DATEED *TCAT '")') Note the double quotes are surrounding the character variables in the &QRYSLT so when it is translated it will look like this: ODITM *EQ "item" *AND (ODINVN *NE 0) *AND ODITE *EQ %RANGE("mmddyy" "mmddyy") where 'item' and 'mmddyy' represents the actual values passed. Then when you execute the OPNQRYF you would use OPNQRYF QRYSLT(&QRYSLT) plus all other parms you have for file name, open type etc. Hope this helps.
    655 pointsBadges:
    report
  • TomLiotta
    The QRYSLT parameter on the OPNQRYF command does not work well if you include program variables. The QRYSLT parameter works fine with program variables. In the example, though, program variables aren't being used. The example shows that the variable names are inside of the quotes. That causes them not to be names any more. They're just contants in the middle of the string. The variables need to be outside of any quotes. For example:
    QRYSLT(’(ODITM *EQ ''somevalue'' +
    *AND (ODINVN *NE 0) *AND (''' *cat &DATEBG *cat +
    ''' *LE ODITE *AND ODITE *LE ''' *cat &DATEED *cat ''')’) 
    Without seeing the definitions, it's not possible to know if embedded quotes needed to be supplied around the two date variables. Nor is it possible to know if the logic of the QRYSLT() expression is rational. Tom
    125,585 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