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
 

 

Count Trailing Spaces in variable string after a constant S

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
Virendra Shambharkar

New User


Joined: 26 Aug 2015
Posts: 48
Location: India

PostPosted: Thu Feb 02, 2017 12:23 pm    Post subject: Count Trailing Spaces in variable string after a constant S
Reply with quote

We are trying to explore if we can count the trailing spaces in a variable string after a string constant using syncsort.

If we have below situations :-

1) Position of Constant String ‘AAAAAAA’ is fixed then can we count the trailing spaces using sort.

‘xxxxxxxxxxxxxxxxxxxxxxAAAAAAA ‘
‘xxxxxxxxxxxxx AAAAAAA ‘
‘x AAAAAAA ‘

2) Position of Constant String ‘AAAAAAA’ is not fixed then can we count the trailing spaces using sort.

‘xxxxxxxxxxxxxxxxxxxxxxAAAAAAA ‘
‘xxxxxxxxxxxxxxAAAAAAA ‘
‘xAAAAAAA ‘

If somebody knows a sample sort card that can be used in this it will be helpful.

Thanks in advance.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1753
Location: UK

PostPosted: Thu Feb 02, 2017 3:54 pm    Post subject:
Reply with quote

Well, the way you posted the data, there is ONE space in each case. You know you should use the code tags to present your data.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Feb 02, 2017 7:17 pm    Post subject:
Reply with quote

I believe this should be doable, but why do you want to take the trouble of counting it! Do you mind explaining a bit more on what you are trying to achieve by this.
Back to top
View user's profile Send private message
sergeyken

New User


Joined: 29 Apr 2008
Posts: 70
Location: Maryland

PostPosted: Thu Feb 02, 2017 9:52 pm    Post subject:
Reply with quote

The only useful operation that could be done on the trailing spaces when RECFM=VB is: truncation of all of them.
It can be done easily by SYNCSORT parameters/options, just RTFM.

Any other desire to count the number of trailing spaces via SYNCSORT, as I can guess, just reminds an attempt to play a new unexplored computer game. What could be the purpose of it???
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Thu Feb 02, 2017 10:46 pm    Post subject: Reply to: Count Trailing Spaces in variable string after a constant S
Reply with quote

It can be done. You need to provide the explanation Arun has asked for, and provide things like RECFM, LRECL, maximum that the field can be, does data follow the field, and provide representative sample data and expected output.
Back to top
View user's profile Send private message
Virendra Shambharkar

New User


Joined: 26 Aug 2015
Posts: 48
Location: India

PostPosted: Fri Feb 03, 2017 10:02 am    Post subject:
Reply with quote

Thanks for responding , our purpose is to calculate the actual lenght of the string and the valid lenght of the string is only until AAAAAAA. If we need to count the lenght of variable until this point where the postion of AAAAAAA can vary then can it be done using syncsort.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Feb 03, 2017 12:37 pm    Post subject: Reply to: Count Trailing Spaces in variable string after a constant S
Reply with quote

See here.
Back to top
View user's profile Send private message
Virendra Shambharkar

New User


Joined: 26 Aug 2015
Posts: 48
Location: India

PostPosted: Fri Feb 03, 2017 1:32 pm    Post subject:
Reply with quote

Thanks , we were able to figure out how to do this using SORT.
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: Fri Feb 03, 2017 7:58 pm    Post subject: Reply to: Count Trailing Spaces in variable string after a constant S
Reply with quote

Quote:
See here.

Ah, an exercise in recursion. icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Feb 03, 2017 8:20 pm    Post subject: Reply to: Count Trailing Spaces in variable string after a constant S
Reply with quote

Yes, the questions hadn't been answered.

Virendra Shambharkar,

Would you mind sharing the code? I'm impressed you got it, and some more examples are always useful. Thanks.
Back to top
View user's profile Send private message
Virendra Shambharkar

New User


Joined: 26 Aug 2015
Posts: 48
Location: India

PostPosted: Mon Feb 06, 2017 8:56 am    Post subject: Reply to: Count Trailing Spaces in variable string after a constant S
Reply with quote

Below are the sort cards one of our colleagues suggested and it works. We tested it on a 900 byte string

Code:
SORT FIELDS=COPY                                           
  INREC PARSE=(%00=(ENDAT=C'AAAAAAA',FIXLEN=900)),           
  BUILD=(%00)                                                 
  OUTFIL INCLUDE=(1,900,SS,EQ,C'AAAAAAA'),FTOV,VLTRIM=C' '   


SORT FIELDS=COPY                                           
OUTFIL VTOF,BUILD=(1,2,BI,SUB,+11,EDIT=(IIIIIT),30:X),
REMOVECC
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm


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