425 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: Feb 14, 2012  9:09 AM GMT
UPDATED: March 17, 2012  1:31:51 AM GMT
425 pts.

Answer Wiki:
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



Here ARATDT is a Centurion date from file,I had error in OPNQRYF
Last Wiki Answer Submitted:  Feb 14, 2012  10:04 AM (GMT)  by  22917   425 pts.
To see other 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

 36,420 pts.

 

Ok i found the Mistakes i have done…

 425 pts.