IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Logic to check the repeating fields


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Mon Feb 16, 2009 11:48 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 16, 2009 12:11 pm
Reply with quote

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
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Mon Feb 16, 2009 12:51 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Feb 16, 2009 1:17 pm
Reply with quote

beruoist,

Post the expected output out of your input. Also the input/output LRECL,RECFM etc.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Mon Feb 16, 2009 1:55 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Feb 16, 2009 4:20 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 16, 2009 10:13 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Feb 16, 2009 10:46 pm
Reply with quote

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
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Tue Feb 17, 2009 11:07 am
Reply with quote

Thanks Dick...Thanks Terry.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 17, 2009 11:11 am
Reply with quote

You're welcome - good luck icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts How to check whether who renamed the ... JCL & VSAM 3
No new posts No ++JCLIN, APPLY CHECK job JCL & VSAM 1
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
Search our Forums:

Back to Top