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

Finding the presence of a character in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sun Feb 04, 2007 10:05 pm
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:

Use [URL] BBCode for External Links

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
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
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 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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top