View previous topic :: View next topic
|
Author |
Message |
beruoist
New User
Joined: 14 Nov 2007 Posts: 70 Location: mumbai
|
|
|
|
Hi
I have a field with 500 occurences of PICX(10).Now every occurence should start with 1-9 where 7 and 8 cant be repeated.That means 7 and 8 can be used only once..but anywhere and at any place.
for example.
1/some data
2/some data
2/ some data
3/some data
5/some data
6/some data
5/some data
5/some data
8/some data
7/some data
Thanks
Beruoist |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
You need to paste some actual sample data..
what sample you have given is confusing.
you are saying
Quote: |
That means 7 and 8 can be used only once..but anywhere and at any place.
|
But in sample its looking like nos 1-9 are coming only in first place.
does no always followed by '/' ?
Is file is already sorted?
please clarify. |
|
Back to top |
|
|
beruoist
New User
Joined: 14 Nov 2007 Posts: 70 Location: mumbai
|
|
|
|
Yes...
1) position of the numbers (1-9) is fix and they are always followed by a '/'
2) We do not need to sort file here.
3 By saying "That means 7 and 8 can be used only once..but anywhere and at any place. " ... i mean at any occurence between 1-500.
Regards
BERUOIST |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
beruoist,
Post the expected output out of your input. Also the input/output LRECL,RECFM etc. |
|
Back to top |
|
|
beruoist
New User
Joined: 14 Nov 2007 Posts: 70 Location: mumbai
|
|
|
|
As i mentioned...
Input is a array field with 500 occurences.[ pic X10 occurs 500 times]
Output should be a error message if the validation(that is if second occurence of 7 or 8 is found in the first position) fails
Input field is coming from Database[adabas].
Please tell me if you need any other info |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
Please tell me if you need any other info |
You need to provide the details requested here to get help from a forum. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Define 2 indicators in ws - one for "found-7" the other for "found-8".
Loop thru the array looking for a 7 or an 8. When either is found, check if the indicator is already set as having found this value previously. If already found - it is an error. If not already found, set the indicator that this value has been found.
The loop should end whenever there is an error or the end of the array is reached. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I would use Dick's solution but would replace the indicators by tallies. Increment the appropriate tally when encountering a 7 or 8 and display these tallies at end of program. End the program however you want to depending on the values of the 2 tallies. |
|
Back to top |
|
|
beruoist
New User
Joined: 14 Nov 2007 Posts: 70 Location: mumbai
|
|
|
|
Thanks Dick...Thanks Terry. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
|