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
ASKED:
July 6, 2010 10:47 AM
UPDATED:
March 3, 2011 12:02 PM
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)
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
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
*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