OPNQRYF in CL

515 pts.
Tags:
AS/400
CL/400
OPNQRYF
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

Answer Wiki

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

<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

Discuss This Question: 2  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
  • philpl1jb
    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
    51,365 pointsBadges:
    report
  • 22917
    Ok i found the Mistakes i have done...
    515 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