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

Convert fixed length field to variable length field


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

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 3:18 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 3:56 pm
Reply with quote

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
View user's profile Send private message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 4:17 pm
Reply with quote

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:
Code:
00105
0025D

I want to output it like this:
Code:
-120,55


Sorry for my rusty english.
Bruno Oliveira
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 4:45 pm
Reply with quote

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
View user's profile Send private message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 8:15 pm
Reply with quote

Your answer was very helpfull.

Thank you, Escapa.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 9:10 pm
Reply with quote

Bruno Oliveira wrote:
Your answer was very helpfull.

Thank you, Escapa.

I am glad it helped.. icon_smile.gif
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 Store the data for fixed length COBOL Programming 1
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top