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

Identify the 'n' th occurance of a character in a record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Fri Nov 05, 2010 6:42 am
Reply with quote

Hi ,

Could you please help me with this

Input: VB file of LRECL 259
Output: VB file of LRECL 259

Need to find the 15th occurance of '|' symbol in every line and need to check if the next character is also'|', if yes then insert a zero between the '|' symbols and write the entire record in the output file, else write the input record as it is to the output file.

Many thanks.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Nov 05, 2010 9:07 pm
Reply with quote

SAS solution OK?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 06, 2010 12:04 am
Reply with quote

THINKSRINIII,

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output with respect to the example.
Back to top
View user's profile Send private message
VishnuPrakash

New User


Joined: 10 Jun 2010
Posts: 10
Location: Bangalore

PostPosted: Sat Nov 06, 2010 12:13 am
Reply with quote



We can do this in REXX....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Nov 06, 2010 2:10 am
Reply with quote

keep in mind:

if you take a 259 input
add 1 char
output will be 260
VishnuPrakash wrote:
We can do this in REXX.


VishnuPrakash,

what if there are 500,000 records in the file?
for a small file, yes you can code a REXX Script,
but by the time you have written the script (to account for large files) , and tested it
you could come up with the Sort CONTROL Cards,
COPY,
.....
never have to worry about file size,
and the execution time for large files would be not acceptable for a script, where as a Sort solution would be very fast.

think about the consequences of your suggestions and
when there are things to consider, include them in you suggestion.

Welcome to the forum, by the way.
yes, a REXX Script could be a solution, but not the best.
and, it is common practice to provide the Script, if that is your suggestion.
But, keep in mind this is a DFSORT forum,
and the TS requested a DFSORT solution.
Back to top
View user's profile Send private message
VishnuPrakash

New User


Joined: 10 Jun 2010
Posts: 10
Location: Bangalore

PostPosted: Mon Nov 08, 2010 12:03 pm
Reply with quote

@dbzTHEdinosauer

Yes you are correct.... REXX cannot handle large number of records at a time..but if the file size is small we can use REXX....any how i did not think till that extent....

Thank you for welcoming me to the Forum...
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
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