View previous topic :: View next topic
|
Author |
Message |
Bruno Oliveira
New User
Joined: 28 Jan 2010 Posts: 16 Location: Portugal
|
|
|
|
I know that DFSORT can extract and justify delimited fields like this:
From:
Code: |
AAA;1;A2;13.2
AAA;25;A;2.0
AAA;3;A35;521.5
AAA;4;A999;51.7
|
To:
Code: |
AAA; 1;A2 ; 13.2
AAA;25;A ; 2.0
AAA; 3;A35 ;521.3
AAA; 4;A999; 51.7 |
But my question is: can DFSORT read a fixed field file and convert it to a variable length field file?
Here is an example of what I want:
From:
Code: |
08120092009010100000198
08220092009010100023054
38020092009010100000000 |
To:
Code: |
81;2009;20090101;1,98
82;2009;20090101;230,54
380;2009;20090101;0,00
|
Bruno Oliveira |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
But my question is: can DFSORT read a fixed field file and convert it to a variable length field file?
|
do you really mean variable length file or semicolon delimited file?
Code: |
08120092009010100000198
08220092009010100023054
38020092009010100000000 |
In above example how to identify fields?
are they fixed length? if yes show the format,starting pos,length of each field. |
|
Back to top |
|
|
Bruno Oliveira
New User
Joined: 28 Jan 2010 Posts: 16 Location: Portugal
|
|
|
|
The example file is this:
Code: |
08120092009010100000198
08220092009010100023054
38020092009010100000000 |
Ant the format is:
Code: |
numeric, 1, 3 -> PIC 9(3)
numeric, 4, 4 -> PIC 9(4)
numeric, 8, 8 -> PIC 9(8)
numeric, 16, 8 -> PIC 9(6,2)
|
And I mean semicolon delimited file.
Other example I can give you:
With a PIC S9(7,2) COMP-3 variable:
I want to output it like this:
Sorry for my rusty english.
Bruno Oliveira |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Your other example is more confusing...
please check below sort step.. which will give output as you have shown in initial post....
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
08120092009010100000198
08220092009010100023054
38020092009010100000000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,ZD,EDIT=(III),C';',
4,4,ZD,EDIT=(IIII),C';',
8,8,ZD,EDIT=(IIIIIIII),C';',
16,6,ZD,EDIT=(IIIIIT),C',',22,2)),
IFTHEN=(WHEN=NONE,BUILD=(1,27,SQZ=(SHIFT=LEFT)))
/*
|
Output will be...
Code: |
81;2009;20090101;1,98
82;2009;20090101;230,54
380;2009;20090101;0,00
|
Your second and third field looks like year and date. if you want it as it is then use
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,ZD,EDIT=(III),C';',
4,4,C';',8,8,C';',16,6,ZD,EDIT=(IIIIIT),C',',22,2)),
IFTHEN=(WHEN=NONE,BUILD=(1,27,SQZ=(SHIFT=LEFT)))
/* |
|
|
Back to top |
|
|
Bruno Oliveira
New User
Joined: 28 Jan 2010 Posts: 16 Location: Portugal
|
|
|
|
Your answer was very helpfull.
Thank you, Escapa. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Bruno Oliveira wrote: |
Your answer was very helpfull.
Thank you, Escapa. |
I am glad it helped.. |
|
Back to top |
|
|
|
|