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
 

 

Finding the presence of a character in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Sun Feb 04, 2007 7:27 pm    Post subject: Finding the presence of a character in a file
Reply with quote

Hi,
I have to parse a data file delimited by a special character.But there are certain situations in which the special character itself existx as a part of data.In such a scenario , my program abends.So I need a SORT or FILEAID step before my program, which will eliminate records having the special character as a part of data and put it in another file.

Example: Say I have pipe delimited data

Input file:

Code:

Line1: data1 | data2 | data3 | data 4|
Line2: data1 | data2 | data3 | data 4|
Line3: data1 | da|ta2 | data3 | data 4|
Line4: data1 | data2 | da|ta3 | data 4|
Line5: da|ta1 | data2 | data3 | data 4|
Line6: data1 | data2 | data3 | data 4|
Line7: data1 | data2 | data3 | data 4|


I can find out the records having pipe based on the count of it in a line
So in my example lines 3,4 & 5 have more than 4 '|' symbols....So they have to eliminated.

So my output should be"

Code:

Input file to my program:
Line1: data1 | data2 | data3 | data 4|
Line2: data1 | data2 | data3 | data 4|
Line6: data1 | data2 | data3 | data 4|
Line7: data1 | data2 | data3 | data 4|


Code:

Discard file
Line3: data1 | da|ta2 | data3 | data 4|
Line4: data1 | data2 | da|ta3 | data 4|
Line5: da|ta1 | data2 | data3 | data 4|


Can somebody suggest me a solution.Need not be a Sort.Any other tool like Fileaid or something is also ok.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Sun Feb 04, 2007 10:05 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's PARTSE function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
data1 | data2 | data3 | data 4|
data1 | data2 | data3 | data 4|
data1 | da|ta2 | data3 | data 4|
data1 | data2 | da|ta3 | data 4|
da|ta1 | data2 | data3 | data 4|
data1 | data2 | data3 | data 4|
data1 | data2 | data3 | data 4|
/*
//KEEP DD SYSOUT=*
//DISCARD DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC PARSE=(%1=(STARTAT=C'|',FIXLEN=1),
               %2=(STARTAT=C'|',FIXLEN=1),
               %3=(STARTAT=C'|',FIXLEN=1),
               %4=(STARTAT=C'|',FIXLEN=1),
               %5=(STARTAT=C'|',FIXLEN=1)),
     OVERLAY=(81:%1,%2,%3,%4,%5)
  OUTFIL FNAMES=DISCARD,INCLUDE=(81,5,CH,EQ,C'|||||'),
    BUILD=(1,80)
  OUTFIL FNAMES=KEEP,SAVE,
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Mon Feb 05, 2007 11:54 pm    Post subject: Re: Finding the presence of a character in a file
Reply with quote

Yet another smart solution to be added into the "Smart Tricks".... icon_smile.gif
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Thu Feb 08, 2007 10:44 pm    Post subject: Thanks a lot...!!!
Reply with quote

Thanks for the solution.It really helped...
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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