Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Logic to check the repeating fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Logic to check the repeating fields
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    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Mon Feb 16, 2009 1:17 pm    Post subject:
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    Post subject:
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: 2180
Location: @my desk

PostPosted: Mon Feb 16, 2009 4:20 pm    Post subject:
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

Site Director


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

PostPosted: Mon Feb 16, 2009 10:13 pm    Post subject:
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: 1239
Location: Richfield, MN, USA

PostPosted: Mon Feb 16, 2009 10:46 pm    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Tue Feb 17, 2009 11:11 am    Post subject: Reply to: Logic to check the repeating fields
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us