|
View previous topic :: View next topic
|
| Author |
Message |
Andy Gyr
New User

Joined: 21 Nov 2012 Posts: 3 Location: Switzerland
|
|
|
|
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 |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
INCLUDE only LST00T records and those records REPLACE ',' by ''
Examples available in forum |
|
| Back to top |
|
 |
Andy Gyr
New User

Joined: 21 Nov 2012 Posts: 3 Location: Switzerland
|
|
|
|
| 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
Andy
Code'd |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,6,CH,EQ,C'LST00T')
OUTFIL FINDREP=(INOUT=(C',',C'')) |
should suffice |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Bill & Sai,
You still dont need to use outrec but replace C'LST00T, ' by C'' |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Andy Gyr
New User

Joined: 21 Nov 2012 Posts: 3 Location: Switzerland
|
|
|
|
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  |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Have a look at the OUTFIL reporting functions, for instance HEADERn and specifically HEADER1. Lots of examples if you search here. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|