510 pts.
 OPNQRYF in CL
HI

I need to filter the records for the particular date range from a file and i need to store it in a temp file.File has date field with length 7,0 centurion date format...

Can anyone post the code



Software/Hardware used:
AS400
ASKED: February 14, 2012  9:09 AM
UPDATED: March 17, 2012  1:31 AM

Answer Wiki:
<pre>PGM DCLF FILE(AMFLIBC/YAARREP) DCL VAR(&FDATE) TYPE(*DEC) LEN(7 0) VALUE(1120101) DCL VAR(&TODAT) TYPE(*DEC) LEN(7 0) VALUE(1120214) OVRDBF FILE(YAARREP) SHARE(*YES) OPNQRYF FILE((AMFLIBC/YAARREP *FIRST FARREAQ)) + QRYSLT('ARATDT = %RANGE (&FDATE &TODAT)') CPYFRMQRYF FROMOPNID(YAARREP) TOFILE(GOVINDASAS/SPTEMP) + MBROPT(*ADD) CRTFILE(*YES) ENDPGM </pre> Here ARATDT is a Centurion date from file,I had error in OPNQRYF
Last Wiki Answer Submitted:  February 14, 2012  10:04 am  by  22917   510 pts.
All Answer Wiki Contributors:  22917   510 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

Sorry, as a rule we don’t post code. We don’t do your lessons or your work. We help and guide

What you want to do can be done with an OPNQRYF followed by a CPYFRMQRYF to create the physical file
Open Query
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcpyfrmqryf.htm

Copy from query file
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcpyfrmqryf.htm

This is one of many ways to solve this problem including:
CPYF
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcpyfrmqryf.htm

Sql SCRIPT
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcpyfrmqryf.htm

You put together some code, if you have questions post your code and the question.
Phil

 44,220 pts.

 

Ok i found the Mistakes i have done…

 510 pts.