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

Count no. of consecutive non-zero or not-space characters


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat May 22, 2010 2:19 am
Reply with quote

Hello,

Is there a way to count the no of CONSECUTIVE non-zero or not-space characters in a field ( 8 digits) using SYNCSORT. The field can have
the the following values in the respective digits

1 or space in position 1
2 or space in position 2
3 or space in position 3
4 or space in position 4
5 or space in position 5
6 or space in position 6
7 or space in position 7
8 or space in position 8


Ex:

If we have a value
Code:
12    78
, i want to return
Code:
 '2'
because, there are 2 sets of numbers (1,2 and 7,8) that have occured consecutively.

and if we have a value
Code:
123     
, i want to return '3'


and if we don't have any consecutive numbers, i want to return '0'.

please assist.
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: Sat May 22, 2010 3:24 am
Reply with quote

Hello,

I believe your "rules" do not match your examples. . . (or i don't completely understand the rules).

Please explain how the results were determined. 123 is only 1 set of numbers icon_confused.gif

What should happen if the data is:
Code:
12 345 6
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat May 22, 2010 5:14 am
Reply with quote

Throwing in with Dick, where is the source/justification for such a requirement? Interview question? COBOL 101 test? Sort/Utilities test?

Your requirement may be what it is, but what is the requirement looking for? Not what are you looking for, but what does the requirement require?

Ya know, surya4ug (BTW, what does that stand for?), 'we' kind of know more than one way to do something, and if you let us know just what you are trying to do, 'we' can probably help better than you just looking for another way.......
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Fri Jun 04, 2010 1:55 am
Reply with quote

I'm so sorry, i have done it easy with ezytrieve. Just was getting too mad abt syncsort and i didn't sound clear in my requirement either...

Sorry for wasting your time.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top