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

How to OMIT Records and remove commas from Inputfile


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

New User


Joined: 21 Nov 2012
Posts: 3
Location: Switzerland

PostPosted: Thu Nov 22, 2012 9:11 pm
Reply with quote

Hi

I have a FB=256 Inputfile like this:

LST00,O,7D3B,B20034, ,A5AA,002107,900,HTC,75,000000053207,Y,16,
LST00,O,7D3C,B20035, ,A5AA,002107,900,HTC,75,000000053207,Y,16,
LST00,O,7D3D,B20379, ,A5AA,002107,900,HTC,75,000000053207,Y,16,
LST00T, 100022472, 95387886, 26683680,


Now I want first to OMIT all Records starting with 'LST00,'
And second to remove the Coma's on one hand and on the other I want the Value 'LST00T,' on the remaining Record beeing removed too so the ...


.... Result should look like this:
100022472 95387886 26683680


Thanks in advance for your help.
Andy
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Nov 22, 2012 9:32 pm
Reply with quote

INCLUDE only LST00T records and those records REPLACE ',' by ''

Examples available in forum
Back to top
View user's profile Send private message
Andy Gyr

New User


Joined: 21 Nov 2012
Posts: 3
Location: Switzerland

PostPosted: Fri Nov 23, 2012 4:35 pm
Reply with quote

Code:
//SYSIN   DD *                                   
  SORT     FIELDS=COPY                           
  INCLUDE COND=(1,7,SS,EQ,C'LST00T,')             
  INREC FINDREP=(IN=C',',OUT=C' ')               
  OUTREC FINDREP=(IN=C',',OUT=C' ')               
/* 



Thanks a lot for the fast reply icon_smile.gif

Andy

Code'd
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Nov 23, 2012 4:44 pm
Reply with quote

Code:
//SYSIN   DD *
  SORT FIELDS=COPY
  INCLUDE COND=(1,6,CH,EQ,C'LST00T')
  OUTFIL FINDREP=(INOUT=(C',',C''))


should suffice
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 4:49 pm
Reply with quote

Please use the Code tags to preserve spacing for what you post.

Pandora-Box is correct, unless you have a possible leading character for LST00T.

The FINDREP can be specified on INREC, OUTREC or OUTFIL, as well as in an IFTHEN. But you only need one FINDREP in your case, as you are only doing one thing, and all the commas on a record will be replaced by space with the FINDREP.

FINDREP can be limited by start-position, end-position and the number of replacements to make. Check the DFSORT manual for full details of FINDREP any anything else when you need to know it.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Nov 23, 2012 4:54 pm
Reply with quote

Please use below mentioned sort card for removing LST00T in output record.

Code:
//SYSIN  DD  *                         
 SORT FIELDS=COPY                     
 INCLUDE COND=(1,6,CH,EQ,C'LST00T')   
 OUTFIL FINDREP=(INOUT=(C',',C''))     
 OUTREC FIELDS=(1:8,73)               
/*                                     


Output:

Code:
********************************* TOP OF DATA **********************************
 100022472 95387886 26683680                                                   
******************************** BOTTOM OF DATA ********************************


Note: I assumed your record length as 80.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 5:00 pm
Reply with quote

Andy, of the quick edit, if you change your SS to CH that bit'll be fine. Everyone 'cept Sai forgot that you wanted to drop the field after you'd found it.

Sai, did you mean to put the OUTREC on the OUTFIL? There is no need for changes in two places, they can both be on INREC or OUTREC or OUTFIL.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Nov 23, 2012 6:09 pm
Reply with quote

Bill & Sai,

You still dont need to use outrec but replace C'LST00T, ' by C''
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 6:38 pm
Reply with quote

Interesting idea, Pandora-Box, however, since the replacement of "LST00T, " is in a fixed position, the FINDREP should reflect that, which would require two FINDREPs, so then need two of INREC/OUTREC/OUTFIL or using IFTHEN.

Danger with not doing that would be the unfortunate circumsance of finding "LST00T, " somewhere else in the record. Might be fine for a given file, but then copy the code for another file, and hand the primed grenade to Support... It would also do a lot of unneeded processing if you let FINDREP rip across the entire record when it doesn't need to.
Back to top
View user's profile Send private message
Andy Gyr

New User


Joined: 21 Nov 2012
Posts: 3
Location: Switzerland

PostPosted: Fri Nov 23, 2012 6:47 pm
Reply with quote

Hi to all the 'helpers'

The Code of pandora works fine!


One more (additional) question:

How would the code look like if I want to insert a line.
This line should contain a columns-name but on the same positions as the datas.

Output then should look like:
Code:

COLUMNS-1     COLUMNS-2         COLUMNS-3        COLUMNS-4        COLUMN
LST00T        100022472         95387886         21066116         200773
LST00T        100022472         95387886         20795781         198359



Once again. Thanks to all involved icon_lol.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 23, 2012 6:50 pm
Reply with quote

Have a look at the OUTFIL reporting functions, for instance HEADERn and specifically HEADER1. Lots of examples if you search here.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top