Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us