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

To eliminate a part of a record after a particular word


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

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Thu Nov 01, 2007 3:13 pm
Reply with quote

Hi,

I have a sequential file with no copybook. In that I have to search for a string like 'CON'. My requirement is, I have to copy all the records of the i/p file to o/p file and if a record has the word 'CON', the data after the word 'CON' should not be copied to o/p file for that record alone.

Let me explain with a example.

consider records in the i/p file as follows.

abcdefg CON SIGHAL ABDCDEDD
aaaaaaaaa
bbbbbbbbb


The output should be

abcdefg CON
aaaaaaaaa
bbbbbbbbb

how can I do this in JCL through sort or File aid???

Thanks in advance,
Sakthi.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Thu Nov 01, 2007 3:27 pm
Reply with quote

Hi Sakthi,

You can do it using DFSORT or COBOL Reference Modification.

I know COBOL Reference Modification. I will the code use that,

Code:
IF WS-INREC(9:3) = 'CON'
    MOVE WS-INREC(1:11) TO NEW-WS-INREC
    WRITE OUTREC FROM NEW-WS-INREC
ELSE
    WRITE OUTREC FROM WS-INREC
END-IF.
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Thu Nov 01, 2007 3:36 pm
Reply with quote

how can I do it fileaid or JCL (sort card).. I tried posting this question in JCL forum, but it got removed from that forum. COuld anyone please help me how can i accomplish this in JCL or Fileaid???

Thanks,
Sakthi.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 01, 2007 8:50 pm
Reply with quote

Hello Sakthi,

Which sort product does your system use? It will probably be DFSORT or Syncsort.

Your topic was moved due to the earlier reference to "sort". As you may have noticed, DFSORT questions have "their own" place in the forum. Syncsort questions are usually dealt with in the JCL section.

Depending on which sort you use and how you continue with this requirement, your topic may stay here or be relocated.
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: Thu Nov 01, 2007 10:52 pm
Reply with quote

Sakthi,

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN                                   
//SYSOUT    DD  SYSOUT=*                                   
//SORTIN DD *                                               
abcdefg CON SIGHAL ABDCDEDD                                 
aaaaaaaaa                                                   
bbbbbbbbb                                                   
xyz CON qrst                                               
xyz abc rst CON mnopqrst                                   
cc cccc   rrrr    qqq                                       
//SORTOUT DD SYSOUT=*                                       
//SYSIN    DD    *                                         
  OPTION COPY                                               
  INREC PARSE=(%01=(ENDAT=C'CON',FIXLEN=80)),               
    BUILD=(%01)                                             


SORTOUT would have:

Code:

abcdefg CON               
aaaaaaaaa                 
bbbbbbbbb                 
xyz CON                   
xyz abc rst CON           
cc cccc   rrrr    qqq     
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 PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top