OPNQRYF HOW?

235 pts.
Tags:
CL Program
CLP
OPNQRYF
OS/400
V5R4
HI Everyone,

 i need a idea, i have on CL program (pgm parm) a field wndate(8,0) and i need make a opnqryf (file1) compare wndate with mvdatl(8,0), but i only wanted the first 6 position (yyyymm) of both . Anyone give a idea how can i made this?

OS/400 in V5R4M1

thanks in advanced.

 



Software/Hardware used:
OS/400 in V5R4M1

Answer Wiki

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

an example of a substring statment … quick reponse… Think this is what you’re looking for….

CHGVAR VAR(&USRDTA) VALUE(&DAY || ‘-’ +
|| %SST(&JOBDATE 1 4))

You can use MAPFLD on OPNQRYF cmd to create new fields of 6,0 based on the date fields of the file and then use these fields on QRYSLT.

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
  • Znason
    OPNQRYR compare example............... Bob OPNQRYF FILE(DBALIB/GWHFMSTR) + OPTION(*INP) + FORMAT(DBALIB/GWHFMSTR) + QRYSLT('MBLIB *EQ + "' *CAT &LIBNAME *CAT '" *AND + MBFILE *EQ "' *CAT &FILENAME *CAT '"') /* */ CPYFRMQRYF FROMOPNID(GWHFMSTR) TOFILE(DBALIB/GWHBYFILE) + MBROPT(*REPLACE) CRTFILE(*YES) + FMTOPT(*NOCHK)
    460 pointsBadges:
    report
  • philpl1jb
    OK .. If wndate was 20100706 Then is qryslt could be ... mvdatl *GE 20100701 *and mvdatl *LE 20100731 dcl wndatec *char 8 dcl wndat01 *char 8 dcl windat31 *char 8 chgvar wndatec windate chgvar wndat01 (%sst(windatec 1 6) *tcat '01) chgvar wndat31 (%sst(windatec 1 6) *tcat '31) ... qryslt ('mvdatl *GE ' *cat wndat01 *cat '*and mvdatl *LE' *cat wndat31) This time we don't need no stinkin ''' because the field mvdatl isn't character. Phil
    49,600 pointsBadges:
    report
  • philpl1jb
    Greatest movie line -- "Badges?... We don't need no... stinkin' badges!" The Treasure of the Sierra Madre 1948 How did (Humphrey Bogart get into movies with such wonderful lines. "You know how to whistle" "the stuff that dreams are made of" "Louis, I think this is the beginning of a beautiful friendship" Phil
    49,600 pointsBadges:
    report
  • Rudedog
    *CAT and %SST will get you what you need. remember though, that you need to convert the numeric date to an alpha field because of the way *CAT, *BCAT and *TCAT, and %SST work. -Sarge
    950 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