Get rid of blanks and compress records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Get rid of blanks and compress records

Postby Mickes » Sat Nov 23, 2019 1:03 am

Hi,

I've a fixed sequential file with LRECL=23.

Layout is:
Customer pos 1-6
Text pos 7-11
Filler pos 12-13
Status pos 14-18
Flag pos 19-23

It contains following records:
ABC123TEST1..OK false
BBB222HI ..OTHERtrue
CBA321WHY ..NICE false

I want to put a ';' direct after the last letter between the fields so I get rid of the fields all spaces to the right.
I also want to OMIT field Filler.

So the output file should be as follow:
ABC123;TEST1;OK;false;
BBB222;HI;OTHER;true;
CBA321;WHY;NICE;false;

Hopefully someone can help me.

Regards,

Mikael
BBB257113 ;0000010000005289;0000;000001581693;OK ; ;ALWAYS;00000;fal
Mickes
 
Posts: 4
Joined: Sat Nov 23, 2019 12:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: Get rid of blanks and compress records

Postby Terry Heinze » Sat Nov 23, 2019 2:43 am

Please use Code tags for readability:
ABC123TEST1..OK false
BBB222HI ..OTHERtrue
CBA321WHY ..NICE false


ABC123;TEST1;OK;false;
BBB222;HI;OTHER;true;
CBA321;WHY;NICE;false;


BBB257113 ;0000010000005289;0000;000001581693;OK ; ;ALWAYS;00000;fal
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Get rid of blanks and compress records

Postby Mickes » Sat Nov 23, 2019 3:06 am

Here comes an attached file and it contains in/out file with fixed font so it's easier to read

[Attacment deleted - Terry has already edited the data display.]
Mickes
 
Posts: 4
Joined: Sat Nov 23, 2019 12:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: Get rid of blanks and compress records

Postby Robert Sample » Sat Nov 23, 2019 3:08 am

Attached files are not often downloaded on this site due to the inherent dangers they pose. Use Code tags and put your data in your posts, or your odds of getting an answer will go WAY down if you expect someone to download your attachment.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Get rid of blanks and compress records

Postby Mickes » Sat Nov 23, 2019 4:38 am

Infile:

----+----1----+----2---
ABC123TEST1..OK   false
BBB222HI   ..OTHERtrue
CBA321WHY  ..NICE false
DDD333TEST2..HOMERfalse


Outfile variable:

----+----1----+----2---
ABC123;TEST1;OK;false;
BBB222;HI;OTHER;true;
CBA321;WHY;NICE;false;
DDD333;TEST2;HOMER;false;
Mickes
 
Posts: 4
Joined: Sat Nov 23, 2019 12:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: Get rid of blanks and compress records

Postby NicC » Sat Nov 23, 2019 3:40 pm

Use PARSE to split your record into its component fields and build to join them up again with ';' separators. Use SQZ to remove spaces. There was a requirement similar to this just a few weeks ago.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post