[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

OPNQRYF MAPFLD *zoned 4 0 from field in MMDDYYYY format

Posted on 2009-12-21
6
Medium Priority
?
979 Views
Last Modified: 2013-12-06
OPNQRYF    FILE((FILEA)) OPTION(*ALL) +              
             QRYSLT('(KEY1 *GT 0) *AND +              
             (CKYR *EQ ' *CAT &YEAR *CAT ')') +        
             KEYFLD(KEY1) +      
             MAPFLD((CKYR ?????????

How do I mapfld a four digit year from a numeric field in a mmddyyyy format?
0
Comment
Question by:roosterup
  • 2
  • 2
  • 2
6 Comments
 
LVL 36

Expert Comment

by:Gary Patterson
ID: 26101376
What are you trying to do ?

- Gary
0
 
LVL 1

Author Comment

by:roosterup
ID: 26101549
trying to limit the records to the current year, 2009.  the date in the file is in this format mmddyyyy.
0
 
LVL 36

Expert Comment

by:Gary Patterson
ID: 26101570
Date is numeric or character?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Accepted Solution

by:
_b_h earned 2000 total points
ID: 26101589
Try this:
             OPNQRYF    FILE((FILEA)) QRYSLT('CKYR *EQ ' *CAT &YEAR) +  
                          MAPFLD((CKMD 'MDYY8 / 10000' *ZONED 4 0) +    
                          (CKYR 'MDYY8 - 10000 * CKMD' *ZONED 4 0))    
where MDYY8 is a numeric 8 digit field in FILEA
and &YEAR is the passed in selection value
Post back!
Barry
0
 
LVL 1

Author Comment

by:roosterup
ID: 26101629
Date is numeric
0
 
LVL 13

Expert Comment

by:_b_h
ID: 26101804
Roosterup
I tested the previous OPNQRYF against a file with a numeric date and it appears to work fine.
Do you want my test code?
Barry
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question