Sorry, you do not have permission to ask a question, You must login to ask a question.

Sorry, you do not have permission to ask a question.

brainchime.com

brainchime.com

brainchime.com Navigation

  • Home
  • About Us
  • Contact Us

Mobile menu

Close
  • Home
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags

brainchime.com Latest Questions

Admin
Admin
Asked: October 6, 20242024-10-06T13:32:27+05:30 2024-10-06T13:32:27+05:30In: IBM i

How to use OPNQRYF to perform a substring on a date field?

I have a file with having date field and I want to apply a substring on the date field. I can do this in SQL using the SUBSTR function very easily. How can I do this using OPNQRYF?

control-language
  • 0
  • 0
  • 11
  • 2
  • Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
    • Share on WhatsApp

Related Questions

  • What is cpf4174 error in as400?
  • what is the use of ovrdbf in as400?
  • how to check as400 system values?
  • What is JOBQ and how to create a JOBQ in AS400?
  • What is data area in AS400 and why do we use it. What are its different types?
  • how to check job log in as400?
  • how to submit a batch job in as400?
  • How to call sql stored procedure with output parameter from within a cl program?
  • How to retrieve iSeries system name in CL program?
  • How to call sql stored procedure in cl program?
  • What is Authorization list. What are the command of authorization list?
Leave an answer

Leave an answer
Cancel reply

Browse
Browse

Choose from here the video type.

Put Video ID here: https://www.youtube.com/watch?v=sdUUx5FdySs Ex: "sdUUx5FdySs".

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Admin
    Admin
    2024-10-06T13:33:47+05:30Added an answer on October 6, 2024 at 1:33 pm

    To perform a substring on a date field, you will first have to cast the field to a string. This can be done using %char.

    The below example will convert the date field to ISO DATEFMT first and then cast it to the character. After that, the substring (%sst) function is applied.

    %sst(%char(datefield "ISO") 1 4) *EQ '1980'

    Now use it with OPNQRYF

    OPNQRYF
    FILE(libname/filename)
    QRYSLT((%sst(%char(datefield "ISO") 1 4) *EQ '1980'))

      • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp

Sidebar

Statistics

  • Questions 143
  • Answers 177
  • Comments 0
  • Popular
  • Answers
  • Admin

    Why do we use OVERLAY keyword in data structure subfields ...

    • 12 Answers
  • Admin

    How to call sql stored procedure with output parameter from ...

    • 6 Answers
  • Admin

    How to use declare global temporary table statement in RPGLE?

    • 5 Answers
  • Admin
    Admin added an answer CPF4131 is a record format level check error. This indicates… October 18, 2024 at 1:58 am
  • Admin
    Admin added an answer To open the command prompt with administrator rights you can… October 17, 2024 at 12:27 am
  • Admin
    Admin added an answer In AS400, "AS" stands for Application system. This article discusses… October 13, 2024 at 12:49 pm

Related Questions

  • Admin

    What is cpf4174 error in as400?

    • 1 Answer
  • Admin

    what is the use of ovrdbf in as400?

    • 1 Answer
  • Admin

    how to check as400 system values?

    • 1 Answer
  • Admin

    What is JOBQ and how to create a JOBQ in ...

    • 1 Answer
  • Admin

    What is data area in AS400 and why do we ...

    • 1 Answer

Trending Tags

.htaccess (1) as400 (123) bing-webmaster (2) control-language (12) db2 (33) ftp (8) google-adsense (1) google-search-console (3) https-redirect (1) iasp (4) ifs (22) jar (4) operations (3) php-my-admin (1) qshell (3) robots.txt (4) rpg (26) stored-procedure (3) stroed procedure (1) triggers (1) yoast (4)

Explore

  • Home
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags

Footer

BrainChime

BrainChime is a blog that posts question-and-answer-based format articles on diverse topics and engages in discussions by allowing people to provide answers/comments without the need to register and log in.

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • FAQs
  • Categories
  • Tags

© 2024 BrainChime. All Rights Reserved
by BrainChime.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.