View previous topic :: View next topic
|
Author |
Message |
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
Hi All,
I need to select records from an input file having claim key as 700, 491 or 834 and place these records in a new output file.
Here is the logic that I put in my program:-
IF CLAIM-KEY = '700' OR '491' OR '834'
PERFORM 2730-CLAIM-FILE
DISPLAY 'RECORDS SELECTED'
END-IF.
and in perform para I put logic as
2730-CLAIM-FILE
WRITE CLAIM-REC FROM INPUT FILE.
DISPLAY ' RECORDS WRITTEN'.
The problem that I am facing is it is selecting records only having key 700 and placing in The output file and it is not selecting records with key 491 and 834.
I checked the input file it has records for all the 3 keys but it is selecting only for key 700.
Could anyone let me know what could be the reason behind this or any logic that I need to add. Also let me know if my logic is correct. Since this project is close to its deadline date.
Thanks,
Kumar. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Which compiler are you using? What is the definition of CLAIM-KEY? Show us some input records with the 3 data values and the output file with the 700 but not other records.
Basically, your IF logic is correct. Therefore there is something else going on -- either your variable isn't right, the data doesn't match the conditions you indicate, or .... |
|
Back to top |
|
|
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
CLAIM-KEY is we have 12 byte claim no. eg:- 700-234323-01-1 the first 3 byte is called the CLAIM-KEY. So based on this claim key we have to select records.
Input file.
700234323011454545444444444444444444444543224232323232
834882137282822029900929029192019298880993767888888000
491563738298922900197766789008756780987634567890986797
Output file below showing records selected only for key 700.
700234323011454545444444444444444444444543224232323232
Kindly let me know if you have any solution for this.
Thanks,
Kumar. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Try this:
IF CLAIM-KEY(1:3) = '700' OR '491' OR '834'
Have you posted the exact code from the program or just something similar?
From the code posted, the reason is not visable. . .
Is there somewhere else in the code where processing decisions are made on the 3-position "claim-key"? The missing records may not have even made it to the "if". . . |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Is your IF statement inside a loop? If not, it's only being executed once as Dick mentioned. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Good point, Terry -- the assumption is that there's a loop around the READ (as in most programs) but there's no evidence of one from what has been posted so far. |
|
Back to top |
|
|
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
Thanks for your response. The code that I posted is the actual code. Let me check first if it is loop because after my IF there is a Move for the IF prior to my IF. I think i need to place my IF after the Move that already existed in the program.
I'll try this out and let U'll know if it is working or not. In the mean time let me know if any more hints.
Thanks,
kumar. |
|
Back to top |
|
|
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
No it is still not working out. It is selecting records only with claim key as 700.
Thanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
How many records in the input file? How many of each type that you're trying to grab? How many 700 records in the output file? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Increment a counter every time you execute that IF statement and display it at end of program. Better yet, in addition, display CLAIM-KEY every time your IF executes. |
|
Back to top |
|
|
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
I found the problem, the Input file had some bad records like 'xxxxx' for one particular field for the key i was selecting, so it was not selecting records due to this reason. I took some good records without 'xxxxx' for the key, then it worked fine.
Thanks All for all your help.
Thanks,
Kumar. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
We appreciate your feedback concerning your solution. I guess I don't see why bad records would prevent the good records from being selected though. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
We may not see more in this topic, but i suspect there are either more issues with the code or issues with the data content. . . |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
I think your're right, Dick, but I tried anyway! |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
kumar1234 wrote: |
IF CLAIM-KEY = '700' OR '491' OR '834'
PERFORM 2730-CLAIM-FILE
DISPLAY 'RECORDS SELECTED'
END-IF. |
When I read the question, the first thing that stroke me is that there is both an END-IF and a period.
Is this exactly how it is coded in the program ?
Can this be part of the problem ? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Shouldn't make any difference. END-IF, period, or both should all generate the same code for that particular IF statement. |
|
Back to top |
|
|
|